2 Copyright (C) 2001-2002 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
22 ISSLASH(C) tests whether C is a directory separator character.
23 IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
24 it may be concatenated to a directory pathname.
25 IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
27 #if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
28 /* Win32, OS/2, DOS */
29 # define ISSLASH(C) ((C) == '/' || (C) == '\\')
30 # define HAS_DEVICE(P) \
31 ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
33 # define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
34 # define IS_PATH_WITH_DIR(P) \
35 (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
36 # define FILESYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
39 # define ISSLASH(C) ((C) == '/')
40 # define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
41 # define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
42 # define FILESYSTEM_PREFIX_LEN(P) 0
45 /* Concatenate a directory pathname, a relative pathname and an optional
46 suffix. Return a freshly allocated pathname. */
47 extern char *concatenated_pathname (const char *directory,
48 const char *filename, const char *suffix);
50 #endif /* _PATHNAME_H */