home *** CD-ROM | disk | FTP | other *** search
/ Ultra Pack / UltraComputing Partner Applications.iso / SunLabs / tclTK / src / tcl7.4 / compat / dirent2.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-18  |  1.4 KB  |  60 lines

  1. /*
  2.  * dirent.h --
  3.  *
  4.  *    Declarations of a library of directory-reading procedures
  5.  *    in the POSIX style ("struct dirent").
  6.  *
  7.  * Copyright (c) 1991 The Regents of the University of California.
  8.  * Copyright (c) 1994 Sun Microsystems, Inc.
  9.  *
  10.  * See the file "license.terms" for information on usage and redistribution
  11.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12.  *
  13.  * @(#) dirent2.h 1.3 94/12/17 16:26:16
  14.  */
  15.  
  16. #ifndef _DIRENT
  17. #define _DIRENT
  18.  
  19. #ifndef _TCL
  20. #include <tcl.h>
  21. #endif
  22.  
  23. /*
  24.  * Dirent structure, which holds information about a single
  25.  * directory entry.
  26.  */
  27.  
  28. #define MAXNAMLEN 255
  29. #define DIRBLKSIZ 512
  30.  
  31. struct dirent {
  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.  * State that keeps track of the reading of a directory (clients
  40.  * should never look inside this structure;  the fields should
  41.  * only be accessed by the library procedures).
  42.  */
  43.  
  44. typedef struct _dirdesc {
  45.     int dd_fd;
  46.     long dd_loc;
  47.     long dd_size;
  48.     char dd_buf[DIRBLKSIZ];
  49. } DIR;
  50.  
  51. /*
  52.  * Procedures defined for reading directories:
  53.  */
  54.  
  55. extern void        closedir _ANSI_ARGS_((DIR *dirp));
  56. extern DIR *        opendir _ANSI_ARGS_((char *name));
  57. extern struct dirent *    readdir _ANSI_ARGS_((DIR *dirp));
  58.  
  59. #endif /* _DIRENT */
  60.