]> git.sur5r.net Git - openldap/blob - include/ac/dirent.h
Happy New Year!
[openldap] / include / ac / dirent.h
1 /* Generic dirent.h */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 1998-2016 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16
17 #ifndef _AC_DIRENT_H
18 #define _AC_DIRENT_H
19
20 #ifdef HAVE_DIRENT_H
21 # include <dirent.h>
22 # define NAMLEN(dirent) strlen((dirent)->d_name)
23 #elif defined(_MSC_VER)
24 #include <windows.h>
25 #ifndef MAX_PATH
26 #define MAX_PATH        260
27 #endif
28 struct dirent {
29         char *d_name;
30 };
31 typedef struct DIR {
32         HANDLE dir;
33         struct dirent data;
34         int first;
35         char buf[MAX_PATH+1];
36 } DIR;
37 DIR *opendir(const char *name);
38 struct dirent *readdir(DIR *dir);
39 int closedir(DIR *dir);
40 #else
41 # define dirent direct
42 # define NAMLEN(dirent) (dirent)->d_namlen
43 # ifdef HAVE_SYS_NDIR_H
44 #  include <sys/ndir.h>
45 # endif
46 # ifdef HAVE_SYS_DIR_H
47 #  include <sys/dir.h>
48 # endif
49 # ifdef HAVE_NDIR_H
50 #  include <ndir.h>
51 # endif
52 #endif
53
54 #endif /* _AC_DIRENT_H */