#include <Python.h>

static PyObject*
really_call_ftw(PyObject* self, PyObject* args)
{
	PyObject* dirname = NULL;

	/* Check for errors from called functions. */
	if (PyArg_ParseTuple(args, "O", &dirname) == 0)
		return NULL;

	const char* dirname_string = PyString_AsString(dirname);
	if (dirname_string == NULL)
		return NULL;

	PyObject* returnval = PyString_FromFormat("%s is the dir", dirname_string);

	/* if returnval is NULL, that's still what we want to return. */
	return returnval;
}

static PyMethodDef FtwMethods[] = {
	{"ftw", really_call_ftw, METH_VARARGS, "Traverse a directory structure."},
	{NULL, NULL, 0, NULL}
};

PyMODINIT_FUNC
initftw5()
{
	Py_InitModule("ftw5", FtwMethods);
}
