annotate src/sysdir.h @ 365:30d2cfa1092a r21-1-12

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