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