diff options
Diffstat (limited to 'lib/system.h')
| -rw-r--r-- | lib/system.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lib/system.h b/lib/system.h index 92033355..3a6b8e93 100644 --- a/lib/system.h +++ b/lib/system.h @@ -51,6 +51,22 @@ # error "Unknown byte order" #endif +#if (defined _WIN32 || defined __WIN32__) +# define _IS_DRIVE_LETTER(c) (((unsigned int) (c) | ('a' - 'A')) - 'a' <= 'z' - 'a') +# define FILE_SYSTEM_PREFIX_LEN(filename) \ + (_IS_DRIVE_LETTER ((filename)[0]) && (filename)[1] == ':' ? 2 : 0) +# define ISDIRSEP(c) ((c) == '/' || (c) == '\\') +# define DIRSEP '\\' +# define PATHSEP ';' +# define IS_ABSOLUTE_PATH(f) ISDIRSEP ((f)[FILE_SYSTEM_PREFIX_LEN (f)]) +#else +# define FILE_SYSTEM_PREFIX_LEN(filename) 0 +# define ISDIRSEP(c) ((c) == '/') +# define DIRSEP '/' +# define PATHSEP ':' +# define IS_ABSOLUTE_PATH(p) (ISDIRSEP ((p)[0])) +#endif + #ifndef MAX #define MAX(m, n) ((m) < (n) ? (n) : (m)) #endif @@ -63,11 +79,6 @@ #define powerof2(x) (((x) & ((x) - 1)) == 0) #endif -#if !HAVE_DECL_MEMPCPY -#define mempcpy(dest, src, n) \ - ((void *) ((char *) memcpy (dest, src, n) + (size_t) n)) -#endif - /* A special gettext function we use if the strings are too short. */ #define sgettext(Str) \ ({ const char *__res = strrchr (gettext (Str), '|'); \ |
