5 spam_system(PyObject *self, PyObject *args)
10 if (!PyArg_ParseTuple(args, "s", &command))
12 sts = system(command);
13 return PyLong_FromLong(sts);
16 static PyMethodDef SpamMethods[] = {
17 {"system", spam_system, METH_VARARGS,
18 "Execute a shell command."},
19 {NULL, NULL, 0, NULL} /* Sentinel */
22 static struct PyModuleDef spammodule = {
23 PyModuleDef_HEAD_INIT,
24 "spam", /* name of module */
25 NULL, /* module documentation, may be NULL */
26 0, /* size of per-interpreter state of the module */
33 return PyModule_Create(&spammodule);