annotate src/sysfile.h @ 1257:4424541fa226

[xemacs-hg @ 2003-02-05 06:20:50 by ben] windows compile problems s/windowsnt.h: Windows has strupr(), strlwr(). Comment fixes. text.h: Style fixes.
author ben
date Wed, 05 Feb 2003 06:20:54 +0000
parents 804517e16990
children 70921960b980
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1995 Free Software Foundation, Inc.
777
e65d9cf16707 [xemacs-hg @ 2002-03-15 11:00:28 by ben]
ben
parents: 771
diff changeset
3 Copyright (C) 2000, 2001, 2002 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not really in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
24 #ifndef INCLUDED_sysfile_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
25 #define INCLUDED_sysfile_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
26
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
27 /* The anonymous voice of the past says:
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
28 Must come before sysfile.h
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
29
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
30 So instead we just put it here. --ben */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
31 #ifdef HAVE_LIBGEN_H
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
32 #include <libgen.h>
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
33 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
34
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include <errno.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
37 #ifndef WIN32_NATIVE
573
6cca1c9bdc85 [xemacs-hg @ 2001-05-25 03:49:08 by martinb]
martinb
parents: 558
diff changeset
38 # include <sys/errno.h> /* <errno.h> does not always imply this */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #ifdef HAVE_UNISTD_H
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
42 # include <unistd.h>
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 #ifndef INCLUDED_FCNTL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 # define INCLUDED_FCNTL
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 # include <fcntl.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 #endif /* INCLUDED_FCNTL */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
50 /* The anonymous voice of the past says:
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 In some systems loading it twice is suicidal. */
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
52 #ifndef INCLUDED_SYS_TYPES
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
53 # define INCLUDED_SYS_TYPES
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
54 # include <sys/types.h> /* some typedefs are used in sys/file.h */
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
55 #endif /* INCLUDED_SYS_TYPES */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
56
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
57 #ifndef WIN32_NATIVE
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
58 # include <sys/file.h>
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
59 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
60
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 #include <sys/stat.h>
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
62
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
63 #if defined (WIN32_NATIVE) || defined (CYGWIN)
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
64 # include <io.h>
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
65 #endif
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
66
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
67 #ifdef WIN32_NATIVE
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
68 # include <direct.h>
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
69 #else
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
70 /* Some configuration files' definitions for the LOAD_AVE_CVT macro
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
71 (like sparc.h's) use macros like FSCALE, defined here. */
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
72 # ifdef HAVE_GTK
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 448
diff changeset
73 /* I hate GTK */
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
74 # undef MIN
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
75 # undef MAX
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
76 # endif /* HAVE_GTK */
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
77 # include <sys/param.h>
609
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
78 /* As per Martin's recommendation, we do not include this. There was
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
79 a comment stating that stuff from here was needed on NeXT, Cygwin,
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
80 and sunplay.c. However, Cygwin includes this automatically from
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
81 fcntl.h, and Martin says that a "conforming" system should never
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
82 need this. We will put it back if necessary on systems requiring it. */
13e3d7ae7155 [xemacs-hg @ 2001-06-06 12:34:42 by ben]
ben
parents: 573
diff changeset
83 /* # include <sys/fcntl.h> */
777
e65d9cf16707 [xemacs-hg @ 2002-03-15 11:00:28 by ben]
ben
parents: 771
diff changeset
84 #endif /* WIN32_NATIVE */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 #ifndef STDERR_FILENO
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 #define STDIN_FILENO 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 #define STDOUT_FILENO 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 #define STDERR_FILENO 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 #ifndef O_RDONLY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 #define O_RDONLY 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 #ifndef O_WRONLY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 #define O_WRONLY 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 #ifndef O_RDWR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 #define O_RDWR 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 /* file opening defaults */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 #ifndef OPEN_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 #ifdef O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107 #define OPEN_BINARY O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 #define OPEN_BINARY (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 #ifndef OPEN_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 #ifdef O_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 #define OPEN_TEXT O_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 #define OPEN_TEXT (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 #ifndef CREAT_MODE
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
122 #ifdef WIN32_NATIVE
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 #define CREAT_MODE (S_IREAD | S_IWRITE)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 #define CREAT_MODE (0666)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 #ifndef READ_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 #ifdef O_TEXT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 #define READ_TEXT "rt"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 #define READ_TEXT "r"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 #ifndef READ_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 #ifdef O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 #define READ_BINARY "rb"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141 #define READ_BINARY "r"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
145 #ifndef READ_PLUS_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
146 #ifdef O_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
147 #define READ_PLUS_TEXT "r+t"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
148 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
149 #define READ_PLUS_TEXT "r+"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
150 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
151 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
152
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
153 #ifndef READ_PLUS_BINARY
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
154 #ifdef O_BINARY
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
155 #define READ_PLUS_BINARY "r+b"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
156 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
157 #define READ_PLUS_BINARY "r+"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
158 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
159 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
160
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
161 #ifndef WRITE_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
162 #ifdef O_TEXT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
163 #define WRITE_TEXT "wt"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
164 #else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
165 #define WRITE_TEXT "w"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
166 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
167 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
168
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 #ifndef WRITE_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 #ifdef O_BINARY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 #define WRITE_BINARY "wb"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 #define WRITE_BINARY "w"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
177 #ifndef APPEND_TEXT
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
178 #ifdef O_TEXT
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
179 #define APPEND_TEXT "at"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
180 #else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
181 #define APPEND_TEXT "a"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
182 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
183 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
184
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
185 #ifndef APPEND_BINARY
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
186 #ifdef O_BINARY
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
187 #define APPEND_BINARY "ab"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
188 #else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
189 #define APPEND_BINARY "a"
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
190 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
191 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
192
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 #ifndef O_NONBLOCK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 #ifdef O_NDELAY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 #define O_NONBLOCK O_NDELAY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 #define O_NONBLOCK 04000
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 #if !S_IRUSR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 # if S_IREAD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 # define S_IRUSR S_IREAD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 # define S_IRUSR 00400
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 #if !S_IWUSR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 # if S_IWRITE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 # define S_IWUSR S_IWRITE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 # define S_IWUSR 00200
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 #if !S_IXUSR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 # if S_IEXEC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 # define S_IXUSR S_IEXEC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 # else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 # define S_IXUSR 00100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 # endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 #ifdef STAT_MACROS_BROKEN
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 #undef S_ISBLK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 #undef S_ISCHR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 #undef S_ISDIR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229 #undef S_ISFIFO
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 #undef S_ISLNK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 #undef S_ISMPB
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 #undef S_ISMPC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 #undef S_ISNWK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 #undef S_ISREG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 #undef S_ISSOCK
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 #endif /* STAT_MACROS_BROKEN. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238 #if !defined(S_ISBLK) && defined(S_IFBLK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 #if !defined(S_ISCHR) && defined(S_IFCHR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 #if !defined(S_ISDIR) && defined(S_IFDIR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247 #if !defined(S_ISREG) && defined(S_IFREG)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 #if !defined(S_ISFIFO) && defined(S_IFIFO)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253 #if !defined(S_ISLNK) && defined(S_IFLNK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 #if !defined(S_ISSOCK) && defined(S_IFSOCK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
267 /* Client .c files should simply use `PATH_MAX'. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
268 #ifndef PATH_MAX
558
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
269 # if defined (_MAX_PATH)
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
270 /* MS Win -- and preferable to _POSIX_PATH_MAX, which is also defined */
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
271 # define PATH_MAX _MAX_PATH
ed498ef2108b [xemacs-hg @ 2001-05-23 09:59:33 by ben]
ben
parents: 462
diff changeset
272 # elif defined (_POSIX_PATH_MAX)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
273 # define PATH_MAX _POSIX_PATH_MAX
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
274 # elif defined (MAXPATHLEN)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
275 # define PATH_MAX MAXPATHLEN
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
276 # else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
277 # define PATH_MAX 1024
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
278 # endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
279 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
280
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
281 /* The following definitions are needed under Windows, at least */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
282 #ifndef X_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
283 # define X_OK 1
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
284 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
285
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
286 #ifndef R_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
287 # define R_OK 4
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
288 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
289
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
290 #ifndef D_OK
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
291 # define D_OK 8
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
292 #endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
293
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
294 #ifndef W_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
295 # define W_OK 2
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
296 #endif
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
297
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
298 #ifndef F_OK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
299 # define F_OK 0
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
301
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
302 #ifndef FD_CLOEXEC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 # define FD_CLOEXEC 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
306 #ifdef emacs
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
307
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 /* Emacs needs to use its own definitions of certain system calls on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 some systems (like SunOS 4.1 and USG systems, where the read system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310 call is interruptible but Emacs expects it not to be; and under
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311 MULE, where all filenames need to be converted to external format).
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
313 We used to play preprocessor games, but in the long run that just leads
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
314 you to ruin. So we explicitly put in the new calls, even if the source
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
315 gets marginally less pretty.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
317 Current files where we don't use retry_ or qxe_ versions:
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
319 -- all sound files except ntplay.c (includes esd.c libsst.[ch] libst.h
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
320 linuxplay.c sgiplay.c sunplay.c
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
321 hpplay.c nas.c)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
322 -- all unex* files
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
323 -- hftctl.c
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
324 -- lib-src files
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
325 */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
327 ssize_t retry_read (int, void *, size_t);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
328 ssize_t retry_write (int, const void *, size_t);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
329 int retry_open (const Extbyte *path, int oflag, ...);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
330 int qxe_open (const Ibyte *path, int oflag, ...);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
331 int qxe_interruptible_open (const Ibyte *path, int oflag, int mode);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
332 int retry_close (int);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
333 Bytecount read_allowing_quit (int fildes, void *buf, Bytecount size);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
334 Bytecount write_allowing_quit (int fildes, const void *buf,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
335 Bytecount size);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
337 /* Now the stdio versions ... */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
339 size_t retry_fread (void *, size_t, size_t, FILE *);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
340 size_t retry_fwrite (const void *, size_t, size_t, FILE *);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
341 FILE *retry_fopen (const Extbyte *path, const Char_ASCII *mode);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
342 FILE *qxe_fopen (const Ibyte *path, const Char_ASCII *mode);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
343 int retry_fclose (FILE *);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
344
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
345 /* encapsulations: file-information calls */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
346
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
347 int qxe_access (const Ibyte *path, int mode);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
348 int qxe_eaccess (const Ibyte *path, int mode);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
349 int qxe_lstat (const Ibyte *path, struct stat *buf);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
350 int qxe_readlink (const Ibyte *path, Ibyte *buf, size_t bufsiz);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
351 int qxe_fstat (int fd, struct stat *buf);
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
352 int qxe_stat (const Ibyte *path, struct stat *buf);
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
353 Ibyte *qxe_realpath (const Ibyte *path, Ibyte resolved_path []);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 /* encapsulations: file-manipulation calls */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
357 int qxe_chmod (const Ibyte *path, mode_t mode);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
358
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
359 #if defined (HAVE_LINK)
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
360 int qxe_link (const Ibyte *existing, const Ibyte *new);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
361 #endif /* defined (HAVE_LINK) */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
362
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
363 int qxe_rename (const Ibyte *old, const Ibyte *new);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
364
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
365 #if defined (HAVE_SYMLINK)
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
366 int qxe_symlink (const Ibyte *name1, const Ibyte *name2);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
367 #endif /* defined (HAVE_SYMLINK) */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
368
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
369 int qxe_unlink (const Ibyte *path);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
370
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
371 #endif /* emacs */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
372
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
373
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
374 #ifndef HAVE_H_ERRNO
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
375 extern int h_errno;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
378 #ifndef HAVE_DUP2
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
379 int dup2 (int oldd, int newd);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
382 #ifndef HAVE_STRERROR
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
383 /* X11R6 defines strerror as a macro */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
384 # ifdef strerror
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
385 # undef strerror
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
386 # endif
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
387 const char *strerror (int);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
390
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
391
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
392 /*
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
393 DEFAULT_DIRECTORY_SEP is the default value of Vdirectory_sep_char.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
394 DIRECTORY_SEP is the currently preferred separator between elements
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
395 of a path, when paths are canonicalized.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
396 DEVICE_SEP is the separator between devices and paths (might not
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
397 be defined).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
398 SEPCHAR is the separator between paths in a path search string
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
399 (e.g. the PATH environment variable).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
400 IS_DIRECTORY_SEP() returns true if the character is any directory
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
401 separator (there might be more than one allowed on a system.).
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
402 IS_DEVICE_SEP() returns true if the character is a device separator.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
403 IS_ANY_SEP() returns true if the character is a directory or device
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
404 separator.
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
405 */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
406
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
407 #ifdef emacs
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
408
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
409 /* We used to put some of this stuff in the s+m files for the various
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
410 types of MS Windows, but that's disingenuous. The various definitions
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
411 above were specifically created for MS Windows, and the "if not, then
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
412 let's define the defaults" stuff (formerly in lisp.h) specifically knows
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
413 about what is going to get redefined and how, and code all over the
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
414 place that works with filenames has to conditionalize on WIN32_NATIVE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
415 anyway. It's much clearer if we put all related definitions in one
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
416 place. (In fact, I discovered a number of bugs in the process.)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
417
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
418 S+M files should be used for simple on-off or multiple-choice settings,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
419 or possibly string settings. Anything that gets to the level of
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
420 programming should be elsewhere, and anything that ends up having
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
421 lots of complicated interactions scattered around in many files should
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
422 be consolidated. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
423
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
424 #ifdef WIN32_NATIVE
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
425
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
426 #define SEPCHAR ';'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
427 #define DEFAULT_DIRECTORY_SEP '\\'
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
428
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
429 DECLARE_INLINE_HEADER (Ibyte sysfile_get_directory_sep (void))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
430 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
431 if (!CHARP (Vdirectory_sep_char)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
432 || (XCHAR (Vdirectory_sep_char) != '/'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
433 && XCHAR (Vdirectory_sep_char) != '\\'))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
434 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
435 warn_when_safe
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
436 (Qfile_name, Qerror,
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
437 "`directory-sep-char' set to invalid %s: resetting to %c.",
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
438 DEFAULT_DIRECTORY_SEP);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
439 Vdirectory_sep_char = make_char (DEFAULT_DIRECTORY_SEP);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
440 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
441
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
442 return XCHAR (Vdirectory_sep_char);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
443 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
444 #define DIRECTORY_SEP sysfile_get_directory_sep()
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
445
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
446 #else /* not WIN32_NATIVE */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
447
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
448 #define SEPCHAR ':'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
449 #define DEFAULT_DIRECTORY_SEP '/'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
450 #define DIRECTORY_SEP '/'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
451
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
452 #endif /* WIN32_NATIVE */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
453
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
454
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
455 #if defined (WIN32_NATIVE) || defined (CYGWIN)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
456
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
457 #define DEVICE_SEP ':'
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
458
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
459 #define IS_DEVICE_SEP(c) ((c) == DEVICE_SEP)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
460
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
461 DECLARE_INLINE_HEADER (int IS_DIRECTORY_SEP (Ichar c))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
462 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
463 return (c == '/' || c == '\\');
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
464 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
465
867
804517e16990 [xemacs-hg @ 2002-06-05 09:54:39 by ben]
ben
parents: 777
diff changeset
466 DECLARE_INLINE_HEADER (int IS_ANY_SEP (Ichar c))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
467 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
468 return (c == '/' || c == '\\' || c == ':');
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
469 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
470
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
471 #else /* not (defined (WIN32_NATIVE) || defined (CYGWIN)) */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
472
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
473 #define IS_DEVICE_SEP(c) 0
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
474 #define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
475 #define IS_ANY_SEP(c) IS_DIRECTORY_SEP (c)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
476
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
477 #endif /* defined (WIN32_NATIVE) || defined (CYGWIN) */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
478
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
479 #endif /* emacs */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 609
diff changeset
480
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
481
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 438
diff changeset
482 #endif /* INCLUDED_sysfile_h_ */