/* header file for POSIX directory access routines */ #ifndef _DIRENT_H #define _DIRENT_H #ifndef _COMPILER_H #include #endif #ifndef _TYPES_H #include #endif #ifndef NAME_MAX #include #endif struct dirent { long d_ino; /* garbage under TOS */ off_t d_off; /* position in directory */ short d_reclen; /* for us, length of d_name */ char d_name[NAME_MAX+1]; }; typedef struct _DIR { short status; /* status of the search so far: */ #define _INSEARCH 0 /* need to call Fsnext for a new entry */ #define _STARTSEARCH 1 /* Fsfirst called once, successfully */ #define _NMFILE 2 /* no more files in directory */ char dta[44]; /* TOS DTA for this directory */ char *dirname; /* directory of the search (used under TOS for rewinddir) */ struct dirent buf; /* dirent struct for this directory */ } DIR; #define DIRENTSIZ(x) (sizeof(struct dirent) + (x) + 1) /* allow BSD emulation via sys/dir.h */ #ifdef _SYS_DIR_H #define direct dirent #define d_fileno d_ino #define d_namlen d_reclen #define DIRSIZ(dp) DIRENTSIZ((dp)->d_namlen) #define MAXNAMLEN NAME_MAX #endif __EXTERN DIR * opendir __PROTO((const char *dirname)); __EXTERN struct dirent *readdir __PROTO((DIR *dirp)); __EXTERN off_t telldir __PROTO((DIR *dirp)); __EXTERN void seekdir __PROTO((DIR *dirp, off_t loc)); __EXTERN void rewinddir __PROTO((DIR *dirp)); __EXTERN int closedir __PROTO((DIR *dirp)); #endif /* _DIRENT_H */