home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / TELECOM / rn_4_3_blars.lzh / ndir.h < prev    next >
Text File  |  1990-08-24  |  2KB  |  66 lines

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