| Rev | Line | |
|---|
| [25] | 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 | * RCS: @(#) $Id: dirent2.h,v 1.2 1998/09/14 18:39:44 stanton Exp $ |
|---|
| 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 */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.