5cea7498b4c339b17ffb2e0a557f5a8b7673d1df
[debian/tar] / gnu / dosname.h
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* File names on MS-DOS/Windows systems.
4
5    Copyright (C) 2000-2001, 2004-2006, 2009-2013 Free Software Foundation, Inc.
6
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
20    From Paul Eggert and Jim Meyering.  */
21
22 #ifndef _DOSNAME_H
23 #define _DOSNAME_H
24
25 #if (defined _WIN32 || defined __WIN32__ ||     \
26      defined __MSDOS__ || defined __CYGWIN__ || \
27      defined __EMX__ || defined __DJGPP__)
28    /* This internal macro assumes ASCII, but all hosts that support drive
29       letters use ASCII.  */
30 # define _IS_DRIVE_LETTER(C) (((unsigned int) (C) | ('a' - 'A')) - 'a'  \
31                               <= 'z' - 'a')
32 # define FILE_SYSTEM_PREFIX_LEN(Filename) \
33           (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':' ? 2 : 0)
34 # ifndef __CYGWIN__
35 #  define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1
36 # endif
37 # define ISSLASH(C) ((C) == '/' || (C) == '\\')
38 #else
39 # define FILE_SYSTEM_PREFIX_LEN(Filename) 0
40 # define ISSLASH(C) ((C) == '/')
41 #endif
42
43 #ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
44 # define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0
45 #endif
46
47 #if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
48 #  define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
49 # else
50 #  define IS_ABSOLUTE_FILE_NAME(F)                              \
51      (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0)
52 #endif
53 #define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
54
55 #endif /* DOSNAME_H_ */