0
|
1 /* This file is part of XEmacs.
|
|
2
|
|
3 XEmacs is free software; you can redistribute it and/or modify it
|
|
4 under the terms of the GNU General Public License as published by the
|
|
5 Free Software Foundation; either version 2, or (at your option) any
|
|
6 later version.
|
|
7
|
|
8 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
9 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
10 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
11 for more details.
|
|
12
|
|
13 You should have received a copy of the GNU General Public License
|
|
14 along with XEmacs; see the file COPYING. If not, write to
|
|
15 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
16 Boston, MA 02111-1307, USA. */
|
|
17
|
|
18 /* Synched up with: FSF 19.30. */
|
|
19
|
|
20 /*
|
|
21 <dir.h> -- definitions for 4.2BSD-compatible directory access
|
|
22
|
|
23 last edit: 09-Jul-1983 D A Gwyn
|
|
24 */
|
|
25
|
|
26 #ifdef VMS
|
|
27 #ifndef FAB$C_BID
|
|
28 #include <fab.h>
|
|
29 #endif
|
|
30 #ifndef NAM$C_BID
|
|
31 #include <nam.h>
|
|
32 #endif
|
|
33 #ifndef RMS$_SUC
|
|
34 #include <rmsdef.h>
|
|
35 #endif
|
|
36 #include "vms-dir.h"
|
|
37 #endif /* VMS */
|
|
38
|
|
39 #define DIRBLKSIZ 512 /* size of directory block */
|
|
40 #ifdef VMS
|
|
41 #define MAXNAMLEN (DIR$S_NAME + 7) /* 80 plus room for version #. */
|
|
42 #define MAXFULLSPEC NAM$C_MAXRSS /* Maximum full spec */
|
|
43 #else
|
|
44 #ifdef WINDOWSNT
|
|
45 #define MAXNAMLEN 255
|
|
46 #else /* not WINDOWSNT */
|
|
47 #define MAXNAMLEN 15 /* maximum filename length */
|
|
48 #endif /* not WINDOWSNT */
|
|
49 #endif /* VMS */
|
|
50 /* NOTE: MAXNAMLEN must be one less than a multiple of 4 */
|
|
51
|
|
52 struct direct /* data from readdir() */
|
|
53 {
|
|
54 long d_ino; /* inode number of entry */
|
|
55 unsigned short d_reclen; /* length of this record */
|
|
56 unsigned short d_namlen; /* length of string in d_name */
|
|
57 char d_name[MAXNAMLEN+1]; /* name of file */
|
|
58 };
|
|
59
|
|
60 typedef struct
|
|
61 {
|
|
62 int dd_fd; /* file descriptor */
|
|
63 int dd_loc; /* offset in block */
|
|
64 int dd_size; /* amount of valid data */
|
|
65 char dd_buf[DIRBLKSIZ]; /* directory block */
|
|
66 } DIR; /* stream data from opendir() */
|
|
67
|
|
68 extern DIR *opendir (CONST char *filename)
|
|
69 extern int closedir (DIR *dirp);
|
|
70 extern struct direct *readdir (DIR *dirp);
|
|
71 extern struct direct *readdirver (DIR *dirp);
|
|
72 extern long telldir (DIR *dirp);
|
|
73 extern void seekdir (DIR *dirp, long loc);
|
|
74
|
|
75 #define rewinddir( dirp ) seekdir( dirp, 0L )
|