dhcpd-pools
3.0
ISC dhcpd lease usage analyser
lib
filename.h
Go to the documentation of this file.
1
/* Basic filename support macros.
2
Copyright (C) 2001-2004, 2007-2017 Free Software Foundation, Inc.
3
4
This program is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation; either version 3 of the License, or
7
(at your option) any later version.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17
#ifndef _FILENAME_H
18
#define _FILENAME_H
19
20
#ifdef __cplusplus
21
extern
"C"
{
22
#endif
23
24
25
/* Pathname support.
26
ISSLASH(C) tests whether C is a directory separator character.
27
IS_ABSOLUTE_PATH(P) tests whether P is an absolute path. If it is not,
28
it may be concatenated to a directory pathname.
29
IS_PATH_WITH_DIR(P) tests whether P contains a directory specification.
30
*/
31
#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
32
/* Native Windows, Cygwin, OS/2, DOS */
33
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
34
# define HAS_DEVICE(P) \
35
((((P)[0] >= 'A' && (P)[0] <= 'Z') || ((P)[0] >= 'a' && (P)[0] <= 'z')) \
36
&& (P)[1] == ':')
37
# define IS_ABSOLUTE_PATH(P) (ISSLASH ((P)[0]) || HAS_DEVICE (P))
38
# define IS_PATH_WITH_DIR(P) \
39
(strchr (P, '/') != NULL || strchr (P, '\\') != NULL || HAS_DEVICE (P))
40
# define FILE_SYSTEM_PREFIX_LEN(P) (HAS_DEVICE (P) ? 2 : 0)
41
#else
42
/* Unix */
43
# define ISSLASH(C) ((C) == '/')
44
# define IS_ABSOLUTE_PATH(P) ISSLASH ((P)[0])
45
# define IS_PATH_WITH_DIR(P) (strchr (P, '/') != NULL)
46
# define FILE_SYSTEM_PREFIX_LEN(P) 0
47
#endif
48
49
50
#ifdef __cplusplus
51
}
52
#endif
53
54
#endif
/* _FILENAME_H */
Generated on Wed Nov 15 2017 12:55:24 for dhcpd-pools by
1.8.13