OSDN Git Service

Code drop from //branches/cupcake/...@124589
[android-x86/external-e2fsprogs.git] / contrib / python-uuid / uuid.c
1 #include <Python.h>
2 #include <time.h>
3 #include <uuid/uuid.h>
4
5 static PyObject * _uuid_generate(PyObject *self, PyObject *args)
6 {
7   uuid_t u;
8   char uuid[37];
9   if (!PyArg_ParseTuple(args, "")) return NULL;
10   uuid_generate(u);
11   uuid_unparse(u, uuid);
12   return Py_BuildValue("s", uuid);
13 }
14
15 static PyMethodDef _uuid_methods[] = {
16   {"generate", _uuid_generate, METH_VARARGS, "Generate UUID"},
17   {NULL, NULL, 0, NULL}
18 };
19
20 void inite2fsprogs_uuid(void)
21 {
22   (void) Py_InitModule("e2fsprogs_uuid", _uuid_methods);
23 }