1130803Smarcel/* Macros for taking apart, interpreting and processing file names. 2130803Smarcel 3130803Smarcel These are here because some non-Posix (a.k.a. DOSish) systems have 4130803Smarcel drive letter brain-damage at the beginning of an absolute file name, 5130803Smarcel use forward- and back-slash in path names interchangeably, and 6130803Smarcel some of them have case-insensitive file names. 7130803Smarcel 8130803Smarcel Copyright 2000, 2001 Free Software Foundation, Inc. 9130803Smarcel 10130803SmarcelThis file is part of BFD, the Binary File Descriptor library. 11130803Smarcel 12130803SmarcelThis program is free software; you can redistribute it and/or modify 13130803Smarcelit under the terms of the GNU General Public License as published by 14130803Smarcelthe Free Software Foundation; either version 2 of the License, or 15130803Smarcel(at your option) any later version. 16130803Smarcel 17130803SmarcelThis program is distributed in the hope that it will be useful, 18130803Smarcelbut WITHOUT ANY WARRANTY; without even the implied warranty of 19130803SmarcelMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20130803SmarcelGNU General Public License for more details. 21130803Smarcel 22130803SmarcelYou should have received a copy of the GNU General Public License 23130803Smarcelalong with this program; if not, write to the Free Software 24130803SmarcelFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 25130803Smarcel 26130803Smarcel#ifndef FILENAMES_H 27130803Smarcel#define FILENAMES_H 28130803Smarcel 29130803Smarcel#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) 30130803Smarcel 31130803Smarcel#ifndef HAVE_DOS_BASED_FILE_SYSTEM 32130803Smarcel#define HAVE_DOS_BASED_FILE_SYSTEM 1 33130803Smarcel#endif 34130803Smarcel 35130803Smarcel#define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') 36130803Smarcel/* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is 37130803Smarcel only semi-absolute. This is because the users of IS_ABSOLUTE_PATH 38130803Smarcel want to know whether to prepend the current working directory to 39130803Smarcel a file name, which should not be done with a name like d:foo. */ 40130803Smarcel#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':'))) 41130803Smarcel#define FILENAME_CMP(s1, s2) strcasecmp(s1, s2) 42130803Smarcel 43130803Smarcel#else /* not DOSish */ 44130803Smarcel 45130803Smarcel#define IS_DIR_SEPARATOR(c) ((c) == '/') 46130803Smarcel#define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) 47130803Smarcel#define FILENAME_CMP(s1, s2) strcmp(s1, s2) 48130803Smarcel 49130803Smarcel#endif /* not DOSish */ 50130803Smarcel 51130803Smarcel#endif /* FILENAMES_H */ 52