annotate lib/pathname.h @ 4945:07fb9f5d51e6

update from gettext 0.14.1
author Karl Berry <karl@freefriends.org>
date Fri, 06 Feb 2004 14:40:09 +0000 (2004-02-06)
parents 76382576bc2e
children eebff8c51a9b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4271
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Pathname support.
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
2 Copyright (C) 2001-2002 Free Software Foundation, Inc.
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4 This program is free software; you can redistribute it and/or modify
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
5 it under the terms of the GNU General Public License as published by
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6 the Free Software Foundation; either version 2, or (at your option)
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
7 any later version.
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9 This program is distributed in the hope that it will be useful,
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 GNU General Public License for more details.
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
13
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14 You should have received a copy of the GNU General Public License
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
15 along with this program; if not, write to the Free Software Foundation,
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
16 Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 #ifndef _PATHNAME_H
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #define _PATHNAME_H
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 /* Pathname support.
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22 ISSLASH(C) tests whether C is a directory separator character.
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24 it may be concatenated to a directory pathname.
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 */
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27 #if defined _WIN32 || defined __WIN32__ || defined __EMX__ || defined __DJGPP__
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 /* Win32, OS/2, DOS */
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29 # define ISSLASH(C) ((C) == '/' || (C) == '\\')
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 # define HAS_DEVICE(P) \
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31 ((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 && (P)[1] == ':')
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 # define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 # define IS_PATH_WITH_DIR(P) \
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 (strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 # define FILESYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37 #else
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 /* Unix */
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39 # define ISSLASH(C) ((C) == '/')
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 # define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 # define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 # define FILESYSTEM_PREFIX_LEN(P) 0
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43 #endif
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
45 /* Concatenate a directory pathname, a relative pathname and an optional
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
46 suffix. Return a freshly allocated pathname. */
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
47 extern char *concatenated_pathname (const char *directory,
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
48 const char *filename, const char *suffix);
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
49
76382576bc2e New module 'pathname'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
50 #endif /* _PATHNAME_H */