blob: a771b6878d6eea38b3206e3c7caa5b55f7cc4a5b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
from cffi import FFI
ffi = FFI()
ffi.cdef("""
typedef ... DIR;
struct dirent {
unsigned char d_type; /* type of file */
char d_name[]; /* filename */
...;
};
DIR *opendir(const char *name);
int closedir(DIR *dirp);
struct dirent *readdir(DIR *dirp);
static const int DT_BLK, DT_CHR, DT_DIR, DT_FIFO, DT_LNK, DT_REG, DT_SOCK;
""")
ffi.set_source("_bsdopendirtype", """
#include <sys/types.h>
#include <dirent.h>
""")
if __name__ == '__main__':
ffi.compile()
|