1 /* c-pathch.h: define the characters which separate components of
2 filenames and environment variable paths.
4 Copyright 1992, 1993, 1995, 1997, 2008 Karl Berry.
5 Copyright 1997, 1999, 2001, 2005 Olaf Weber.
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public License
18 along with this library; if not, see <http://www.gnu.org/licenses/>. */
23 #include <kpathsea/c-ctype.h>
25 /* What separates filename components? */
29 # define DIR_SEP_STRING ":"
30 # elif defined(DOSISH) /* not VMS */
31 /* Either \'s or 's work. Wayne Sullivan's web2pc prefers /, so we'll
34 # define DIR_SEP_STRING "/"
35 # define IS_DEVICE_SEP(ch) ((ch) == ':')
36 # define NAME_BEGINS_WITH_DEVICE(name) (*(name) && IS_DEVICE_SEP((name)[1]))
37 /* On DOS, it's good to allow both \ and / between directories. */
38 # define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == '\\')
40 /* On win32, UNC names are authorized */
41 # define IS_UNC_NAME(name) (strlen(name)>=3 && IS_DIR_SEP(*name) \
42 && IS_DIR_SEP(*(name+1)) && isalnum(*(name+2)))
43 /* Used after converting '\\' into '/' */
44 # define IS_DIR_SEP_CH(ch) ((ch) == '/')
46 # elif defined(AMIGA) /* not DOSISH */
48 # define DIR_SEP_STRING "/"
49 # define IS_DIR_SEP(ch) ((ch) == '/' || (ch) == ':')
50 # define IS_DEVICE_SEP(ch) ((ch) == ':')
51 # elif defined(VMCMS) /* not AMIGA */
53 # define DIR_SEP_STRING " "
54 # else /* not VMCMS */
56 # define DIR_SEP_STRING "/"
57 # endif /* not VMCMS */
58 #endif /* not DIR_SEP */
61 #define IS_DIR_SEP(ch) ((ch) == DIR_SEP)
64 #define IS_DIR_SEP_CH(ch) IS_DIR_SEP(ch)
66 #ifndef IS_DEVICE_SEP /* No `devices' on, e.g., Unix. */
67 #define IS_DEVICE_SEP(ch) 0
69 #ifndef NAME_BEGINS_WITH_DEVICE
70 #define NAME_BEGINS_WITH_DEVICE(name) 0
72 #ifndef IS_UNC_NAME /* Unc names are in practice found on Win32 only. */
73 #define IS_UNC_NAME(name) 0
76 /* What separates elements in environment variable path lists? */
80 # define ENV_SEP_STRING ","
81 #elif defined (DOSISH)
83 # define ENV_SEP_STRING ";"
86 # define ENV_SEP_STRING ";"
89 # define ENV_SEP_STRING " "
92 # define ENV_SEP_STRING ":"
94 #endif /* not ENV_SEP */
97 #define IS_ENV_SEP(ch) ((ch) == ENV_SEP)
100 #endif /* not C_PATHCH_H */