annotate src/sysdir.h @ 205:92f8ad5d0d3f r20-4b1

Import from CVS: tag r20-4b1
author cvs
date Mon, 13 Aug 2007 10:02:46 +0200
parents ac2d302a0011
children c5d627a313b1
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 #ifdef SYSV_SYSTEM_DIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 # include <dirent.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #elif defined (NONSYSTEM_DIR_LIBRARY)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 # include "ndir.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 #elif defined (MSDOS)
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 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 # include <sys/dir.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #endif /* not NONSYSTEM_DIR_LIBRARY */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #ifdef SYSV_SYSTEM_DIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 # define DIRENTRY struct dirent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #else /* not SYSV_SYSTEM_DIR */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 # define DIRENTRY struct direct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 /* The d_nameln member of a struct dirent includes the '\0' character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 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
41 at compile-time which one it will be, since it really depends on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 the sort of system providing the filesystem you're reading from,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 not the system you are running on. Paul Eggert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 <eggert@bi.twinsun.com> says this occurs when Emacs is running on a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 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
46 Solaris 2.1 host and is in a native Solaris 2.1 filesystem.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
48 (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
49 doesn't specify it -- mrb)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
50
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 Since applying strlen to the name always works, we'll just do that. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 #define NAMLEN(p) strlen (p->d_name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 #ifdef MSDOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 #define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 #define DIRENTRY_NONEMPTY(p) ((p)->d_ino)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 /* encapsulation: directory calls */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 #ifdef ENCAPSULATE_CHDIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 extern int sys_chdir (CONST char *path);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 #if defined (ENCAPSULATE_CHDIR) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 # undef chdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 # define chdir sys_chdir
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 # define sys_chdir chdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 #ifdef ENCAPSULATE_MKDIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 extern int sys_mkdir (CONST char *path, int mode);
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 #if defined (ENCAPSULATE_MKDIR) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 # undef mkdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 # define mkdir sys_mkdir
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 # define sys_mkdir mkdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 #ifdef ENCAPSULATE_OPENDIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 extern DIR *sys_opendir (CONST char *filename);
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 #if defined (ENCAPSULATE_OPENDIR) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 # undef opendir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 # define opendir sys_opendir
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 # define sys_opendir opendir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 #ifdef ENCAPSULATE_READDIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 extern DIRENTRY *sys_readdir (DIR *dirp);
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 #if defined (ENCAPSULATE_READDIR) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 # undef readdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 # define readdir sys_readdir
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 # define sys_readdir readdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 #ifdef ENCAPSULATE_CLOSEDIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 extern int sys_closedir (DIR *dirp);
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 #if defined (ENCAPSULATE_CLOSEDIR) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 # undef closedir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 # define closedir sys_closedir
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 # define sys_closedir closedir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 #ifdef ENCAPSULATE_RMDIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 extern int sys_rmdir (CONST char *path);
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 #if defined (ENCAPSULATE_RMDIR) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 # undef rmdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 # define rmdir sys_rmdir
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 # define sys_rmdir rmdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127