home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 25.ddi / root.2 / usr / ucbinclude / sys / dir.h next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  3.0 KB  |  108 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10.  
  11. #ident    "@(#)//usr/ucbinclude/sys/dir.h.sl 1.1 4.0 12/08/90 21226 AT&T-USL"
  12.  
  13. /*******************************************************************
  14.  
  15.         PROPRIETARY NOTICE (Combined)
  16.  
  17. This source code is unpublished proprietary information
  18. constituting, or derived under license from AT&T's UNIX(r) System V.
  19. In addition, portions of such source code were derived from Berkeley
  20. 4.3 BSD under license from the Regents of the University of
  21. California.
  22.  
  23.  
  24.  
  25.         Copyright Notice 
  26.  
  27. Notice of copyright on this source code product does not indicate 
  28. publication.
  29.  
  30.     (c) 1986,1987,1988,1989  Sun Microsystems, Inc
  31.     (c) 1983,1984,1985,1986,1987,1988,1989  AT&T.
  32.               All rights reserved.
  33. ********************************************************************/ 
  34.  
  35. /*
  36.  * This header file provides BSD compatibility for DIR and direct structures.
  37.  * The fields in the BSD DIR structure are identical to to the SVR4 DIR
  38.  * structure, except for the fact that the dd_buf field in SVR4 is not
  39.  * statically allocated. 
  40.  * The BSD direct structure is similar (not identical) to the dirent
  41.  * structure. All fields of the direct structure can be obtained using
  42.  * the information provided by dirent.
  43.  * All routines manipulating DIR structures are compatible, only readdir
  44.  * is not. The BSD version of this routine returns a direct structure. 
  45.  */
  46. #if !defined(KERNEL) && !defined (DEV_BSIZE)
  47. #define    DEV_BSIZE    512
  48. #endif
  49. #define DIRBUF        1048
  50. #define DIRBLKSIZ    DIRBUF
  51. #define    MAXNAMLEN    255
  52.  
  53. struct    direct {
  54.     u_long    d_ino;            /* inode number of entry */
  55.     u_short    d_reclen;        /* length of this record */
  56.     u_short    d_namlen;        /* length of string in d_name */
  57.     char    *d_name;        /* name of entry */
  58. };
  59.  
  60.  
  61. /*
  62.  * The macro DIRSIZ(dp) gives an amount of space required to represent
  63.  * a directory entry. 
  64.  */
  65. #undef DIRSIZ
  66. #define DIRSIZ(dp)  \
  67.         ((sizeof (struct direct) - sizeof ((dp)->d_name) + \
  68.         (strlen((dp)->d_name)+1) + 3) & ~3)
  69.  
  70.  
  71. #ifndef KERNEL
  72. /*
  73.  * Definitions for library routines operating on directories.
  74.  */
  75. typedef struct _dirdesc {
  76.     int    dd_fd;
  77.     long    dd_loc;
  78.     long    dd_size;
  79.     char    *dd_buf;
  80. } DIR;
  81.  
  82. #ifndef NULL
  83. #define NULL 0
  84. #endif
  85. #if defined(__STDC__)
  86.  
  87. extern DIR              *opendir( const char * );
  88. extern struct direct    *readdir( DIR * );
  89. extern long             telldir( DIR * );
  90. extern void             seekdir( DIR *, long );
  91. extern void             rewinddir( DIR * );
  92. extern int              closedir( DIR * );
  93.  
  94. #else
  95.  
  96. extern    DIR *opendir();
  97. extern    struct direct *readdir();
  98. extern    long telldir();
  99. extern    void seekdir();
  100. extern  void rewinddir();
  101. extern    void closedir();
  102.  
  103. #endif
  104.  
  105. #define rewinddir(dirp)    seekdir((dirp), (long)0)
  106.  
  107. #endif
  108.