[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-gnulib] gnulib dirname module merge from coreutils
From: |
Paul Eggert |
Subject: |
[Bug-gnulib] gnulib dirname module merge from coreutils |
Date: |
Thu, 05 Aug 2004 21:24:38 -0700 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
I installed this. The main user-visible change is that names
liek "FILESYSTEM_PREFIX_LEN" are changed to "FILE_SYSTEM_PREFIX_LEN";
this was part of a terminology consitency cleanup of coreutils.
2004-08-05 Paul Eggert <address@hidden>
* lib/dirname.h: Include <stdbool.h>.
(FILE_SYSTEM_PREFIX_LEN): Renamed from FILESYSTEM_PREFIX_LEN,
for consistency with POSIX terminology. All uses changed.
(IS_ABSOLUTE_FILE_NAME, IS_RELATIVE_FILE_NAME): New macros.
(strip_trailing_slashes): Use bool for booleans.
* lib/stripslash.c (strip_trailing_slashes): Likewise.
* m4/dos.m4 (gl_AC_DOS): filesystem -> file system renaming.
FILESYSTEM_PREFIX_LEN ->
FILE_SYSTEM_PREFIX_LEN.
FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX ->
FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX.
FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR ->
FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR.
Index: lib/dirname.h
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/dirname.h,v
retrieving revision 1.8
diff -p -u -r1.8 dirname.h
--- lib/dirname.h 18 Jun 2003 05:52:19 -0000 1.8
+++ lib/dirname.h 6 Aug 2004 04:15:43 -0000
@@ -1,6 +1,6 @@
/* Take file names apart into directory and base names.
- Copyright (C) 1998, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2003, 2004 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
@@ -19,6 +19,7 @@
#ifndef DIRNAME_H_
# define DIRNAME_H_ 1
+# include <stdbool.h>
# include <stddef.h>
# ifndef DIRECTORY_SEPARATOR
@@ -29,15 +30,18 @@
# define ISSLASH(C) ((C) == DIRECTORY_SEPARATOR)
# endif
-# ifndef FILESYSTEM_PREFIX_LEN
-# define FILESYSTEM_PREFIX_LEN(Filename) 0
+# ifndef FILE_SYSTEM_PREFIX_LEN
+# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
# endif
+# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
+# define IS_RELATIVE_FILE_NAME(F) (! IS_ABSOLUTE_FILE_NAME (F))
+
char *base_name (char const *path);
char *dir_name (char const *path);
size_t base_len (char const *path);
size_t dir_len (char const *path);
-int strip_trailing_slashes (char *path);
+bool strip_trailing_slashes (char *path);
#endif /* not DIRNAME_H_ */
Index: lib/dirname.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/dirname.c,v
retrieving revision 1.31
diff -p -u -r1.31 dirname.c
--- lib/dirname.c 8 Sep 2003 23:08:47 -0000 1.31
+++ lib/dirname.c 6 Aug 2004 04:15:43 -0000
@@ -1,5 +1,7 @@
/* dirname.c -- return all but the last element in a path
- Copyright (C) 1990, 1998, 2000, 2001, 2003 Free Software Foundation, Inc.
+
+ Copyright (C) 1990, 1998, 2000, 2001, 2003, 2004 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
@@ -30,7 +32,7 @@
size_t
dir_len (char const *path)
{
- size_t prefix_length = FILESYSTEM_PREFIX_LEN (path);
+ size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (path);
size_t length;
/* Strip the basename and any redundant slashes before it. */
@@ -51,7 +53,7 @@ char *
dir_name (char const *path)
{
size_t length = dir_len (path);
- int append_dot = (length == FILESYSTEM_PREFIX_LEN (path));
+ bool append_dot = (length == FILE_SYSTEM_PREFIX_LEN (path));
char *newpath = xmalloc (length + append_dot + 1);
memcpy (newpath, path, length);
if (append_dot)
Index: lib/basename.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/basename.c,v
retrieving revision 1.22
diff -p -u -r1.22 basename.c
--- lib/basename.c 8 Sep 2003 23:08:47 -0000 1.22
+++ lib/basename.c 6 Aug 2004 04:15:43 -0000
@@ -1,7 +1,7 @@
/* basename.c -- return the last element in a path
- Copyright (C) 1990, 1998, 1999, 2000, 2001, 2003 Free Software
- Foundation, Inc.
+ Copyright (C) 1990, 1998, 1999, 2000, 2001, 2003, 2004 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
@@ -35,7 +35,7 @@
char *
base_name (char const *name)
{
- char const *base = name + FILESYSTEM_PREFIX_LEN (name);
+ char const *base = name + FILE_SYSTEM_PREFIX_LEN (name);
char const *p;
for (p = base; *p; p++)
Index: lib/stripslash.c
===================================================================
RCS file: /cvsroot/gnulib/gnulib/lib/stripslash.c,v
retrieving revision 1.11
diff -p -u -r1.11 stripslash.c
--- lib/stripslash.c 8 Sep 2003 23:08:47 -0000 1.11
+++ lib/stripslash.c 6 Aug 2004 04:15:43 -0000
@@ -1,5 +1,5 @@
/* stripslash.c -- remove redundant trailing slashes from a file name
- Copyright (C) 1990, 2001, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1990, 2001, 2003, 2004 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
@@ -22,18 +22,18 @@
#include "dirname.h"
/* Remove trailing slashes from PATH.
- Return nonzero if a trailing slash was removed.
+ Return true if a trailing slash was removed.
This is useful when using filename completion from a shell that
adds a "/" after directory names (such as tcsh and bash), because
the Unix rename and rmdir system calls return an "Invalid argument" error
when given a path that ends in "/" (except for the root directory). */
-int
+bool
strip_trailing_slashes (char *path)
{
char *base = base_name (path);
char *base_lim = base + base_len (base);
- int had_slash = *base_lim;
+ bool had_slash = (*base_lim != '\0');
*base_lim = '\0';
return had_slash;
}
Index: m4/dos.m4
===================================================================
RCS file: /cvsroot/gnulib/gnulib/m4/dos.m4,v
retrieving revision 1.10
diff -p -u -r1.10 dos.m4
--- m4/dos.m4 27 Apr 2004 22:11:37 -0000 1.10
+++ m4/dos.m4 6 Aug 2004 04:15:43 -0000
@@ -1,4 +1,4 @@
-#serial 7
+#serial 8
# Define some macros required for proper operation of code in lib/*.c
# on MSDOS/Windows systems.
@@ -42,28 +42,28 @@ neither MSDOS nor Windows
ac_fs_backslash_is_file_name_separator=0
fi
- AH_VERBATIM(FILESYSTEM_PREFIX_LEN,
- [#if FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
-# define FILESYSTEM_PREFIX_LEN(Filename) \
+ AH_VERBATIM(FILE_SYSTEM_PREFIX_LEN,
+ [#if FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX
+# define FILE_SYSTEM_PREFIX_LEN(Filename) \
((Filename)[0] && (Filename)[1] == ':' ? 2 : 0)
#else
-# define FILESYSTEM_PREFIX_LEN(Filename) 0
+# define FILE_SYSTEM_PREFIX_LEN(Filename) 0
#endif])
- AC_DEFINE_UNQUOTED([FILESYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX],
+ 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 FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
+ [#if FILE_SYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR
# define ISSLASH(C) ((C) == '/' || (C) == '\\')
#else
# define ISSLASH(C) ((C) == '/')
#endif])
- AC_DEFINE_UNQUOTED([FILESYSTEM_BACKSLASH_IS_FILE_NAME_SEPARATOR],
+ 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.])
- [Bug-gnulib] gnulib dirname module merge from coreutils,
Paul Eggert <=