sl@0
|
1 |
/*
|
sl@0
|
2 |
* dirent.h --
|
sl@0
|
3 |
*
|
sl@0
|
4 |
* Declarations of a library of directory-reading procedures
|
sl@0
|
5 |
* in the POSIX style ("struct dirent").
|
sl@0
|
6 |
*
|
sl@0
|
7 |
* Copyright (c) 1991 The Regents of the University of California.
|
sl@0
|
8 |
* Copyright (c) 1994 Sun Microsystems, Inc.
|
sl@0
|
9 |
*
|
sl@0
|
10 |
* See the file "license.terms" for information on usage and redistribution
|
sl@0
|
11 |
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
sl@0
|
12 |
*
|
sl@0
|
13 |
* RCS: @(#) $Id: dirent2.h,v 1.2 1998/09/14 18:39:44 stanton Exp $
|
sl@0
|
14 |
*/
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef _DIRENT
|
sl@0
|
17 |
#define _DIRENT
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef _TCL
|
sl@0
|
20 |
#include "tcl.h"
|
sl@0
|
21 |
#endif
|
sl@0
|
22 |
|
sl@0
|
23 |
/*
|
sl@0
|
24 |
* Dirent structure, which holds information about a single
|
sl@0
|
25 |
* directory entry.
|
sl@0
|
26 |
*/
|
sl@0
|
27 |
|
sl@0
|
28 |
#define MAXNAMLEN 255
|
sl@0
|
29 |
#define DIRBLKSIZ 512
|
sl@0
|
30 |
|
sl@0
|
31 |
struct dirent {
|
sl@0
|
32 |
long d_ino; /* Inode number of entry */
|
sl@0
|
33 |
short d_reclen; /* Length of this record */
|
sl@0
|
34 |
short d_namlen; /* Length of string in d_name */
|
sl@0
|
35 |
char d_name[MAXNAMLEN + 1]; /* Name must be no longer than this */
|
sl@0
|
36 |
};
|
sl@0
|
37 |
|
sl@0
|
38 |
/*
|
sl@0
|
39 |
* State that keeps track of the reading of a directory (clients
|
sl@0
|
40 |
* should never look inside this structure; the fields should
|
sl@0
|
41 |
* only be accessed by the library procedures).
|
sl@0
|
42 |
*/
|
sl@0
|
43 |
|
sl@0
|
44 |
typedef struct _dirdesc {
|
sl@0
|
45 |
int dd_fd;
|
sl@0
|
46 |
long dd_loc;
|
sl@0
|
47 |
long dd_size;
|
sl@0
|
48 |
char dd_buf[DIRBLKSIZ];
|
sl@0
|
49 |
} DIR;
|
sl@0
|
50 |
|
sl@0
|
51 |
/*
|
sl@0
|
52 |
* Procedures defined for reading directories:
|
sl@0
|
53 |
*/
|
sl@0
|
54 |
|
sl@0
|
55 |
extern void closedir _ANSI_ARGS_((DIR *dirp));
|
sl@0
|
56 |
extern DIR * opendir _ANSI_ARGS_((char *name));
|
sl@0
|
57 |
extern struct dirent * readdir _ANSI_ARGS_((DIR *dirp));
|
sl@0
|
58 |
|
sl@0
|
59 |
#endif /* _DIRENT */
|