(U+6215): Apply new conventions for glyph granularity.
[chise/xemacs-chise.git.1] / src / sysdir.h
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 #ifndef INCLUDED_sysdir_h_
24 #define INCLUDED_sysdir_h_
25
26 #ifdef HAVE_UNISTD_H
27 #include <unistd.h>
28 #endif
29
30 #ifdef SYSV_SYSTEM_DIR
31 # include <dirent.h>
32 #elif defined (WIN32_NATIVE)
33 # include <direct.h>
34 # include "ndir.h"
35 #elif defined (NONSYSTEM_DIR_LIBRARY)
36 # include "ndir.h"
37 #else
38 # include <sys/dir.h>
39 #endif /* not NONSYSTEM_DIR_LIBRARY */
40
41 #ifdef SYSV_SYSTEM_DIR
42 # define DIRENTRY struct dirent
43 #else /* not SYSV_SYSTEM_DIR */
44 # define DIRENTRY struct direct
45 #endif
46
47 /* The d_nameln member of a struct dirent includes the '\0' character
48    on some systems, but not on others.  What's worse, you can't tell
49    at compile-time which one it will be, since it really depends on
50    the sort of system providing the filesystem you're reading from,
51    not the system you are running on.  Paul Eggert
52    <eggert@bi.twinsun.com> says this occurs when Emacs is running on a
53    SunOS 4.1.2 host, reading a directory that is remote-mounted from a
54    Solaris 2.1 host and is in a native Solaris 2.1 filesystem.
55
56    (and Solaris 2 doesn't have a d_nameln member at all!  Posix.1
57    doesn't specify it -- mrb)
58
59    Since applying strlen to the name always works, we'll just do that.  */
60 #define NAMLEN(p) strlen (p->d_name)
61
62 #ifdef __CYGWIN__
63 # define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != '\0')
64 #else
65 # define DIRENTRY_NONEMPTY(p) ((p)->d_ino)
66 #endif
67
68 /* encapsulation: directory calls */
69
70 #ifdef ENCAPSULATE_CHDIR
71 int sys_chdir (const char *path);
72 #endif
73 #if defined (ENCAPSULATE_CHDIR) && !defined (DONT_ENCAPSULATE)
74 # undef chdir
75 # define chdir sys_chdir
76 #endif
77 #if !defined (ENCAPSULATE_CHDIR) && defined (DONT_ENCAPSULATE)
78 # define sys_chdir chdir
79 #endif
80
81 #ifdef ENCAPSULATE_MKDIR
82 int sys_mkdir (const char *path, mode_t mode);
83 #endif
84 #if defined (ENCAPSULATE_MKDIR) && !defined (DONT_ENCAPSULATE)
85 # undef mkdir
86 # define mkdir sys_mkdir
87 #endif
88 #if !defined (ENCAPSULATE_MKDIR) && defined (DONT_ENCAPSULATE)
89 # define sys_mkdir mkdir
90 #endif
91
92 #ifdef ENCAPSULATE_OPENDIR
93 DIR *sys_opendir (const char *filename);
94 #endif
95 #if defined (ENCAPSULATE_OPENDIR) && !defined (DONT_ENCAPSULATE)
96 # undef opendir
97 # define opendir sys_opendir
98 #endif
99 #if !defined (ENCAPSULATE_OPENDIR) && defined (DONT_ENCAPSULATE)
100 # define sys_opendir opendir
101 #endif
102
103 #ifdef ENCAPSULATE_READDIR
104 DIRENTRY *sys_readdir (DIR *dirp);
105 #endif
106 #if defined (ENCAPSULATE_READDIR) && !defined (DONT_ENCAPSULATE)
107 # undef readdir
108 # define readdir sys_readdir
109 #endif
110 #if !defined (ENCAPSULATE_READDIR) && defined (DONT_ENCAPSULATE)
111 # define sys_readdir readdir
112 #endif
113
114 #ifdef ENCAPSULATE_CLOSEDIR
115 int sys_closedir (DIR *dirp);
116 #endif
117 #if defined (ENCAPSULATE_CLOSEDIR) && !defined (DONT_ENCAPSULATE)
118 # undef closedir
119 # define closedir sys_closedir
120 #endif
121 #if !defined (ENCAPSULATE_CLOSEDIR) && defined (DONT_ENCAPSULATE)
122 # define sys_closedir closedir
123 #endif
124
125 #ifdef ENCAPSULATE_RMDIR
126 int sys_rmdir (const char *path);
127 #endif
128 #if defined (ENCAPSULATE_RMDIR) && !defined (DONT_ENCAPSULATE)
129 # undef rmdir
130 # define rmdir sys_rmdir
131 #endif
132 #if !defined (ENCAPSULATE_RMDIR) && defined (DONT_ENCAPSULATE)
133 # define sys_rmdir rmdir
134 #endif
135
136 #endif /* INCLUDED_sysdir_h_ */