Mercurial > hg > xemacs-beta
comparison src/sysdir.h @ 428:3ecd8885ac67 r21-2-22
Import from CVS: tag r21-2-22
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:28:15 +0200 |
parents | |
children | 3a7e78e1142d |
comparison
equal
deleted
inserted
replaced
427:0a0253eac470 | 428:3ecd8885ac67 |
---|---|
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 | |
23 #ifdef HAVE_UNISTD_H | |
24 #include <unistd.h> | |
25 #endif | |
26 | |
27 #ifdef SYSV_SYSTEM_DIR | |
28 # include <dirent.h> | |
29 #elif defined (NONSYSTEM_DIR_LIBRARY) | |
30 # include "ndir.h" | |
31 #elif defined (MSDOS) | |
32 # include <dirent.h> | |
33 #else | |
34 # include <sys/dir.h> | |
35 #endif /* not NONSYSTEM_DIR_LIBRARY */ | |
36 | |
37 #ifdef SYSV_SYSTEM_DIR | |
38 # define DIRENTRY struct dirent | |
39 #else /* not SYSV_SYSTEM_DIR */ | |
40 # define DIRENTRY struct direct | |
41 #endif | |
42 | |
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. | |
51 | |
52 (and Solaris 2 doesn't have a d_nameln member at all! Posix.1 | |
53 doesn't specify it -- mrb) | |
54 | |
55 Since applying strlen to the name always works, we'll just do that. */ | |
56 #define NAMLEN(p) strlen (p->d_name) | |
57 | |
58 #ifdef MSDOS | |
59 #define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0) | |
60 #else | |
61 #define DIRENTRY_NONEMPTY(p) ((p)->d_ino) | |
62 #endif | |
63 | |
64 /* encapsulation: directory calls */ | |
65 | |
66 #ifdef ENCAPSULATE_CHDIR | |
67 int sys_chdir (CONST char *path); | |
68 #endif | |
69 #if defined (ENCAPSULATE_CHDIR) && !defined (DONT_ENCAPSULATE) | |
70 # undef chdir | |
71 # define chdir sys_chdir | |
72 #endif | |
73 #if !defined (ENCAPSULATE_CHDIR) && defined (DONT_ENCAPSULATE) | |
74 # define sys_chdir chdir | |
75 #endif | |
76 | |
77 #ifdef ENCAPSULATE_MKDIR | |
78 int sys_mkdir (CONST char *path, mode_t mode); | |
79 #endif | |
80 #if defined (ENCAPSULATE_MKDIR) && !defined (DONT_ENCAPSULATE) | |
81 # undef mkdir | |
82 # define mkdir sys_mkdir | |
83 #endif | |
84 #if !defined (ENCAPSULATE_MKDIR) && defined (DONT_ENCAPSULATE) | |
85 # define sys_mkdir mkdir | |
86 #endif | |
87 | |
88 #ifdef ENCAPSULATE_OPENDIR | |
89 DIR *sys_opendir (CONST char *filename); | |
90 #endif | |
91 #if defined (ENCAPSULATE_OPENDIR) && !defined (DONT_ENCAPSULATE) | |
92 # undef opendir | |
93 # define opendir sys_opendir | |
94 #endif | |
95 #if !defined (ENCAPSULATE_OPENDIR) && defined (DONT_ENCAPSULATE) | |
96 # define sys_opendir opendir | |
97 #endif | |
98 | |
99 #ifdef ENCAPSULATE_READDIR | |
100 DIRENTRY *sys_readdir (DIR *dirp); | |
101 #endif | |
102 #if defined (ENCAPSULATE_READDIR) && !defined (DONT_ENCAPSULATE) | |
103 # undef readdir | |
104 # define readdir sys_readdir | |
105 #endif | |
106 #if !defined (ENCAPSULATE_READDIR) && defined (DONT_ENCAPSULATE) | |
107 # define sys_readdir readdir | |
108 #endif | |
109 | |
110 #ifdef ENCAPSULATE_CLOSEDIR | |
111 int sys_closedir (DIR *dirp); | |
112 #endif | |
113 #if defined (ENCAPSULATE_CLOSEDIR) && !defined (DONT_ENCAPSULATE) | |
114 # undef closedir | |
115 # define closedir sys_closedir | |
116 #endif | |
117 #if !defined (ENCAPSULATE_CLOSEDIR) && defined (DONT_ENCAPSULATE) | |
118 # define sys_closedir closedir | |
119 #endif | |
120 | |
121 #ifdef ENCAPSULATE_RMDIR | |
122 int sys_rmdir (CONST char *path); | |
123 #endif | |
124 #if defined (ENCAPSULATE_RMDIR) && !defined (DONT_ENCAPSULATE) | |
125 # undef rmdir | |
126 # define rmdir sys_rmdir | |
127 #endif | |
128 #if !defined (ENCAPSULATE_RMDIR) && defined (DONT_ENCAPSULATE) | |
129 # define sys_rmdir rmdir | |
130 #endif | |
131 |