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