transmission: upgrade 2.31 to 2.32
[tomato.git] / release / src / router / gettext / gettext-tools / lib / pathname.h
blob1914e9685a17f811305f8a26b3704dcf7e7d3042
1 /* Pathname support.
2 Copyright (C) 2001-2004 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)
7 any later version.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18 #ifndef _PATHNAME_H
19 #define _PATHNAME_H
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
26 /* Pathname support.
27 ISSLASH(C) tests whether C is a directory separator character.
28 IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
29 it may be concatenated to a directory pathname.
30 IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
32 #if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
33 /* Win32, Cygwin, OS/2, DOS */
34 # define ISSLASH(C) ((C) == '/' || (C) == '\\')
35 # define HAS_DEVICE(P) \
36 ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
37 && (P)[1] == ':')
38 # define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
39 # define IS_PATH_WITH_DIR(P) \
40 (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
41 # define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
42 #else
43 /* Unix */
44 # define ISSLASH(C) ((C) == '/')
45 # define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
46 # define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
47 # define FILE_SYSTEM_PREFIX_LEN(P) 0
48 #endif
50 /* Concatenate a directory pathname, a relative pathname and an optional
51 suffix. Return a freshly allocated pathname. */
52 extern char *concatenated_pathname (const char *directory,
53 const char *filename, const char *suffix);
55 #ifdef __cplusplus
57 #endif
59 #endif /* _PATHNAME_H */