Mercurial > hg > xemacs-beta
annotate src/sysfile.h @ 5887:6eca500211f4
Prototype for X509_check_host() has changed, detect this in configure.ac
ChangeLog addition:
2015-04-09 Aidan Kehoe <kehoea@parhasard.net>
* configure.ac:
If X509_check_host() is available, check the number of arguments
it takes. Don't use it if it takes any number of arguments other
than five. Also don't use it if <openssl/x509v3.h> does not
declare it, since if that is so there is no portable way to tell
how many arguments it should take, and so we would end up smashing
the stack.
* configure: Regenerate.
src/ChangeLog addition:
2015-04-09 Aidan Kehoe <kehoea@parhasard.net>
* tls.c:
#include <openssl/x509v3.h> for its prototype for
X509_check_host().
* tls.c (tls_open):
Pass the new fifth argument to X509_check_host().
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Thu, 09 Apr 2015 14:27:02 +0100 |
parents | 308d34e9f07d |
children |
rev | line source |
---|---|
428 | 1 /* |
2 Copyright (C) 1995 Free Software Foundation, Inc. | |
2421 | 3 Copyright (C) 2000, 2001, 2002, 2004 Ben Wing. |
428 | 4 |
5 This file is part of XEmacs. | |
6 | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4981
diff
changeset
|
7 XEmacs is free software: you can redistribute it and/or modify it |
428 | 8 under the terms of the GNU General Public License as published by the |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4981
diff
changeset
|
9 Free Software Foundation, either version 3 of the License, or (at your |
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4981
diff
changeset
|
10 option) any later version. |
428 | 11 |
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
16 | |
17 You should have received a copy of the GNU General Public License | |
5402
308d34e9f07d
Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents:
4981
diff
changeset
|
18 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. */ |
428 | 19 |
20 /* Synched up with: Not really in FSF. */ | |
21 | |
440 | 22 #ifndef INCLUDED_sysfile_h_ |
23 #define INCLUDED_sysfile_h_ | |
24 | |
771 | 25 /* The anonymous voice of the past says: |
26 Must come before sysfile.h | |
27 | |
28 So instead we just put it here. --ben */ | |
29 #ifdef HAVE_LIBGEN_H | |
30 #include <libgen.h> | |
31 #endif | |
32 | |
428 | 33 #include <errno.h> |
34 | |
442 | 35 #ifndef WIN32_NATIVE |
573 | 36 # include <sys/errno.h> /* <errno.h> does not always imply this */ |
428 | 37 #endif |
38 | |
4863
5ab6dc5d789e
Fix EOVERFLOW breakage under Visual Studio 6
Vin Shelton <acs@xemacs.org>
parents:
4854
diff
changeset
|
39 /* EOVERFLOW isn't defined on native Windows under VC6 */ |
5ab6dc5d789e
Fix EOVERFLOW breakage under Visual Studio 6
Vin Shelton <acs@xemacs.org>
parents:
4854
diff
changeset
|
40 #ifndef EOVERFLOW |
5ab6dc5d789e
Fix EOVERFLOW breakage under Visual Studio 6
Vin Shelton <acs@xemacs.org>
parents:
4854
diff
changeset
|
41 # define EOVERFLOW 10139 |
5ab6dc5d789e
Fix EOVERFLOW breakage under Visual Studio 6
Vin Shelton <acs@xemacs.org>
parents:
4854
diff
changeset
|
42 #endif |
5ab6dc5d789e
Fix EOVERFLOW breakage under Visual Studio 6
Vin Shelton <acs@xemacs.org>
parents:
4854
diff
changeset
|
43 |
428 | 44 #ifdef HAVE_UNISTD_H |
558 | 45 # include <unistd.h> |
428 | 46 #endif |
47 | |
48 #ifndef INCLUDED_FCNTL | |
49 # define INCLUDED_FCNTL | |
50 # include <fcntl.h> | |
51 #endif /* INCLUDED_FCNTL */ | |
52 | |
558 | 53 /* The anonymous voice of the past says: |
428 | 54 In some systems loading it twice is suicidal. */ |
558 | 55 #ifndef INCLUDED_SYS_TYPES |
56 # define INCLUDED_SYS_TYPES | |
57 # include <sys/types.h> /* some typedefs are used in sys/file.h */ | |
58 #endif /* INCLUDED_SYS_TYPES */ | |
442 | 59 |
60 #ifndef WIN32_NATIVE | |
558 | 61 # include <sys/file.h> |
442 | 62 #endif |
63 | |
1467 | 64 /* Some systems (SCO 3.2v5) do #define stat ... in this header. So it |
65 _must_ be included before any use of struct stat. Most emacs files | |
66 should include sysfile.h. The unex*.c include <sys/stat.h> directly. */ | |
428 | 67 #include <sys/stat.h> |
442 | 68 |
1315 | 69 #ifdef WIN32_ANY |
558 | 70 # include <io.h> |
71 #endif | |
72 | |
73 #ifdef WIN32_NATIVE | |
74 # include <direct.h> | |
75 #else | |
442 | 76 /* Some configuration files' definitions for the LOAD_AVE_CVT macro |
77 (like sparc.h's) use macros like FSCALE, defined here. */ | |
558 | 78 # ifdef HAVE_GTK |
462 | 79 /* I hate GTK */ |
558 | 80 # undef MIN |
81 # undef MAX | |
82 # endif /* HAVE_GTK */ | |
83 # include <sys/param.h> | |
609 | 84 /* As per Martin's recommendation, we do not include this. There was |
85 a comment stating that stuff from here was needed on NeXT, Cygwin, | |
86 and sunplay.c. However, Cygwin includes this automatically from | |
87 fcntl.h, and Martin says that a "conforming" system should never | |
88 need this. We will put it back if necessary on systems requiring it. */ | |
89 /* # include <sys/fcntl.h> */ | |
777 | 90 #endif /* WIN32_NATIVE */ |
428 | 91 |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
92 /* Needed for ITEXT_TO_TSTR, MAX_XETCHAR_SIZE below; but syswindows.h |
4854 | 93 depends on lisp.h being previously included. */ |
94 #if defined (WIN32_ANY) && defined (emacs) | |
95 # include "syswindows.h" | |
96 #endif | |
97 | |
428 | 98 #ifndef STDERR_FILENO |
99 #define STDIN_FILENO 0 | |
100 #define STDOUT_FILENO 1 | |
101 #define STDERR_FILENO 2 | |
102 #endif | |
103 | |
104 #ifndef O_RDONLY | |
105 #define O_RDONLY 0 | |
106 #endif | |
107 | |
108 #ifndef O_WRONLY | |
109 #define O_WRONLY 1 | |
110 #endif | |
111 | |
112 #ifndef O_RDWR | |
113 #define O_RDWR 2 | |
114 #endif | |
115 | |
116 /* file opening defaults */ | |
117 #ifndef OPEN_BINARY | |
118 #ifdef O_BINARY | |
119 #define OPEN_BINARY O_BINARY | |
120 #else | |
121 #define OPEN_BINARY (0) | |
122 #endif | |
123 #endif | |
124 | |
125 #ifndef OPEN_TEXT | |
126 #ifdef O_TEXT | |
127 #define OPEN_TEXT O_TEXT | |
128 #else | |
129 #define OPEN_TEXT (0) | |
130 #endif | |
131 #endif | |
132 | |
133 #ifndef CREAT_MODE | |
442 | 134 #ifdef WIN32_NATIVE |
428 | 135 #define CREAT_MODE (S_IREAD | S_IWRITE) |
136 #else | |
137 #define CREAT_MODE (0666) | |
138 #endif | |
139 #endif | |
140 | |
141 #ifndef READ_TEXT | |
142 #ifdef O_TEXT | |
143 #define READ_TEXT "rt" | |
144 #else | |
145 #define READ_TEXT "r" | |
146 #endif | |
147 #endif | |
148 | |
149 #ifndef READ_BINARY | |
150 #ifdef O_BINARY | |
151 #define READ_BINARY "rb" | |
152 #else | |
153 #define READ_BINARY "r" | |
154 #endif | |
155 #endif | |
156 | |
442 | 157 #ifndef READ_PLUS_TEXT |
158 #ifdef O_TEXT | |
159 #define READ_PLUS_TEXT "r+t" | |
160 #else | |
161 #define READ_PLUS_TEXT "r+" | |
162 #endif | |
163 #endif | |
164 | |
165 #ifndef READ_PLUS_BINARY | |
166 #ifdef O_BINARY | |
167 #define READ_PLUS_BINARY "r+b" | |
168 #else | |
169 #define READ_PLUS_BINARY "r+" | |
170 #endif | |
171 #endif | |
172 | |
173 #ifndef WRITE_TEXT | |
174 #ifdef O_TEXT | |
175 #define WRITE_TEXT "wt" | |
176 #else | |
177 #define WRITE_TEXT "w" | |
178 #endif | |
179 #endif | |
180 | |
428 | 181 #ifndef WRITE_BINARY |
182 #ifdef O_BINARY | |
183 #define WRITE_BINARY "wb" | |
184 #else | |
185 #define WRITE_BINARY "w" | |
186 #endif | |
187 #endif | |
188 | |
771 | 189 #ifndef APPEND_TEXT |
190 #ifdef O_TEXT | |
191 #define APPEND_TEXT "at" | |
192 #else | |
193 #define APPEND_TEXT "a" | |
194 #endif | |
195 #endif | |
196 | |
197 #ifndef APPEND_BINARY | |
198 #ifdef O_BINARY | |
199 #define APPEND_BINARY "ab" | |
200 #else | |
201 #define APPEND_BINARY "a" | |
202 #endif | |
203 #endif | |
204 | |
428 | 205 #ifndef O_NONBLOCK |
206 #ifdef O_NDELAY | |
207 #define O_NONBLOCK O_NDELAY | |
208 #else | |
209 #define O_NONBLOCK 04000 | |
210 #endif | |
211 #endif | |
212 | |
213 #if !S_IRUSR | |
214 # if S_IREAD | |
215 # define S_IRUSR S_IREAD | |
216 # else | |
217 # define S_IRUSR 00400 | |
218 # endif | |
219 #endif | |
220 | |
221 #if !S_IWUSR | |
222 # if S_IWRITE | |
223 # define S_IWUSR S_IWRITE | |
224 # else | |
225 # define S_IWUSR 00200 | |
226 # endif | |
227 #endif | |
228 | |
229 #if !S_IXUSR | |
230 # if S_IEXEC | |
231 # define S_IXUSR S_IEXEC | |
232 # else | |
233 # define S_IXUSR 00100 | |
234 # endif | |
235 #endif | |
236 | |
237 #ifdef STAT_MACROS_BROKEN | |
238 #undef S_ISBLK | |
239 #undef S_ISCHR | |
240 #undef S_ISDIR | |
241 #undef S_ISFIFO | |
242 #undef S_ISLNK | |
243 #undef S_ISMPB | |
244 #undef S_ISMPC | |
245 #undef S_ISNWK | |
246 #undef S_ISREG | |
247 #undef S_ISSOCK | |
248 #endif /* STAT_MACROS_BROKEN. */ | |
249 | |
2526 | 250 #ifdef WIN32_NATIVE |
251 /* This is the standard value for S_IFLNK. All of the S_... flags that | |
252 exist in the MSVCRT have standard values, so their bit tests will | |
253 magically work. */ | |
254 #define S_IFLNK 0120000 | |
255 #endif | |
256 | |
428 | 257 #if !defined(S_ISBLK) && defined(S_IFBLK) |
258 #define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) | |
259 #endif | |
260 #if !defined(S_ISCHR) && defined(S_IFCHR) | |
261 #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) | |
262 #endif | |
263 #if !defined(S_ISDIR) && defined(S_IFDIR) | |
264 #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) | |
265 #endif | |
266 #if !defined(S_ISREG) && defined(S_IFREG) | |
267 #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) | |
268 #endif | |
269 #if !defined(S_ISFIFO) && defined(S_IFIFO) | |
270 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) | |
271 #endif | |
272 #if !defined(S_ISLNK) && defined(S_IFLNK) | |
273 #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) | |
274 #endif | |
275 #if !defined(S_ISSOCK) && defined(S_IFSOCK) | |
276 #define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) | |
277 #endif | |
278 #if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */ | |
279 #define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) | |
280 #define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) | |
281 #endif | |
282 #if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */ | |
283 #define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) | |
284 #endif | |
285 | |
2421 | 286 /* Determining the maximum pathname length. |
287 | |
288 NOTE: IN GENERAL, YOU SHOULD NOT USE THIS. | |
289 If at all possible, avoid using fixed-length buffers of any sort. | |
290 You cannot guarantee on many systems that pathnames won't exceed | |
291 these limits for one reason or another. | |
292 | |
293 Unfortunately, there is no universal agreement over whether these | |
294 values should include a final null-terminator or not. Even recent | |
295 versions of Linux (circa 2002) are switching from the not-including- | |
296 terminator kind to the including-terminator kind. So we assume that | |
297 the including-terminator kind will be even (usually is), and round | |
298 up as necessary. */ | |
299 | |
300 #define ROUND_UP_TO_EVEN_NUMBER(val) (((val + 1) >> 1) << 1) | |
301 #ifdef PATH_MAX | |
302 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (PATH_MAX) | |
303 #elif defined (_MAX_PATH) | |
558 | 304 /* MS Win -- and preferable to _POSIX_PATH_MAX, which is also defined */ |
2421 | 305 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (_MAX_PATH) |
306 #elif defined (_POSIX_PATH_MAX) | |
307 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (_POSIX_PATH_MAX) | |
308 #elif defined (MAXPATHLEN) | |
309 # define QXE_PATH_MAX ROUND_UP_TO_EVEN_NUMBER (MAXPATHLEN) | |
310 #else | |
311 # define QXE_PATH_MAX 1024 | |
442 | 312 #endif |
313 | |
4854 | 314 /* Client .c files should use PATH_MAX_INTERNAL or PATH_MAX_TCHAR |
2421 | 315 if they must use either one at all. */ |
316 | |
317 /* Use for internally formatted text, which can potentially have up to | |
318 four bytes per character */ | |
319 #define PATH_MAX_INTERNAL (QXE_PATH_MAX * MAX_ICHAR_LEN) | |
4854 | 320 #ifdef WIN32_ANY |
321 /* Use for externally formatted text in TCHAR's. */ | |
322 #define PATH_MAX_TCHAR (QXE_PATH_MAX * MAX_XETCHAR_SIZE) | |
323 #endif | |
2421 | 324 |
442 | 325 /* The following definitions are needed under Windows, at least */ |
326 #ifndef X_OK | |
327 # define X_OK 1 | |
328 #endif | |
428 | 329 |
442 | 330 #ifndef R_OK |
331 # define R_OK 4 | |
332 #endif | |
333 | |
771 | 334 #ifndef D_OK |
335 # define D_OK 8 | |
336 #endif | |
337 | |
442 | 338 #ifndef W_OK |
339 # define W_OK 2 | |
340 #endif | |
341 | |
342 #ifndef F_OK | |
343 # define F_OK 0 | |
428 | 344 #endif |
345 | |
346 #ifndef FD_CLOEXEC | |
347 # define FD_CLOEXEC 1 | |
348 #endif | |
349 | |
771 | 350 #ifdef emacs |
351 | |
428 | 352 /* Emacs needs to use its own definitions of certain system calls on |
353 some systems (like SunOS 4.1 and USG systems, where the read system | |
354 call is interruptible but Emacs expects it not to be; and under | |
355 MULE, where all filenames need to be converted to external format). | |
356 | |
771 | 357 We used to play preprocessor games, but in the long run that just leads |
358 you to ruin. So we explicitly put in the new calls, even if the source | |
359 gets marginally less pretty. | |
428 | 360 |
771 | 361 Current files where we don't use retry_ or qxe_ versions: |
428 | 362 |
771 | 363 -- all sound files except ntplay.c (includes esd.c libsst.[ch] libst.h |
364 linuxplay.c sgiplay.c sunplay.c | |
365 hpplay.c nas.c) | |
366 -- all unex* files | |
367 -- lib-src files | |
368 */ | |
428 | 369 |
771 | 370 ssize_t retry_read (int, void *, size_t); |
371 ssize_t retry_write (int, const void *, size_t); | |
372 int retry_open (const Extbyte *path, int oflag, ...); | |
867 | 373 int qxe_open (const Ibyte *path, int oflag, ...); |
374 int qxe_interruptible_open (const Ibyte *path, int oflag, int mode); | |
771 | 375 int retry_close (int); |
376 Bytecount read_allowing_quit (int fildes, void *buf, Bytecount size); | |
377 Bytecount write_allowing_quit (int fildes, const void *buf, | |
378 Bytecount size); | |
428 | 379 |
380 /* Now the stdio versions ... */ | |
381 | |
771 | 382 size_t retry_fread (void *, size_t, size_t, FILE *); |
383 size_t retry_fwrite (const void *, size_t, size_t, FILE *); | |
2367 | 384 FILE *retry_fopen (const Extbyte *path, const Ascbyte *mode); |
385 FILE *qxe_fopen (const Ibyte *path, const Ascbyte *mode); | |
771 | 386 int retry_fclose (FILE *); |
428 | 387 |
388 /* encapsulations: file-information calls */ | |
389 | |
867 | 390 int qxe_access (const Ibyte *path, int mode); |
391 int qxe_eaccess (const Ibyte *path, int mode); | |
392 int qxe_lstat (const Ibyte *path, struct stat *buf); | |
393 int qxe_readlink (const Ibyte *path, Ibyte *buf, size_t bufsiz); | |
771 | 394 int qxe_fstat (int fd, struct stat *buf); |
867 | 395 int qxe_stat (const Ibyte *path, struct stat *buf); |
2526 | 396 Ibyte *qxe_realpath (const Ibyte *path, Ibyte resolved_path [], |
397 Boolint links_only); | |
428 | 398 |
399 /* encapsulations: file-manipulation calls */ | |
400 | |
867 | 401 int qxe_chmod (const Ibyte *path, mode_t mode); |
771 | 402 |
403 #if defined (HAVE_LINK) | |
3025 | 404 int qxe_link (const Ibyte *existing, const Ibyte *new_); |
771 | 405 #endif /* defined (HAVE_LINK) */ |
406 | |
3025 | 407 int qxe_rename (const Ibyte *old, const Ibyte *new_); |
771 | 408 |
409 #if defined (HAVE_SYMLINK) | |
867 | 410 int qxe_symlink (const Ibyte *name1, const Ibyte *name2); |
771 | 411 #endif /* defined (HAVE_SYMLINK) */ |
412 | |
867 | 413 int qxe_unlink (const Ibyte *path); |
771 | 414 |
1467 | 415 /* definition in filemode.c |
416 must be declared here to ensure that struct stat is properly formed | |
417 on systems like SCO 3.2v5 */ | |
418 void filemodestring (struct stat *, char *); | |
419 | |
2526 | 420 #ifdef WIN32_ANY |
421 extern int mswindows_shortcuts_are_symlinks; | |
422 #endif | |
423 | |
771 | 424 #endif /* emacs */ |
425 | |
426 | |
427 #ifndef HAVE_H_ERRNO | |
428 extern int h_errno; | |
428 | 429 #endif |
430 | |
771 | 431 #ifndef HAVE_DUP2 |
432 int dup2 (int oldd, int newd); | |
428 | 433 #endif |
434 | |
771 | 435 #ifndef HAVE_STRERROR |
436 /* X11R6 defines strerror as a macro */ | |
437 # ifdef strerror | |
438 # undef strerror | |
439 # endif | |
440 const char *strerror (int); | |
428 | 441 #endif |
442 | |
771 | 443 |
444 | |
445 /* | |
446 DEFAULT_DIRECTORY_SEP is the default value of Vdirectory_sep_char. | |
447 DIRECTORY_SEP is the currently preferred separator between elements | |
448 of a path, when paths are canonicalized. | |
449 DEVICE_SEP is the separator between devices and paths (might not | |
450 be defined). | |
451 SEPCHAR is the separator between paths in a path search string | |
452 (e.g. the PATH environment variable). | |
453 IS_DIRECTORY_SEP() returns true if the character is any directory | |
454 separator (there might be more than one allowed on a system.). | |
455 IS_DEVICE_SEP() returns true if the character is a device separator. | |
456 IS_ANY_SEP() returns true if the character is a directory or device | |
457 separator. | |
458 */ | |
459 | |
460 /* We used to put some of this stuff in the s+m files for the various | |
461 types of MS Windows, but that's disingenuous. The various definitions | |
462 above were specifically created for MS Windows, and the "if not, then | |
463 let's define the defaults" stuff (formerly in lisp.h) specifically knows | |
464 about what is going to get redefined and how, and code all over the | |
465 place that works with filenames has to conditionalize on WIN32_NATIVE | |
466 anyway. It's much clearer if we put all related definitions in one | |
467 place. (In fact, I discovered a number of bugs in the process.) | |
468 | |
469 S+M files should be used for simple on-off or multiple-choice settings, | |
470 or possibly string settings. Anything that gets to the level of | |
471 programming should be elsewhere, and anything that ends up having | |
472 lots of complicated interactions scattered around in many files should | |
473 be consolidated. */ | |
474 | |
475 #ifdef WIN32_NATIVE | |
476 | |
477 #define SEPCHAR ';' | |
478 #define DEFAULT_DIRECTORY_SEP '\\' | |
428 | 479 |
3379 | 480 #ifdef emacs |
867 | 481 DECLARE_INLINE_HEADER (Ibyte sysfile_get_directory_sep (void)) |
771 | 482 { |
483 if (!CHARP (Vdirectory_sep_char) | |
484 || (XCHAR (Vdirectory_sep_char) != '/' | |
485 && XCHAR (Vdirectory_sep_char) != '\\')) | |
486 { | |
487 warn_when_safe | |
488 (Qfile_name, Qerror, | |
489 "`directory-sep-char' set to invalid %s: resetting to %c.", | |
490 DEFAULT_DIRECTORY_SEP); | |
491 Vdirectory_sep_char = make_char (DEFAULT_DIRECTORY_SEP); | |
492 } | |
493 | |
494 return XCHAR (Vdirectory_sep_char); | |
495 } | |
496 #define DIRECTORY_SEP sysfile_get_directory_sep() | |
497 | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4863
diff
changeset
|
498 #define DEFAULT_DIRECTORY_FALLBACK "C:\\" |
4736
d261888e5069
Fix Win32 native build after my DEFAULT_DIRECTORY_FALLBACK change, thanks Vin!
Aidan Kehoe <kehoea@parhasard.net>
parents:
4733
diff
changeset
|
499 |
d261888e5069
Fix Win32 native build after my DEFAULT_DIRECTORY_FALLBACK change, thanks Vin!
Aidan Kehoe <kehoea@parhasard.net>
parents:
4733
diff
changeset
|
500 #else /* not emacs */ |
3379 | 501 |
502 /* The above Lisp variables are not available to make-docfile, etc. */ | |
503 #define DIRECTORY_SEP DEFAULT_DIRECTORY_SEP | |
504 | |
505 #endif /* emacs */ | |
506 | |
771 | 507 #else /* not WIN32_NATIVE */ |
508 | |
509 #define SEPCHAR ':' | |
510 #define DEFAULT_DIRECTORY_SEP '/' | |
511 #define DIRECTORY_SEP '/' | |
4952
19a72041c5ed
Mule-izing, various fixes related to char * arguments
Ben Wing <ben@xemacs.org>
parents:
4863
diff
changeset
|
512 #define DEFAULT_DIRECTORY_FALLBACK "/" |
771 | 513 |
514 #endif /* WIN32_NATIVE */ | |
515 | |
428 | 516 |
1315 | 517 #ifdef WIN32_ANY |
771 | 518 |
519 #define DEVICE_SEP ':' | |
520 | |
521 #define IS_DEVICE_SEP(c) ((c) == DEVICE_SEP) | |
522 | |
3379 | 523 #ifdef emacs |
524 | |
867 | 525 DECLARE_INLINE_HEADER (int IS_DIRECTORY_SEP (Ichar c)) |
771 | 526 { |
527 return (c == '/' || c == '\\'); | |
528 } | |
529 | |
867 | 530 DECLARE_INLINE_HEADER (int IS_ANY_SEP (Ichar c)) |
771 | 531 { |
532 return (c == '/' || c == '\\' || c == ':'); | |
533 } | |
534 | |
3379 | 535 #else /* emacs */ |
536 | |
537 /* The Ichar typedef is not available to make-docfile, etc. */ | |
538 | |
539 DECLARE_INLINE_HEADER (int IS_DIRECTORY_SEP (int c)) | |
540 { | |
541 return (c == '/' || c == '\\'); | |
542 } | |
543 | |
544 DECLARE_INLINE_HEADER (int IS_ANY_SEP (int c)) | |
545 { | |
546 return (c == '/' || c == '\\' || c == ':'); | |
547 } | |
548 | |
549 #endif | |
550 | |
1315 | 551 #else /* not WIN32_ANY */ |
771 | 552 |
553 #define IS_DEVICE_SEP(c) 0 | |
554 #define IS_DIRECTORY_SEP(c) ((c) == DIRECTORY_SEP) | |
555 #define IS_ANY_SEP(c) IS_DIRECTORY_SEP (c) | |
556 | |
1315 | 557 #endif /* WIN32_ANY */ |
771 | 558 |
3368 | 559 /* How long can a source filename be in DOC (including "\037S" at the start |
560 and "\n" at the end) ? */ | |
561 #define DOC_MAX_FILENAME_LENGTH 2048 | |
562 | |
563 #ifdef emacs | |
564 | |
2526 | 565 #if defined (WIN32_NATIVE) |
566 #define PATHNAME_RESOLVE_LINKS(path, pathout) \ | |
567 do \ | |
568 { \ | |
569 if (mswindows_shortcuts_are_symlinks) \ | |
570 { \ | |
571 Ibyte *_prl_path_ = (Ibyte *) (path); \ | |
572 Ibyte _prl_path2_[PATH_MAX_INTERNAL]; \ | |
573 \ | |
574 if (!qxe_realpath (_prl_path_, _prl_path2_, 1)) \ | |
575 (pathout) = _prl_path_; \ | |
576 else \ | |
577 IBYTE_STRING_TO_ALLOCA (_prl_path2_, pathout); \ | |
578 } \ | |
579 else (pathout) = (Ibyte *) (path); \ | |
580 } while (0) | |
581 #else | |
582 #define PATHNAME_RESOLVE_LINKS(path, pathout) ((pathout) = (Ibyte *) (path)) | |
583 #endif | |
584 | |
585 #define LISP_PATHNAME_RESOLVE_LINKS(path, pathout) \ | |
586 PATHNAME_RESOLVE_LINKS (XSTRING_DATA (path), pathout) | |
587 | |
588 /* The documentation in VC++ claims that the pathname library functions | |
589 accept strings in the current locale-specific encoding, but that's | |
590 false, because they just call the native Win32 routines directly, which | |
591 always use the system-default encoding (which is what Qmswindows_tstr | |
592 will give us when not XEUNICODE_P). */ | |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
593 #define PATHNAME_CONVERT_OUT_TSTR(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
594 do \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
595 { \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
596 const Ibyte *_pco_path_; \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
597 PATHNAME_RESOLVE_LINKS (path, _pco_path_); \ |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
598 (pathout) = ITEXT_TO_TSTR (_pco_path_); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
599 } while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
600 |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
601 #define PATHNAME_CONVERT_OUT_UTF_8(path, pathout) \ |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
602 do \ |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
603 { \ |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
604 const Ibyte *_pco_path_; \ |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
605 PATHNAME_RESOLVE_LINKS (path, _pco_path_); \ |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
606 (pathout) = ITEXT_TO_EXTERNAL (_pco_path_, Qutf_8); \ |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
607 } while (0) |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
608 |
2526 | 609 #ifdef WIN32_NATIVE |
4834
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
610 #define PATHNAME_CONVERT_OUT(path, pathout) \ |
b3ea9c582280
Use new cygwin_conv_path API with Cygwin 1.7 for converting names between Win32 and POSIX, UTF-8-aware, with attendant changes elsewhere
Ben Wing <ben@xemacs.org>
parents:
4759
diff
changeset
|
611 PATHNAME_CONVERT_OUT_TSTR (path, pathout) |
2526 | 612 #else |
4981
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
613 # define PATHNAME_CONVERT_OUT(path, pathout) \ |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
614 do \ |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
615 { \ |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
616 (pathout) = ITEXT_TO_EXTERNAL (path, Qfile_name); \ |
4aebb0131297
Cleanups/renaming of EXTERNAL_TO_C_STRING and friends
Ben Wing <ben@xemacs.org>
parents:
4952
diff
changeset
|
617 } while (0) |
2526 | 618 #endif |
619 | |
620 #define LISP_PATHNAME_CONVERT_OUT(path, pathout) \ | |
621 PATHNAME_CONVERT_OUT (XSTRING_DATA (path), pathout) | |
622 | |
771 | 623 #endif /* emacs */ |
624 | |
440 | 625 #endif /* INCLUDED_sysfile_h_ */ |