home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / xpaint-247 / sys_dirent.h < prev    next >
C/C++ Source or Header  |  1992-04-29  |  2KB  |  44 lines

  1. /*    @(#)dirent.h 1.4 89/06/16 SMI     */
  2.  
  3. /*
  4.  * Filesystem-independent directory information.
  5.  * Directory entry structures are of variable length.
  6.  * Each directory entry is a struct dirent containing its file number, the
  7.  * offset of the next entry (a cookie interpretable only the filesystem
  8.  * type that generated it), the length of the entry, and the length of the
  9.  * name contained in the entry.  These are followed by the name. The
  10.  * entire entry is padded with null bytes to a 4 byte boundary. All names
  11.  * are guaranteed null terminated. The maximum length of a name in a
  12.  * directory is MAXNAMLEN, plus a null byte.
  13.  */
  14.  
  15. #ifndef    __sys_dirent_h
  16. #define    __sys_dirent_h
  17.  
  18. struct    dirent {
  19.     long        d_off;        /* offset of next disk dir entry */
  20.     unsigned long    d_fileno;    /* file number of entry */
  21.     unsigned short    d_reclen;    /* length of this record */
  22.     unsigned short    d_namlen;    /* length of string in d_name */
  23.     char        d_name[255+1];    /* name (up to MAXNAMLEN + 1) */
  24. };
  25.  
  26. #ifndef    _POSIX_SOURCE
  27. /*
  28.  * It's unlikely to change, but make sure that sizeof d_name above is
  29.  * at least MAXNAMLEN + 1 (more may be added for padding).
  30.  */
  31. #define    MAXNAMLEN    255
  32. /*
  33.  * The macro DIRSIZ(dp) gives the minimum amount of space required to represent
  34.  * a directory entry.  For any directory entry dp->d_reclen >= DIRSIZ(dp).
  35.  * Specific filesystem types may use this macro to construct the value
  36.  * for d_reclen.
  37.  */
  38. #undef    DIRSIZ
  39. #define    DIRSIZ(dp) \
  40.     (((sizeof(struct dirent) - (MAXNAMLEN+1) + ((dp)->d_namlen+1)) +3) & ~3)
  41.  
  42. #endif    /* !_POSIX_SOURCE */
  43. #endif    /* !__sys_dirent_h */
  44.