]> git.ipfire.org Git - thirdparty/gcc.git/blame - include/filenames.h
MAINTAINERS: Update my email address in WAA section.
[thirdparty/gcc.git] / include / filenames.h
CommitLineData
b6728b1b
ZW
1/* Macros for taking apart, interpreting and processing file names.
2
3 These are here because some non-Posix (a.k.a. DOSish) systems have
4 drive letter brain-damage at the beginning of an absolute file name,
5 use forward- and back-slash in path names interchangeably, and
6 some of them have case-insensitive file names.
7
0c9bce0b 8 Copyright 2000, 2001, 2007 Free Software Foundation, Inc.
b6728b1b
ZW
9
10This file is part of BFD, the Binary File Descriptor library.
11
12This program is free software; you can redistribute it and/or modify
13it under the terms of the GNU General Public License as published by
14the Free Software Foundation; either version 2 of the License, or
15(at your option) any later version.
16
17This program is distributed in the hope that it will be useful,
18but WITHOUT ANY WARRANTY; without even the implied warranty of
19MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20GNU General Public License for more details.
21
22You should have received a copy of the GNU General Public License
23along with this program; if not, write to the Free Software
d6d47ea0 24Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
b6728b1b
ZW
25
26#ifndef FILENAMES_H
27#define FILENAMES_H
28
46450975
ILT
29#ifdef __cplusplus
30extern "C" {
31#endif
32
b6728b1b
ZW
33#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
34
35#ifndef HAVE_DOS_BASED_FILE_SYSTEM
36#define HAVE_DOS_BASED_FILE_SYSTEM 1
37#endif
38
39#define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\')
40/* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is
41 only semi-absolute. This is because the users of IS_ABSOLUTE_PATH
42 want to know whether to prepend the current working directory to
43 a file name, which should not be done with a name like d:foo. */
44#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':')))
b6728b1b
ZW
45
46#else /* not DOSish */
47
48#define IS_DIR_SEPARATOR(c) ((c) == '/')
49#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]))
b6728b1b
ZW
50
51#endif /* not DOSish */
52
0c9bce0b
JB
53extern int filename_cmp (const char *s1, const char *s2);
54#define FILENAME_CMP(s1, s2) filename_cmp(s1, s2)
55
46450975
ILT
56#ifdef __cplusplus
57}
58#endif
59
b6728b1b 60#endif /* FILENAMES_H */