00001 /* Macros for taking apart, interpreting and processing file names. 00002 00003 These are here because some non-Posix (a.k.a. DOSish) systems have 00004 drive letter brain-damage at the beginning of an absolute file name, 00005 use forward- and back-slash in path names interchangeably, and 00006 some of them have case-insensitive file names. 00007 00008 Copyright 2000, 2001 Free Software Foundation, Inc. 00009 00010 This file is part of BFD, the Binary File Descriptor library. 00011 00012 This program is free software; you can redistribute it and/or modify 00013 it under the terms of the GNU General Public License as published by 00014 the Free Software Foundation; either version 2 of the License, or 00015 (at your option) any later version. 00016 00017 This program is distributed in the hope that it will be useful, 00018 but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 GNU General Public License for more details. 00021 00022 You should have received a copy of the GNU General Public License 00023 along with this program; if not, write to the Free Software 00024 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 00025 00026 #ifndef FILENAMES_H 00027 #define FILENAMES_H 00028 00029 #if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) 00030 00031 #ifndef HAVE_DOS_BASED_FILE_SYSTEM 00032 #define HAVE_DOS_BASED_FILE_SYSTEM 1 00033 #endif 00034 00035 #define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') 00036 /* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is 00037 only semi-absolute. This is because the users of IS_ABSOLUTE_PATH 00038 want to know whether to prepend the current working directory to 00039 a file name, which should not be done with a name like d:foo. */ 00040 #define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':'))) 00041 #define FILENAME_CMP(s1, s2) strcasecmp(s1, s2) 00042 00043 #else /* not DOSish */ 00044 00045 #define IS_DIR_SEPARATOR(c) ((c) == '/') 00046 #define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) 00047 #define FILENAME_CMP(s1, s2) strcmp(s1, s2) 00048 00049 #endif /* not DOSish */ 00050 00051 #endif /* FILENAMES_H */
1.5.6