161843Sobrien/* Macros for taking apart, interpreting and processing file names. 261843Sobrien 361843Sobrien These are here because some non-Posix (a.k.a. DOSish) systems have 461843Sobrien drive letter brain-damage at the beginning of an absolute file name, 561843Sobrien use forward- and back-slash in path names interchangeably, and 661843Sobrien some of them have case-insensitive file names. 761843Sobrien 8218822Sdim Copyright 2000, 2001, 2007 Free Software Foundation, Inc. 961843Sobrien 1061843SobrienThis file is part of BFD, the Binary File Descriptor library. 1161843Sobrien 1261843SobrienThis program is free software; you can redistribute it and/or modify 1361843Sobrienit under the terms of the GNU General Public License as published by 1461843Sobrienthe Free Software Foundation; either version 2 of the License, or 1561843Sobrien(at your option) any later version. 1661843Sobrien 1761843SobrienThis program is distributed in the hope that it will be useful, 1861843Sobrienbut WITHOUT ANY WARRANTY; without even the implied warranty of 1961843SobrienMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 2061843SobrienGNU General Public License for more details. 2161843Sobrien 2261843SobrienYou should have received a copy of the GNU General Public License 2361843Sobrienalong with this program; if not, write to the Free Software 24218822SdimFoundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 2561843Sobrien 2661843Sobrien#ifndef FILENAMES_H 2761843Sobrien#define FILENAMES_H 2861843Sobrien 2989857Sobrien#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) 3061843Sobrien 3161843Sobrien#ifndef HAVE_DOS_BASED_FILE_SYSTEM 3261843Sobrien#define HAVE_DOS_BASED_FILE_SYSTEM 1 3361843Sobrien#endif 3461843Sobrien 3561843Sobrien#define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') 3661843Sobrien/* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is 3761843Sobrien only semi-absolute. This is because the users of IS_ABSOLUTE_PATH 3861843Sobrien want to know whether to prepend the current working directory to 3961843Sobrien a file name, which should not be done with a name like d:foo. */ 4061843Sobrien#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':'))) 4161843Sobrien 4261843Sobrien#else /* not DOSish */ 4361843Sobrien 4461843Sobrien#define IS_DIR_SEPARATOR(c) ((c) == '/') 4561843Sobrien#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) 4661843Sobrien 4761843Sobrien#endif /* not DOSish */ 4861843Sobrien 49218822Sdimextern int filename_cmp (const char *s1, const char *s2); 50218822Sdim#define FILENAME_CMP(s1, s2) filename_cmp(s1, s2) 51218822Sdim 5261843Sobrien#endif /* FILENAMES_H */ 53