From 3d50b6043ac61690f0b163a1618cfd5516238c81 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 25 Feb 2011 10:52:37 -0800 Subject: [PATCH] dirname: move m4/dos.m4 functionality into lib/dosname.h m4/dos.m4 needs to go. It laboriously invokes the C compiler, and extracts symbols from it, puts them into config.h; but it's much easier to use the symbols directly. filename.h already does this, but it disagrees with dos.m4 in some respects. This patch introduces a different include file dosname.h that packages up dos.m4, and then later we can work on merging filename.h and dosname.h. Applications that need only the easy-to-configure symbols should consider including dosname.h rather than dirname.h. * NEWS: Mention incompatible changes. * m4/dos.m4: Remove. * lib/dosname.h, modules/dosname: New files. * lib/dirname.h (ISSLASH, FILE_SYSTEM_PREFIX_LEN): (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE): (IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): Move to lib/dosname.h. * lib/at-func.c, lib/at-func2.c, lib/openat.c, lib/savewd.c: Include dosname.h, not dirname.h. * lib/rmdir.c, lib/stat.c, lib/unlink.c, lib/unlinkat.c: Include dosname.h, for definitions of symbols like ISSLASH that used to be in config.h. * m4/dirname.m4 (gl_DIRNAME_LGPL): Do not require gl_AC_DOS. * m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise. * m4/stat.m4 (gl_FUNC_STAT): Likewise. * m4/unlink.m4 (gl_FUNC_UNLINK): Likewise. * modules/dirname-lgpl (Files): Omit m4/dos.m4. * modules/rmdir (Files): Likewise. * modules/stat (Files): Likewise. * modules/unlink (Files): Likewise. * modules/dirname-lgpl (Depends-on): Add dosname. * modules/lstat (Depends-on): Likewise. * modules/openat (Depends-on): Likewise. * modules/rmdir (Depends-on): Likewise. * modules/savewd (Depends-on): Likewise. * modules/stat (Depends-on): Likewise. * modules/unlink (Depends-on): Likewise. * modules/openat (Depends-on): Remove dirname-lgpl. * modules/savewd (Depends-on): Likewise. * tests/test-dirname.c: Do not use removed symbols like FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR. Instead, use the remaining symbols, e.g., ISSLASH ('\\'). --- ChangeLog | 44 ++++++++++++++++++++++++++++++++ NEWS | 11 ++++++++ lib/at-func.c | 2 +- lib/at-func2.c | 2 +- lib/dirname.h | 30 +--------------------- lib/dosname.h | 53 +++++++++++++++++++++++++++++++++++++++ lib/openat.c | 2 +- lib/rmdir.c | 2 ++ lib/savewd.c | 2 +- lib/stat.c | 1 + lib/unlink.c | 2 ++ lib/unlinkat.c | 1 + m4/dirname.m4 | 3 +-- m4/dos.m4 | 71 ---------------------------------------------------- m4/rmdir.m4 | 3 +-- m4/stat.m4 | 3 +-- m4/unlink.m4 | 3 +-- modules/dirname-lgpl | 2 +- modules/dosname | 20 +++++++++++++++ modules/lstat | 1 + modules/openat | 2 +- modules/rmdir | 2 +- modules/savewd | 2 +- modules/stat | 2 +- modules/unlink | 2 +- tests/test-dirname.c | 6 ++--- 26 files changed, 153 insertions(+), 121 deletions(-) create mode 100644 lib/dosname.h delete mode 100644 m4/dos.m4 create mode 100644 modules/dosname diff --git a/ChangeLog b/ChangeLog index bdb7ac625..6cae63821 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,47 @@ +2011-02-25 Paul Eggert + + dirname: move m4/dos.m4 functionality into lib/dosname.h + + m4/dos.m4 needs to go. It laboriously invokes the C compiler, and + extracts symbols from it, puts them into config.h; but it's much + easier to use the symbols directly. filename.h already does this, + but it disagrees with dos.m4 in some respects. This patch + introduces a different include file dosname.h that packages up + dos.m4, and then later we can work on merging filename.h and + dosname.h. Applications that need only the easy-to-configure + symbols should consider including dosname.h rather than dirname.h. + * NEWS: Mention incompatible changes. + * m4/dos.m4: Remove. + * lib/dosname.h, modules/dosname: New files. + * lib/dirname.h (ISSLASH, FILE_SYSTEM_PREFIX_LEN): + (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE): + (IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): Move to lib/dosname.h. + * lib/at-func.c, lib/at-func2.c, lib/openat.c, lib/savewd.c: + Include dosname.h, not dirname.h. + * lib/rmdir.c, lib/stat.c, lib/unlink.c, lib/unlinkat.c: + Include dosname.h, for definitions of symbols like ISSLASH + that used to be in config.h. + * m4/dirname.m4 (gl_DIRNAME_LGPL): Do not require gl_AC_DOS. + * m4/rmdir.m4 (gl_FUNC_RMDIR): Likewise. + * m4/stat.m4 (gl_FUNC_STAT): Likewise. + * m4/unlink.m4 (gl_FUNC_UNLINK): Likewise. + * modules/dirname-lgpl (Files): Omit m4/dos.m4. + * modules/rmdir (Files): Likewise. + * modules/stat (Files): Likewise. + * modules/unlink (Files): Likewise. + * modules/dirname-lgpl (Depends-on): Add dosname. + * modules/lstat (Depends-on): Likewise. + * modules/openat (Depends-on): Likewise. + * modules/rmdir (Depends-on): Likewise. + * modules/savewd (Depends-on): Likewise. + * modules/stat (Depends-on): Likewise. + * modules/unlink (Depends-on): Likewise. + * modules/openat (Depends-on): Remove dirname-lgpl. + * modules/savewd (Depends-on): Likewise. + * tests/test-dirname.c: Do not use removed symbols like + FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR. Instead, use + the remaining symbols, e.g., ISSLASH ('\\'). + 2011-02-25 Eric Blake strstr: revert patches that introduced bug and pessimization diff --git a/NEWS b/NEWS index b203b2cf4..9a65c6af0 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,17 @@ User visible incompatible changes Date Modules Changes +2011-02-25 dirname These modules no longer put #defines for the + dirname-lgpl following symbols into : ISSLASH, + backupfile FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX, + lstat FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR, + openat FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE. + remove Applications that need ISSLASH can include the new + rmdir header dosname.h. + savewd + stat + unlink + 2011-02-14 getloadavg This module no longer #defines C_GETLOADAVG or HAVE_GETLOADAVG, as the application no longer needs to worry about how getloadavg is defined. It no diff --git a/lib/at-func.c b/lib/at-func.c index 31a75f175..52868bcb9 100644 --- a/lib/at-func.c +++ b/lib/at-func.c @@ -16,7 +16,7 @@ /* written by Jim Meyering */ -#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ +#include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ #include "openat.h" #include "openat-priv.h" #include "save-cwd.h" diff --git a/lib/at-func2.c b/lib/at-func2.c index 29e6772da..da691fef2 100644 --- a/lib/at-func2.c +++ b/lib/at-func2.c @@ -25,7 +25,7 @@ #include #include -#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ +#include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ #include "filenamecat.h" #include "openat.h" #include "same-inode.h" diff --git a/lib/dirname.h b/lib/dirname.h index f08995554..2ef988244 100644 --- a/lib/dirname.h +++ b/lib/dirname.h @@ -21,44 +21,16 @@ # include # include +# include "dosname.h" # ifndef DIRECTORY_SEPARATOR # define DIRECTORY_SEPARATOR '/' # endif -# ifndef ISSLASH -# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR) -# endif - -# ifndef FILE_SYSTEM_PREFIX_LEN -# if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX - /* This internal macro assumes ASCII, but all hosts that support drive - letters use ASCII. */ -# 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) -# else -# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 -# endif -# endif - -# ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 -# endif - # ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT # define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 # endif -# if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE -# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) -# else -# define IS_ABSOLUTE_FILE_NAME(F) \ - (ISSLASH ((F)[0]) || 0 < FILE_SYSTEM_PREFIX_LEN (F)) -# endif -# define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) - # if GNULIB_DIRNAME char *base_name (char const *file); char *dir_name (char const *file); diff --git a/lib/dosname.h b/lib/dosname.h new file mode 100644 index 000000000..acdd03b15 --- /dev/null +++ b/lib/dosname.h @@ -0,0 +1,53 @@ +/* File names on MS-DOS/Windows systems. + + Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + From Paul Eggert and Jim Meyering. */ + +#ifndef _DOSNAME_H +#define _DOSNAME_H + +#if (defined _WIN32 || defined __WIN32__ || \ + defined __MSDOS__ || defined __CYGWIN__ || \ + defined __EMX__ || defined __DJGPP__) + /* This internal macro assumes ASCII, but all hosts that support drive + letters use ASCII. */ +# 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) +# ifndef __CYGWIN__ +# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1 +# endif +# define ISSLASH(C) ((C) == '/' || (C) == '\\') +#else +# define FILE_SYSTEM_PREFIX_LEN(Filename) 0 +# define ISSLASH(C) ((C) == '/') +#endif + +#ifndef FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 +#endif + +#if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)]) +# else +# define IS_ABSOLUTE_FILE_NAME(F) \ + (ISSLASH ((F)[0]) || FILE_SYSTEM_PREFIX_LEN (F) != 0) +#endif +#define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F)) + +#endif /* DOSNAME_H_ */ diff --git a/lib/openat.c b/lib/openat.c index 939e3c70d..18491a6f6 100644 --- a/lib/openat.c +++ b/lib/openat.c @@ -25,7 +25,7 @@ #include #include -#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ +#include "dosname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ #include "openat-priv.h" #include "save-cwd.h" diff --git a/lib/rmdir.c b/lib/rmdir.c index 8e02c37ad..d7395a515 100644 --- a/lib/rmdir.c +++ b/lib/rmdir.c @@ -23,6 +23,8 @@ #include #include +#include "dosname.h" + #undef rmdir /* Remove directory DIR. diff --git a/lib/savewd.c b/lib/savewd.c index 982e73f7f..f19e98e35 100644 --- a/lib/savewd.c +++ b/lib/savewd.c @@ -31,7 +31,7 @@ #include #include -#include "dirname.h" +#include "dosname.h" #include "fcntl-safer.h" /* Save the working directory into *WD, if it hasn't been saved diff --git a/lib/stat.c b/lib/stat.c index f16d9144a..cbc9100fd 100644 --- a/lib/stat.c +++ b/lib/stat.c @@ -37,6 +37,7 @@ orig_stat (const char *filename, struct stat *buf) #include #include #include +#include "dosname.h" /* Store information about NAME into ST. Work around bugs with trailing slashes. Mingw has other bugs (such as st_ino always diff --git a/lib/unlink.c b/lib/unlink.c index 7b14d8035..677d58493 100644 --- a/lib/unlink.c +++ b/lib/unlink.c @@ -24,6 +24,8 @@ #include #include +#include "dosname.h" + #undef unlink /* Remove file NAME. diff --git a/lib/unlinkat.c b/lib/unlinkat.c index 9f1894ac2..fd1c69e73 100644 --- a/lib/unlinkat.c +++ b/lib/unlinkat.c @@ -26,6 +26,7 @@ #include #include +#include "dosname.h" #include "openat.h" #if HAVE_UNLINKAT diff --git a/m4/dirname.m4 b/m4/dirname.m4 index d0b439f55..9d5f40d1c 100644 --- a/m4/dirname.m4 +++ b/m4/dirname.m4 @@ -1,4 +1,4 @@ -#serial 8 -*- autoconf -*- +#serial 9 -*- autoconf -*- dnl Copyright (C) 2002-2006, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -18,7 +18,6 @@ AC_DEFUN([gl_DIRNAME_LGPL], AC_LIBOBJ([stripslash]) dnl Prerequisites of lib/dirname.h. - AC_REQUIRE([gl_AC_DOS]) AC_REQUIRE([gl_DOUBLE_SLASH_ROOT]) dnl No prerequisites of lib/basename-lgpl.c, lib/dirname-lgpl.c, diff --git a/m4/dos.m4 b/m4/dos.m4 deleted file mode 100644 index ed9c4cee6..000000000 --- a/m4/dos.m4 +++ /dev/null @@ -1,71 +0,0 @@ -#serial 11 -*- autoconf -*- - -# Define some macros required for proper operation of code in lib/*.c -# on MSDOS/Windows systems. - -# Copyright (C) 2000-2001, 2004-2006, 2009-2011 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# From Jim Meyering. - -AC_DEFUN([gl_AC_DOS], - [ - AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos], - [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ -#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && !defined __CYGWIN__ -neither MSDOS nor Windows -#endif]])], - [ac_cv_win_or_dos=yes], - [ac_cv_win_or_dos=no]) - ]) - - if test x"$ac_cv_win_or_dos" = xyes; then - ac_fs_accepts_drive_letter_prefix=1 - ac_fs_backslash_is_file_name_separator=1 - AC_CACHE_CHECK([whether drive letter can start relative path], - [ac_cv_drive_letter_can_be_relative], - [ - AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[ -#if defined __CYGWIN__ -drive letters are always absolute -#endif]])], - [ac_cv_drive_letter_can_be_relative=yes], - [ac_cv_drive_letter_can_be_relative=no]) - ]) - if test x"$ac_cv_drive_letter_can_be_relative" = xyes; then - ac_fs_drive_letter_can_be_relative=1 - else - ac_fs_drive_letter_can_be_relative=0 - fi - else - ac_fs_accepts_drive_letter_prefix=0 - ac_fs_backslash_is_file_name_separator=0 - ac_fs_drive_letter_can_be_relative=0 - fi - - AC_DEFINE_UNQUOTED([FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX], - $ac_fs_accepts_drive_letter_prefix, - [Define on systems for which file names may have a so-called - `drive letter' prefix, define this to compute the length of that - prefix, including the colon.]) - - AH_VERBATIM(ISSLASH, - [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR -# define ISSLASH(C) ((C) == '/' || (C) == '\\') -#else -# define ISSLASH(C) ((C) == '/') -#endif]) - - AC_DEFINE_UNQUOTED([FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR], - $ac_fs_backslash_is_file_name_separator, - [Define if the backslash character may also serve as a file name - component separator.]) - - AC_DEFINE_UNQUOTED([FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE], - $ac_fs_drive_letter_can_be_relative, - [Define if a drive letter prefix denotes a relative path if it is - not followed by a file name component separator.]) - ]) diff --git a/m4/rmdir.m4 b/m4/rmdir.m4 index 16402a581..41705a1ee 100644 --- a/m4/rmdir.m4 +++ b/m4/rmdir.m4 @@ -1,4 +1,4 @@ -# rmdir.m4 serial 9 +# rmdir.m4 serial 10 dnl Copyright (C) 2002, 2005, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,7 +6,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_RMDIR], [ - AC_REQUIRE([gl_AC_DOS]) AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl Detect cygwin 1.5.x bug. AC_CACHE_CHECK([whether rmdir works], [gl_cv_func_rmdir_works], diff --git a/m4/stat.m4 b/m4/stat.m4 index 4883fe25e..27f82d5a9 100644 --- a/m4/stat.m4 +++ b/m4/stat.m4 @@ -1,4 +1,4 @@ -# serial 6 +# serial 7 # Copyright (C) 2009-2011 Free Software Foundation, Inc. # @@ -9,7 +9,6 @@ AC_DEFUN([gl_FUNC_STAT], [ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_REQUIRE([gl_AC_DOS]) AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) AC_CHECK_FUNCS_ONCE([lstat]) dnl mingw is the only known platform where stat(".") and stat("./") differ diff --git a/m4/unlink.m4 b/m4/unlink.m4 index 6d5d3d3f4..a49a69287 100644 --- a/m4/unlink.m4 +++ b/m4/unlink.m4 @@ -1,4 +1,4 @@ -# unlink.m4 serial 6 +# unlink.m4 serial 7 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -6,7 +6,6 @@ dnl with or without modifications, as long as this notice is preserved. AC_DEFUN([gl_FUNC_UNLINK], [ - AC_REQUIRE([gl_AC_DOS]) AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) AC_REQUIRE([AC_CANONICAL_HOST]) dnl Detect FreeBSD 7.2, AIX 7.1, Solaris 9 bug. diff --git a/modules/dirname-lgpl b/modules/dirname-lgpl index 38f779abd..b380ff98e 100644 --- a/modules/dirname-lgpl +++ b/modules/dirname-lgpl @@ -7,9 +7,9 @@ lib/dirname-lgpl.c lib/basename-lgpl.c lib/stripslash.c m4/dirname.m4 -m4/dos.m4 Depends-on: +dosname double-slash-root malloc-posix stdbool diff --git a/modules/dosname b/modules/dosname new file mode 100644 index 000000000..0e8703cb3 --- /dev/null +++ b/modules/dosname @@ -0,0 +1,20 @@ +Description: +Macros for porting to systems with DOS-style file names. + +Files: +lib/dosname.h + +Depends-on: + +configure.ac: + +Makefile.am: + +Include: +"dosname.h" + +License: +LGPLv2+ + +Maintainer: +Eric Blake, Paul Eggert, Jim Meyering diff --git a/modules/lstat b/modules/lstat index e4eabb5ac..e53ac7ed7 100644 --- a/modules/lstat +++ b/modules/lstat @@ -6,6 +6,7 @@ lib/lstat.c m4/lstat.m4 Depends-on: +dosname stat sys_stat diff --git a/modules/openat b/modules/openat index 37cae80fa..35917c59d 100644 --- a/modules/openat +++ b/modules/openat @@ -16,7 +16,7 @@ m4/openat.m4 m4/mode_t.m4 Depends-on: -dirname-lgpl +dosname errno extensions fchdir diff --git a/modules/rmdir b/modules/rmdir index d047e4c5a..eaa5a6854 100644 --- a/modules/rmdir +++ b/modules/rmdir @@ -3,10 +3,10 @@ rmdir() function: delete a directory. Files: lib/rmdir.c -m4/dos.m4 m4/rmdir.m4 Depends-on: +dosname sys_stat unistd diff --git a/modules/savewd b/modules/savewd index 41f51e31d..1f3237284 100644 --- a/modules/savewd +++ b/modules/savewd @@ -7,7 +7,7 @@ lib/savewd.c m4/savewd.m4 Depends-on: -dirname-lgpl +dosname errno exit fchdir diff --git a/modules/stat b/modules/stat index 1ad5e908e..744aa7a0c 100644 --- a/modules/stat +++ b/modules/stat @@ -3,10 +3,10 @@ stat() function: query file information Files: lib/stat.c -m4/dos.m4 m4/stat.m4 Depends-on: +dosname stdbool sys_stat diff --git a/modules/unlink b/modules/unlink index 4c8c64958..a27a308dc 100644 --- a/modules/unlink +++ b/modules/unlink @@ -3,10 +3,10 @@ unlink() function: remove a file. Files: lib/unlink.c -m4/dos.m4 m4/unlink.m4 Depends-on: +dosname lstat unistd diff --git a/tests/test-dirname.c b/tests/test-dirname.c index bda1ee874..1ddf229b5 100644 --- a/tests/test-dirname.c +++ b/tests/test-dirname.c @@ -54,7 +54,7 @@ static struct test tests[] = { {"", ".", "", "", "", false, false}, {".", ".", ".", ".", ".", false, false}, {"..", ".", "..", "..", "..", false, false}, -#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR +#if ISSLASH ('\\') {"a\\", ".", "a\\", "a\\", "a", true, false}, {"a\\b", "a", "b", "b", "a\\b", false, false}, {"\\", "\\", "", "\\", "\\", false, true}, @@ -75,7 +75,7 @@ static struct test tests[] = { {"//\\", "/", "\\", "\\", "//\\", false, true}, # endif #endif -#if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX +#if ISSLASH ('\\') # if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE {"c:", "c:", "", "c:", "c:", false, false}, {"c:/", "c:/", "", "c:/", "c:/", false, true}, @@ -105,7 +105,7 @@ static struct test tests[] = { {"a/b:c", "a", "b:c", "./b:c","a/b:c",false, false}, {"a/b:c/", "a", "b:c/", "./b:c/","a/b:c",true, false}, # endif -#else /* ! FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX */ +#else /* ! ISSLASH ('\\') */ {"c:", ".", "c:", "c:", "c:", false, false}, {"c:/", ".", "c:/", "c:/", "c:", true, false}, {"c://", ".", "c://", "c:/", "c:", true, false}, -- 2.11.0