home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / com / utils / trn / src / ndir.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-14  |  2.1 KB  |  78 lines

  1. /*
  2.  * This file was produced by running the ndir.h.SH script, which
  3.  * gets its values from config.sh, which is generally produced by
  4.  * running Configure.
  5.  */
  6. /* $Id: ndir.h.SH,v 4.4 1991/09/09 20:23:31 sob Exp sob $
  7.  *
  8.  * $Log: ndir.h.SH,v $
  9. # Revision 4.4  1991/09/09  20:23:31  sob
  10. # release 4.4
  11. #
  12.  *
  13.  * 
  14.  */
  15. /* This software is Copyright 1991 by Stan Barber. 
  16.  *
  17.  * Permission is hereby granted to copy, reproduce, redistribute or otherwise
  18.  * use this software as long as: there is no monetary profit gained
  19.  * specifically from the use or reproduction of this software, it is not
  20.  * sold, rented, traded or otherwise marketed, and this copyright notice is
  21.  * included prominently in any copy made. 
  22.  *
  23.  * The author make no claims as to the fitness or correctness of this software
  24.  * for any use whatsoever, and it is provided as is. Any use of this software
  25.  * is at the user's own risk. 
  26.  */
  27.  
  28. #ifdef LIBNDIR
  29. #   include <ndir.h>
  30. #else
  31. #   ifndef USENDIR
  32. #    include <dirent.h>
  33. #   else
  34.  
  35. #ifndef DEV_BSIZE
  36. #define    DEV_BSIZE    512
  37. #endif
  38. #define DIRBLKSIZ    DEV_BSIZE
  39. #define    MAXNAMLEN    255
  40.  
  41. struct    direct {
  42.     long    d_ino;            /* inode number of entry */
  43.     short    d_reclen;        /* length of this record */
  44.     short    d_namlen;        /* length of string in d_name */
  45.     char    d_name[MAXNAMLEN + 1];    /* name must be no longer than this */
  46. };
  47.  
  48. /*
  49.  * The DIRSIZ macro gives the minimum record length which will hold
  50.  * the directory entry.  This requires the amount of space in struct direct
  51.  * without the d_name field, plus enough space for the name with a terminating
  52.  * null byte (dp->d_namlen+1), rounded up to a 4 byte boundary.
  53.  */
  54. #undef DIRSIZ
  55. #define DIRSIZ(dp)     ((sizeof (struct direct) - (MAXNAMLEN+1)) + (((dp)->d_namlen+1 + 3) &~ 3))
  56.  
  57. /*
  58.  * Definitions for library routines operating on directories.
  59.  */
  60. typedef struct _dirdesc {
  61.     int    dd_fd;
  62.     long    dd_loc;
  63.     long    dd_size;
  64.     char    dd_buf[DIRBLKSIZ];
  65. } DIR;
  66. #ifndef NULL
  67. #define NULL 0
  68. #endif
  69. extern    DIR *opendir ANSI((char *));
  70. extern    struct direct *readdir ANSI((DIR *));
  71. extern    long telldir ANSI((DIR *));
  72. extern    void seekdir ANSI((DIR *));
  73. #define rewinddir(dirp)    seekdir((dirp), (long)0)
  74. extern    void closedir ANSI((DIR *));
  75.  
  76. #   endif
  77. #endif
  78.