| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
#ifndef FILENAMES_H |
| 27 |
#define FILENAMES_H |
| 28 |
|
| 29 |
#include "hashtab.h" |
| 30 |
|
| 31 |
#ifdef __cplusplus |
| 32 |
extern "C" { |
| 33 |
#endif |
| 34 |
|
| 35 |
#if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) |
| 36 |
# ifndef HAVE_DOS_BASED_FILE_SYSTEM |
| 37 |
# define HAVE_DOS_BASED_FILE_SYSTEM 1 |
| 38 |
# endif |
| 39 |
# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM |
| 40 |
# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1 |
| 41 |
# endif |
| 42 |
# define HAS_DRIVE_SPEC(f) HAS_DOS_DRIVE_SPEC (f) |
| 43 |
# define IS_DIR_SEPARATOR(c) IS_DOS_DIR_SEPARATOR (c) |
| 44 |
# define IS_ABSOLUTE_PATH(f) IS_DOS_ABSOLUTE_PATH (f) |
| 45 |
#else |
| 46 |
# if defined(__APPLE__) |
| 47 |
# ifndef HAVE_CASE_INSENSITIVE_FILE_SYSTEM |
| 48 |
# define HAVE_CASE_INSENSITIVE_FILE_SYSTEM 1 |
| 49 |
# endif |
| 50 |
# endif |
| 51 |
# define HAS_DRIVE_SPEC(f) (0) |
| 52 |
# define IS_DIR_SEPARATOR(c) IS_UNIX_DIR_SEPARATOR (c) |
| 53 |
# define IS_ABSOLUTE_PATH(f) IS_UNIX_ABSOLUTE_PATH (f) |
| 54 |
#endif |
| 55 |
|
| 56 |
#define IS_DIR_SEPARATOR_1(dos_based, c) \ |
| 57 |
(((c) == '/') \ |
| 58 |
|| (((c) == '\\') && (dos_based))) |
| 59 |
|
| 60 |
#define HAS_DRIVE_SPEC_1(dos_based, f) \ |
| 61 |
((f)[0] && ((f)[1] == ':') && (dos_based)) |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
#define STRIP_DRIVE_SPEC(f) ((f) + 2) |
| 66 |
|
| 67 |
#define IS_DOS_DIR_SEPARATOR(c) IS_DIR_SEPARATOR_1 (1, c) |
| 68 |
#define IS_DOS_ABSOLUTE_PATH(f) IS_ABSOLUTE_PATH_1 (1, f) |
| 69 |
#define HAS_DOS_DRIVE_SPEC(f) HAS_DRIVE_SPEC_1 (1, f) |
| 70 |
|
| 71 |
#define IS_UNIX_DIR_SEPARATOR(c) IS_DIR_SEPARATOR_1 (0, c) |
| 72 |
#define IS_UNIX_ABSOLUTE_PATH(f) IS_ABSOLUTE_PATH_1 (0, f) |
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
#define IS_ABSOLUTE_PATH_1(dos_based, f) \ |
| 80 |
(IS_DIR_SEPARATOR_1 (dos_based, (f)[0]) \ |
| 81 |
|| HAS_DRIVE_SPEC_1 (dos_based, f)) |
| 82 |
|
| 83 |
extern int filename_cmp (const char *s1, const char *s2); |
| 84 |
#define FILENAME_CMP(s1, s2) filename_cmp(s1, s2) |
| 85 |
|
| 86 |
extern int filename_ncmp (const char *s1, const char *s2, |
| 87 |
size_t n); |
| 88 |
|
| 89 |
extern hashval_t filename_hash (const void *s); |
| 90 |
|
| 91 |
extern int filename_eq (const void *s1, const void *s2); |
| 92 |
|
| 93 |
extern int canonical_filename_eq (const char *a, const char *b); |
| 94 |
|
| 95 |
#ifdef __cplusplus |
| 96 |
} |
| 97 |
#endif |
| 98 |
|
| 99 |
#endif |