Back to index

openldap  2.4.31
dirent.h
Go to the documentation of this file.
00001 /* Generic dirent.h */
00002 /* $OpenLDAP$ */
00003 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00004  *
00005  * Copyright 1998-2012 The OpenLDAP Foundation.
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted only as authorized by the OpenLDAP
00010  * Public License.
00011  *
00012  * A copy of this license is available in file LICENSE in the
00013  * top-level directory of the distribution or, alternatively, at
00014  * <http://www.OpenLDAP.org/license.html>.
00015  */
00016 
00017 #ifndef _AC_DIRENT_H
00018 #define _AC_DIRENT_H
00019 
00020 #ifdef HAVE_DIRENT_H
00021 # include <dirent.h>
00022 # define NAMLEN(dirent) strlen((dirent)->d_name)
00023 #elif defined(_MSC_VER)
00024 #include <windows.h>
00025 #ifndef MAX_PATH
00026 #define MAX_PATH     260
00027 #endif
00028 struct dirent {
00029        char *d_name;
00030 };
00031 typedef struct DIR {
00032        HANDLE dir;
00033        struct dirent data;
00034        int first;
00035        char buf[MAX_PATH+1];
00036 } DIR;
00037 DIR *opendir(const char *name);
00038 struct dirent *readdir(DIR *dir);
00039 int closedir(DIR *dir);
00040 #else
00041 # define dirent direct
00042 # define NAMLEN(dirent) (dirent)->d_namlen
00043 # ifdef HAVE_SYS_NDIR_H
00044 #  include <sys/ndir.h>
00045 # endif
00046 # ifdef HAVE_SYS_DIR_H
00047 #  include <sys/dir.h>
00048 # endif
00049 # ifdef HAVE_NDIR_H
00050 #  include <ndir.h>
00051 # endif
00052 #endif
00053 
00054 #endif /* _AC_DIRENT_H */