* alpha.c, basic_blocks.c, basic_blocks.h, bb_exit_func.c,
[binutils.git] / include / filenames.h
blobca9e2732a3266fba66b53fe61f3370c3eef580dd
1 /* Macros for taking apart, interpreting and processing file names.
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.
8 Copyright 2000, 2001 Free Software Foundation, Inc.
10 This file is part of BFD, the Binary File Descriptor library.
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
26 #ifndef FILENAMES_H
27 #define FILENAMES_H
29 #if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__)
31 #ifndef HAVE_DOS_BASED_FILE_SYSTEM
32 #define HAVE_DOS_BASED_FILE_SYSTEM 1
33 #endif
35 #define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\')
36 /* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is
37 only semi-absolute. This is because the users of IS_ABSOLUTE_PATH
38 want to know whether to prepend the current working directory to
39 a file name, which should not be done with a name like d:foo. */
40 #define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':')))
41 #define FILENAME_CMP(s1, s2) strcasecmp(s1, s2)
43 #else /* not DOSish */
45 #define IS_DIR_SEPARATOR(c) ((c) == '/')
46 #define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]))
47 #define FILENAME_CMP(s1, s2) strcmp(s1, s2)
49 #endif /* not DOSish */
51 #endif /* FILENAMES_H */