annotate src/sysdir.h @ 398:74fd4e045ea6 r21-2-29

Import from CVS: tag r21-2-29
author cvs
date Mon, 13 Aug 2007 11:13:30 +0200
parents c5d627a313b1
children de805c49cfc1
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
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 272
diff changeset
23 #ifndef INCLUDED_sysdir_h_
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 272
diff changeset
24 #define INCLUDED_sysdir_h_
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 272
diff changeset
25
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 2
diff changeset
26 #ifdef HAVE_UNISTD_H
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 2
diff changeset
27 #include <unistd.h>
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 2
diff changeset
28 #endif
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 2
diff changeset
29
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #ifdef SYSV_SYSTEM_DIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 # include <dirent.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #elif defined (NONSYSTEM_DIR_LIBRARY)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 # include "ndir.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #elif defined (MSDOS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 # include <dirent.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 # include <sys/dir.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #endif /* not NONSYSTEM_DIR_LIBRARY */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 #ifdef SYSV_SYSTEM_DIR
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 # define DIRENTRY struct dirent
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #else /* not SYSV_SYSTEM_DIR */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 # define DIRENTRY struct direct
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 /* The d_nameln member of a struct dirent includes the '\0' character
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 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
48 at compile-time which one it will be, since it really depends on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 the sort of system providing the filesystem you're reading from,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 not the system you are running on. Paul Eggert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 <eggert@bi.twinsun.com> says this occurs when Emacs is running on a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 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
53 Solaris 2.1 host and is in a native Solaris 2.1 filesystem.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
55 (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
56 doesn't specify it -- mrb)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
57
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 Since applying strlen to the name always works, we'll just do that. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 #define NAMLEN(p) strlen (p->d_name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 #ifdef MSDOS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 #define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 #define DIRENTRY_NONEMPTY(p) ((p)->d_ino)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 /* encapsulation: directory calls */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 #ifdef ENCAPSULATE_CHDIR
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 272
diff changeset
70 int sys_chdir (const char *path);
0
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 #if defined (ENCAPSULATE_CHDIR) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 # undef chdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 # define chdir sys_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 #if !defined (ENCAPSULATE_CHDIR) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 # define sys_chdir chdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 #ifdef ENCAPSULATE_MKDIR
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 272
diff changeset
81 int sys_mkdir (const char *path, mode_t mode);
0
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 #if defined (ENCAPSULATE_MKDIR) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 # undef mkdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 # define mkdir sys_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 #if !defined (ENCAPSULATE_MKDIR) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 # define sys_mkdir mkdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 #ifdef ENCAPSULATE_OPENDIR
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 272
diff changeset
92 DIR *sys_opendir (const char *filename);
0
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 #if defined (ENCAPSULATE_OPENDIR) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 # undef opendir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 # define opendir sys_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 #if !defined (ENCAPSULATE_OPENDIR) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 # define sys_opendir opendir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 #ifdef ENCAPSULATE_READDIR
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 2
diff changeset
103 DIRENTRY *sys_readdir (DIR *dirp);
0
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 #if defined (ENCAPSULATE_READDIR) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 # undef readdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 # define readdir sys_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 #if !defined (ENCAPSULATE_READDIR) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 # define sys_readdir readdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 #ifdef ENCAPSULATE_CLOSEDIR
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 2
diff changeset
114 int sys_closedir (DIR *dirp);
0
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 #if defined (ENCAPSULATE_CLOSEDIR) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 # undef closedir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 # define closedir sys_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 #if !defined (ENCAPSULATE_CLOSEDIR) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 # define sys_closedir closedir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 #ifdef ENCAPSULATE_RMDIR
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 272
diff changeset
125 int sys_rmdir (const char *path);
0
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 #if defined (ENCAPSULATE_RMDIR) && !defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 # undef rmdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 # define rmdir sys_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 #if !defined (ENCAPSULATE_RMDIR) && defined (DONT_ENCAPSULATE)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 # define sys_rmdir rmdir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
398
74fd4e045ea6 Import from CVS: tag r21-2-29
cvs
parents: 272
diff changeset
135 #endif /* INCLUDED_sysdir_h_ */