blob: c4d7201f3fbc0005ec5c41001a524f90480f095a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
from cffi import FFI
ffi = FFI()
ffi.cdef(""" // some declarations from the man page
struct passwd {
char *pw_name;
...;
};
struct passwd *getpwuid(int uid);
""")
C = ffi.verify(""" // passed to the real C compiler
#include <sys/types.h>
#include <pwd.h>
""")
print ffi.string(C.getpwuid(0).pw_name)
|