home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / UUPC11XT.ZIP / RN / NDIR.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-11-21  |  1.6 KB  |  69 lines

  1. /* $Header: E:\SRC\UUPC\RN\RCS/NDIR.H 1.1 1992/11/21 06:14:58 ahd Exp $
  2.  *
  3.  * $Log: NDIR.H $
  4.  * Revision 1.1  1992/11/21  06:14:58  ahd
  5.  * Initial
  6.  *
  7.  *
  8.  *    Rev 1.0   18 Nov 1990  0:22:36
  9.  * Initial revision.
  10.  * Revision 4.3.2.1  90/04/17  15:28:13  sob
  11.  * Altered to include correct directory include file.
  12.  *
  13.  * Revision 4.3  85/05/01  11:43:00  lwall
  14.  * Baseline for release with 4.3bsd.
  15.  *
  16.  */
  17.  
  18. #ifdef LIBNDIR
  19. #   include <ndir.h>
  20. #else
  21. #   ifndef USENDIR
  22. #    include DIRINC
  23. #   else
  24.  
  25. #ifndef DEV_BSIZE
  26. #define    DEV_BSIZE    512
  27. #endif
  28. #define DIRBLKSIZ    DEV_BSIZE
  29. #define    MAXNAMLEN    255
  30.  
  31. struct    direct {
  32.     long    d_ino;            /* inode number of entry */
  33.     short    d_reclen;        /* length of this record */
  34.     short    d_namlen;        /* length of string in d_name */
  35.     char    d_name[MAXNAMLEN + 1];    /* name must be no longer than this */
  36. };
  37.  
  38. /*
  39.  * The DIRSIZ macro gives the minimum record length which will hold
  40.  * the directory entry.  This requires the amount of space in struct direct
  41.  * without the d_name field, plus enough space for the name with a terminating
  42.  * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
  43.  */
  44. #undef DIRSIZ
  45. #define DIRSIZ(dp) \
  46.     ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
  47.  
  48. /*
  49.  * Definitions for library routines operating on directories.
  50.  */
  51. typedef struct _dirdesc {
  52.     int    dd_fd;
  53.     long    dd_loc;
  54.     long    dd_size;
  55.     char    dd_buf[DIRBLKSIZ];
  56. } DIR;
  57. #ifndef NULL
  58. #define NULL 0
  59. #endif
  60. extern    DIR *opendir();
  61. extern    struct direct *readdir();
  62. extern    long telldir();
  63. extern    void seekdir();
  64. #define rewinddir(dirp)    seekdir((dirp), (long)0)
  65. extern    void closedir();
  66.  
  67. #   endif
  68. #endif
  69.