andre@3: #ifndef __DIRENT_H__ andre@3: #define __DIRENT_H__ andre@3: /* andre@3: * @(#)msd_dir.h 1.4 87/11/06 Public Domain. andre@3: * andre@3: * A public domain implementation of BSD directory routines for andre@3: * MS-DOS. Written by Michael Rendell ({uunet,utai}michael@garfield), andre@3: * August 1897 andre@3: * andre@3: * Extended by Peter Lim (lim@mullian.oz) to overcome some MS DOS quirks andre@3: * and returns 2 more pieces of information - file size & attribute. andre@3: * Plus a little reshuffling of some #define's positions December 1987 andre@3: * andre@3: * Some modifications by Martin Junius 02-14-89 andre@3: * andre@3: * AK900712 andre@3: * AK910410 abs_path - make absolute path andre@3: * andre@3: */ andre@3: andre@3: #ifdef __EMX__ andre@3: #include andre@3: #else andre@3: #if defined(__IBMC__) || defined(__IBMCPP__) || defined(XP_W32_MSVC) andre@3: #include andre@3: #ifdef MAXPATHLEN andre@3: #undef MAXPATHLEN andre@3: #endif andre@3: #define MAXPATHLEN (FILENAME_MAX*4) andre@3: #define MAXNAMLEN FILENAME_MAX andre@3: andre@3: #else andre@3: #include andre@3: #endif andre@3: #endif andre@3: andre@3: #ifdef __cplusplus andre@3: extern "C" { andre@3: #endif andre@3: andre@3: /* attribute stuff */ andre@3: #ifndef A_RONLY andre@3: # define A_RONLY 0x01 andre@3: # define A_HIDDEN 0x02 andre@3: # define A_SYSTEM 0x04 andre@3: # define A_LABEL 0x08 andre@3: # define A_DIR 0x10 andre@3: # define A_ARCHIVE 0x20 andre@3: #endif andre@3: andre@3: struct dirent { andre@3: #if defined(OS2) || defined(WIN32) /* use the layout of EMX to avoid trouble */ andre@3: int d_ino; /* Dummy */ andre@3: int d_reclen; /* Dummy, same as d_namlen */ andre@3: int d_namlen; /* length of name */ andre@3: char d_name[MAXNAMLEN + 1]; andre@3: unsigned long d_size; andre@3: unsigned short d_attribute; /* attributes (see above) */ andre@3: unsigned short d_time; /* modification time */ andre@3: unsigned short d_date; /* modification date */ andre@3: #else andre@3: char d_name[MAXNAMLEN + 1]; /* garentee null termination */ andre@3: char d_attribute; /* .. extension .. */ andre@3: unsigned long d_size; /* .. extension .. */ andre@3: #endif andre@3: }; andre@3: andre@3: typedef struct _dirdescr DIR; andre@3: /* the structs do not have to be defined here */ andre@3: andre@3: extern DIR *opendir(const char *); andre@3: extern DIR *openxdir(const char *, unsigned); andre@3: extern struct dirent *readdir(DIR *); andre@3: extern void seekdir(DIR *, long); andre@3: extern long telldir(DIR *); andre@3: extern void closedir(DIR *); andre@3: #define rewinddir(dirp) seekdir(dirp, 0L) andre@3: andre@3: extern char * abs_path(const char *name, char *buffer, int len); andre@3: andre@3: #ifndef S_IFMT andre@3: #define S_IFMT ( S_IFDIR | S_IFREG ) andre@3: #endif andre@3: andre@3: #ifndef S_ISDIR andre@3: #define S_ISDIR( m ) (((m) & S_IFMT) == S_IFDIR) andre@3: #endif andre@3: andre@3: #ifndef S_ISREG andre@3: #define S_ISREG( m ) (((m) & S_IFMT) == S_IFREG) andre@3: #endif andre@3: andre@3: #ifdef __cplusplus andre@3: } andre@3: #endif andre@3: andre@3: #endif