home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tcl2-73c.zip / tcl7.3 / compat / dirent2.h < prev    next >
C/C++ Source or Header  |  1993-03-19  |  2KB  |  74 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.  * All rights reserved.
  9.  *
  10.  * Permission is hereby granted, without written agreement and without
  11.  * license or royalty fees, to use, copy, modify, and distribute this
  12.  * software and its documentation for any purpose, provided that the
  13.  * above copyright notice and the following two paragraphs appear in
  14.  * all copies of this software.
  15.  * 
  16.  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  17.  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  18.  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  19.  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  20.  *
  21.  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  22.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  23.  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  24.  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  25.  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  26.  *
  27.  * $Header: /user6/ouster/tcl/compat/RCS/dirent2.h,v 1.2 93/03/19 15:25:09 ouster Exp $ SPRITE (Berkeley)
  28.  */
  29.  
  30. #ifndef _DIRENT
  31. #define _DIRENT
  32.  
  33. #ifndef _TCL
  34. #include <tcl.h>
  35. #endif
  36.  
  37. /*
  38.  * Dirent structure, which holds information about a single
  39.  * directory entry.
  40.  */
  41.  
  42. #define MAXNAMLEN 255
  43. #define DIRBLKSIZ 512
  44.  
  45. struct dirent {
  46.     long d_ino;            /* Inode number of entry */
  47.     short d_reclen;        /* Length of this record */
  48.     short d_namlen;        /* Length of string in d_name */
  49.     char d_name[MAXNAMLEN + 1];    /* Name must be no longer than this */
  50. };
  51.  
  52. /*
  53.  * State that keeps track of the reading of a directory (clients
  54.  * should never look inside this structure;  the fields should
  55.  * only be accessed by the library procedures).
  56.  */
  57.  
  58. typedef struct _dirdesc {
  59.     int dd_fd;
  60.     long dd_loc;
  61.     long dd_size;
  62.     char dd_buf[DIRBLKSIZ];
  63. } DIR;
  64.  
  65. /*
  66.  * Procedures defined for reading directories:
  67.  */
  68.  
  69. extern void        closedir _ANSI_ARGS_((DIR *dirp));
  70. extern DIR *        opendir _ANSI_ARGS_((char *name));
  71. extern struct dirent *    readdir _ANSI_ARGS_((DIR *dirp));
  72.  
  73. #endif /* _DIRENT */
  74.