Back to index

cell-binutils  2.17cvs20070401
filenames.h
Go to the documentation of this file.
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, 2007 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 
00042 #else  /* not DOSish */
00043 
00044 #define IS_DIR_SEPARATOR(c) ((c) == '/')
00045 #define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]))
00046 
00047 #endif /* not DOSish */
00048 
00049 extern int filename_cmp (const char *s1, const char *s2);
00050 #define FILENAME_CMP(s1, s2)       filename_cmp(s1, s2)
00051 
00052 #endif /* FILENAMES_H */