0
|
1 /*
|
|
2 Copyright (C) 1995 Free Software Foundation, Inc.
|
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 /* Synched up with: Not really in FSF. */
|
|
22
|
398
|
23 #ifndef INCLUDED_sysdir_h_
|
|
24 #define INCLUDED_sysdir_h_
|
|
25
|
272
|
26 #ifdef HAVE_UNISTD_H
|
|
27 #include <unistd.h>
|
|
28 #endif
|
|
29
|
0
|
30 #ifdef SYSV_SYSTEM_DIR
|
|
31 # include <dirent.h>
|
|
32 #elif defined (NONSYSTEM_DIR_LIBRARY)
|
|
33 # include "ndir.h"
|
|
34 #elif defined (MSDOS)
|
|
35 # include <dirent.h>
|
|
36 #else
|
|
37 # include <sys/dir.h>
|
|
38 #endif /* not NONSYSTEM_DIR_LIBRARY */
|
|
39
|
|
40 #ifdef SYSV_SYSTEM_DIR
|
|
41 # define DIRENTRY struct dirent
|
|
42 #else /* not SYSV_SYSTEM_DIR */
|
|
43 # define DIRENTRY struct direct
|
|
44 #endif
|
|
45
|
|
46 /* The d_nameln member of a struct dirent includes the '\0' character
|
|
47 on some systems, but not on others. What's worse, you can't tell
|
|
48 at compile-time which one it will be, since it really depends on
|
|
49 the sort of system providing the filesystem you're reading from,
|
|
50 not the system you are running on. Paul Eggert
|
|
51 <eggert@bi.twinsun.com> says this occurs when Emacs is running on a
|
|
52 SunOS 4.1.2 host, reading a directory that is remote-mounted from a
|
|
53 Solaris 2.1 host and is in a native Solaris 2.1 filesystem.
|
|
54
|
2
|
55 (and Solaris 2 doesn't have a d_nameln member at all! Posix.1
|
|
56 doesn't specify it -- mrb)
|
|
57
|
0
|
58 Since applying strlen to the name always works, we'll just do that. */
|
|
59 #define NAMLEN(p) strlen (p->d_name)
|
|
60
|
|
61 #ifdef MSDOS
|
|
62 #define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0)
|
|
63 #else
|
|
64 #define DIRENTRY_NONEMPTY(p) ((p)->d_ino)
|
|
65 #endif
|
|
66
|
|
67 /* encapsulation: directory calls */
|
|
68
|
|
69 #ifdef ENCAPSULATE_CHDIR
|
398
|
70 int sys_chdir (const char *path);
|
0
|
71 #endif
|
|
72 #if defined (ENCAPSULATE_CHDIR) && !defined (DONT_ENCAPSULATE)
|
|
73 # undef chdir
|
|
74 # define chdir sys_chdir
|
|
75 #endif
|
|
76 #if !defined (ENCAPSULATE_CHDIR) && defined (DONT_ENCAPSULATE)
|
|
77 # define sys_chdir chdir
|
|
78 #endif
|
|
79
|
|
80 #ifdef ENCAPSULATE_MKDIR
|
398
|
81 int sys_mkdir (const char *path, mode_t mode);
|
0
|
82 #endif
|
|
83 #if defined (ENCAPSULATE_MKDIR) && !defined (DONT_ENCAPSULATE)
|
|
84 # undef mkdir
|
|
85 # define mkdir sys_mkdir
|
|
86 #endif
|
|
87 #if !defined (ENCAPSULATE_MKDIR) && defined (DONT_ENCAPSULATE)
|
|
88 # define sys_mkdir mkdir
|
|
89 #endif
|
|
90
|
|
91 #ifdef ENCAPSULATE_OPENDIR
|
398
|
92 DIR *sys_opendir (const char *filename);
|
0
|
93 #endif
|
|
94 #if defined (ENCAPSULATE_OPENDIR) && !defined (DONT_ENCAPSULATE)
|
|
95 # undef opendir
|
|
96 # define opendir sys_opendir
|
|
97 #endif
|
|
98 #if !defined (ENCAPSULATE_OPENDIR) && defined (DONT_ENCAPSULATE)
|
|
99 # define sys_opendir opendir
|
|
100 #endif
|
|
101
|
|
102 #ifdef ENCAPSULATE_READDIR
|
272
|
103 DIRENTRY *sys_readdir (DIR *dirp);
|
0
|
104 #endif
|
|
105 #if defined (ENCAPSULATE_READDIR) && !defined (DONT_ENCAPSULATE)
|
|
106 # undef readdir
|
|
107 # define readdir sys_readdir
|
|
108 #endif
|
|
109 #if !defined (ENCAPSULATE_READDIR) && defined (DONT_ENCAPSULATE)
|
|
110 # define sys_readdir readdir
|
|
111 #endif
|
|
112
|
|
113 #ifdef ENCAPSULATE_CLOSEDIR
|
272
|
114 int sys_closedir (DIR *dirp);
|
0
|
115 #endif
|
|
116 #if defined (ENCAPSULATE_CLOSEDIR) && !defined (DONT_ENCAPSULATE)
|
|
117 # undef closedir
|
|
118 # define closedir sys_closedir
|
|
119 #endif
|
|
120 #if !defined (ENCAPSULATE_CLOSEDIR) && defined (DONT_ENCAPSULATE)
|
|
121 # define sys_closedir closedir
|
|
122 #endif
|
|
123
|
|
124 #ifdef ENCAPSULATE_RMDIR
|
398
|
125 int sys_rmdir (const char *path);
|
0
|
126 #endif
|
|
127 #if defined (ENCAPSULATE_RMDIR) && !defined (DONT_ENCAPSULATE)
|
|
128 # undef rmdir
|
|
129 # define rmdir sys_rmdir
|
|
130 #endif
|
|
131 #if !defined (ENCAPSULATE_RMDIR) && defined (DONT_ENCAPSULATE)
|
|
132 # define sys_rmdir rmdir
|
|
133 #endif
|
|
134
|
398
|
135 #endif /* INCLUDED_sysdir_h_ */
|