2 Copyright (C) 1995 Free Software Foundation, Inc.
4 This file is part of SXEmacs
6 SXEmacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 SXEmacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* Synched up with: Not really in FSF. */
22 #ifndef INCLUDED_sysdir_h_
23 #define INCLUDED_sysdir_h_
29 #ifdef SYSV_SYSTEM_DIR
31 #elif defined (NONSYSTEM_DIR_LIBRARY)
35 #endif /* not NONSYSTEM_DIR_LIBRARY */
37 #ifdef SYSV_SYSTEM_DIR
38 # define DIRENTRY struct dirent
39 #else /* not SYSV_SYSTEM_DIR */
40 # define DIRENTRY struct direct
43 /* The d_nameln member of a struct dirent includes the '\0' character
44 on some systems, but not on others. What's worse, you can't tell
45 at compile-time which one it will be, since it really depends on
46 the sort of system providing the filesystem you're reading from,
47 not the system you are running on. Paul Eggert
48 <eggert@bi.twinsun.com> says this occurs when Emacs is running on a
49 SunOS 4.1.2 host, reading a directory that is remote-mounted from a
50 Solaris 2.1 host and is in a native Solaris 2.1 filesystem.
52 (and Solaris 2 doesn't have a d_nameln member at all! Posix.1
53 doesn't specify it -- mrb)
55 Since applying strlen to the name always works, we'll just do that. */
56 #define NAMLEN(p) strlen (p->d_name)
58 #define DIRENTRY_NONEMPTY(p) ((p)->d_ino)
60 /* encapsulation: directory calls */
62 #ifdef ENCAPSULATE_CHDIR
63 int sys_chdir(const char *path);
65 #if defined (ENCAPSULATE_CHDIR) && !defined (DONT_ENCAPSULATE)
67 # define chdir sys_chdir
69 #if !defined (ENCAPSULATE_CHDIR) && defined (DONT_ENCAPSULATE)
70 # define sys_chdir chdir
73 #ifdef ENCAPSULATE_MKDIR
74 int sys_mkdir(const char *path, mode_t mode);
76 #if defined (ENCAPSULATE_MKDIR) && !defined (DONT_ENCAPSULATE)
78 # define mkdir sys_mkdir
80 #if !defined (ENCAPSULATE_MKDIR) && defined (DONT_ENCAPSULATE)
81 # define sys_mkdir mkdir
84 #ifdef ENCAPSULATE_OPENDIR
85 DIR *sys_opendir(const char *filename);
87 #if defined (ENCAPSULATE_OPENDIR) && !defined (DONT_ENCAPSULATE)
89 # define opendir sys_opendir
91 #if !defined (ENCAPSULATE_OPENDIR) && defined (DONT_ENCAPSULATE)
92 # define sys_opendir opendir
95 #ifdef ENCAPSULATE_READDIR
96 DIRENTRY *sys_readdir(DIR * dirp);
98 #if defined (ENCAPSULATE_READDIR) && !defined (DONT_ENCAPSULATE)
100 # define readdir sys_readdir
102 #if !defined (ENCAPSULATE_READDIR) && defined (DONT_ENCAPSULATE)
103 # define sys_readdir readdir
106 #ifdef ENCAPSULATE_CLOSEDIR
107 int sys_closedir(DIR * dirp);
109 #if defined (ENCAPSULATE_CLOSEDIR) && !defined (DONT_ENCAPSULATE)
111 # define closedir sys_closedir
113 #if !defined (ENCAPSULATE_CLOSEDIR) && defined (DONT_ENCAPSULATE)
114 # define sys_closedir closedir
117 #ifdef ENCAPSULATE_RMDIR
118 int sys_rmdir(const char *path);
120 #if defined (ENCAPSULATE_RMDIR) && !defined (DONT_ENCAPSULATE)
122 # define rmdir sys_rmdir
124 #if !defined (ENCAPSULATE_RMDIR) && defined (DONT_ENCAPSULATE)
125 # define sys_rmdir rmdir
128 #endif /* INCLUDED_sysdir_h_ */