bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

basename/dirname // patch resubmit


From: Eric Blake
Subject: basename/dirname // patch resubmit
Date: Sat, 11 Mar 2006 08:24:35 -0700
User-agent: Thunderbird 1.5 (Windows/20051201)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've spent some time updating this patch from November to work with CVS
head.  The patch was favorably reviewed, but not applied earlier because
a) the ACL patch was ahead in the queue (now applied), and b) my paperwork
wasn't complete (completed in January).  The last comment related to this
patch was from Paul, when I mentioned that gl_DOUBLE_SLASH_ROOT would be
useful for fixing root-dev-ino and rpl_getcwd:

> > a cross-compile must be pessimistic and assume that // might be
> > distinct from /
>
> Since the only platforms we know of that do that are Cygwin and Apollo
> DomainOS, can't we fall back on a system-specific #ifdef for this?
> It'd be a shame to penalize every cross-compile because of Cygwin.
> (Apollo is long-since dead, so we don't need to worry about it.)

So I broke gl_DOUBLE_SLASH_ROOT into its own file (to be reused in a later
submission for the root-dev-ino/rpl_getcwd patch), and changed the
cross-compilation logic to assume that // is the same as / except on
cygwin, with a note that any new system that takes advantage of the POSIX
wording about // being implementation defined would need to modify that check.

Other than that, this patch is pretty much like it was in November - I
added last_component() that takes over the previous semantics of
base_name(), then changed the semantics of base_name to malloc its result.
 All callers are updated, and basename(1)/dirname(1) now obey POSIX
requirements about preserving // when the implementation defines // to be
separate from /.

ChangeLog:
2006-03-11  Eric Blake  <address@hidden>

        * tests/misc/dirname: New file.
        * tests/basename/Makefile.am: Delete.
        * tests/basename/basic: Move to...
        * tests/misc/basename: ... this new file.  Add some tests,
        including fixed behavior for //.
        * tests/misc/Makefile.am (TESTS): Sort.  Add basename, dirname.
        * tests/Makefile.am (SUBDIRS): Remove basename.
        * configure.ac (AC_CONFIG_FILES): Remove tests/basename.

        Improvements to dirname/basename handling on platforms like
        cygwin with distinct // and with drive letters.
        * NEWS: Document new behavior.
        * src/basename.c (main): Don't strip suffix from file system
        roots.
        * src/cp.c (target_directory_operand): Use new last_component.
        (ASSIGN_BASENAME_STRDUPA): Likewise.  Reduce time spent
        traversing the string.
        * src/dircolors.c (guess_shell_syntax): Use new last_component.
        * src/install.c (target_directory_operand, install_file_in_dir):
        Likewise.
        * src/ln.c (target_directory_operand, main): Likewise.
        * src/ls.c (basename_is_dot_or_dotdot): Likewise.
        * src/mv.c (target_directory_operand, movefile): Likewise.
        * src/remove.c (rm_1): Likewise.
        * src/shred.c (wipename): Likewise.
        * src/split.c (next_file_name): Likewise.
        * src/su.c (log_su, run_shell): Likewise.

doc/ChangeLog:
2006-03-11  Eric Blake  <address@hidden>

        * coreutils.texi (basename invocation, dirname invocation):
        Improve documentation to match recent // patches.

m4/ChangeLog:
2006-03-11  Eric Blake  <address@hidden>

        * double-slash-root.m4: New file, provides gl_DOUBLE_SLASH_ROOT.
        * dirname.m4 (gl_DIRNAME): Use gl_DOUBLE_SLASH_ROOT.
        * dos.m4 (FILE_SYSTEM_PREFIX_LEN): Move from here to dirname.h.
        (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE): New define.

lib/ChangeLog:
2006-03-11  Eric Blake  <address@hidden>

        * backupfile.c (check_extension, numbered_backup): Adjust to
        changed semantics in dirname module.
        * filenamecat.c (file_name_concat): Ditto.
        * same.c (same_name): Ditto.

2006-03-11  Eric Blake  <address@hidden>,
            Paul Eggert  <address@hidden>

        * dirname.h (FILE_SYSTEM_PREFIX_LEN): Move here from dos.m4.
        [FILE_SYSTEM_ACCEPTS_DRIVE_LETTER_PREFIX]: Don't treat 1: as a
        drive prefix.
        (IS_ABSOLUTE_FILE_NAME): Treat all drive letters as absolute on
        platforms like cygwin with FILE_SYSTEM_DRIVE_PREFIX_IS_ABSOLUTE.
        (last_component): New method.
        * dirname.c (dir_len): Determine when drive letters need a
        subsequent slash.  Preserve // when it is special.
        (dir_name): Don't append dot when drive letter is absolute.
        [TEST_DIRNAME]: Move into a full-blown gnulib test.
        * basename.c (base_name): New semantics - malloc the result.
        Preserve // when it is special.  Preserve relative files that look
        like drive letters.
        (base_len): Preserve // when it is special.
        (last_component): New method, similar to old base_name semantics.
        * stripslash.c (strip_trailing_slashes): Use last_component, not
        base_name.  Strip redundant slashes from ///.

- --
Life is short - so eat dessert first!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.1 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEEuuy84KuGfSFAYARAgbOAJ9697zgC2CeUQrkBK5CbPznTqeYZgCfVjJ4
WEIL/SgdDlfb2PXS3kkTuPA=
=Y5iz
-----END PGP SIGNATURE-----
Index: NEWS
===================================================================
RCS file: /sources/coreutils/coreutils/NEWS,v
retrieving revision 1.364
diff -u -p -r1.364 NEWS
--- NEWS        10 Mar 2006 21:44:30 -0000      1.364
+++ NEWS        11 Mar 2006 14:33:12 -0000
@@ -12,6 +12,9 @@ GNU coreutils NEWS                      
 
 ** Changes in behavior
 
+  basename and dirname now treat // as different from / on platforms
+  where the two are distinct.
+
   df now considers "none" and "proc" file systems to be dummies and
   therefore does not normally display them.  Also, inaccessible file
   systems (which can be caused by shadowed mount points or by chrooted
Index: configure.ac
===================================================================
RCS file: /sources/coreutils/coreutils/configure.ac,v
retrieving revision 1.76
diff -u -p -r1.76 configure.ac
--- configure.ac        3 Feb 2006 14:40:35 -0000       1.76
+++ configure.ac        11 Mar 2006 14:33:12 -0000
@@ -261,7 +261,6 @@ AC_CONFIG_FILES(
   po/Makefile.in
   src/Makefile
   tests/Makefile
-  tests/basename/Makefile
   tests/chgrp/Makefile
   tests/chmod/Makefile
   tests/chown/Makefile
Index: doc/coreutils.texi
===================================================================
RCS file: /sources/coreutils/coreutils/doc/coreutils.texi,v
retrieving revision 1.316
diff -u -p -r1.316 coreutils.texi
--- doc/coreutils.texi  6 Mar 2006 07:21:40 -0000       1.316
+++ doc/coreutils.texi  11 Mar 2006 14:33:16 -0000
@@ -10588,8 +10588,21 @@ basename @var{name} address@hidden
 @end example
 
 If @var{suffix} is specified and is identical to the end of @var{name},
-it is removed from @var{name} as well.  @command{basename} prints the
-result on standard output.
+it is removed from @var{name} as well.  Note that since trailing slashes
+are removed prior to suffix matching, @var{suffix} will do nothing if it
+contains slashes.  @command{basename} prints the result on standard
+output.
+
+Together, @command{basename} and @command{dirname} are designed such
+that if @samp{ls "$name"} succeeds, then the command sequence @samp{cd
+"$(dirname "$name")"; ls "$(basename "$name")"} will too.  This works
+for everything except filenames containing a trailing newline.
+
address@hidden allows the implementation to define the results if
address@hidden is empty or @samp{//}.  In the former case, @acronym{GNU}
address@hidden returns the empty string.  In the latter case, the
+result is @samp{//} on platforms where @var{//} is distinct from
address@hidden/}, and @samp{/} on platforms where there is no difference.
 
 The only options are @option{--help} and @option{--version}.  @xref{Common
 options}.  Options must precede operands.
@@ -10625,6 +10638,16 @@ dirname @var{name}
 If @var{name} is a single component, @command{dirname} prints @samp{.}
 (meaning the current directory).
 
+Together, @command{basename} and @command{dirname} are designed such
+that if @samp{ls "$name"} succeeds, then the command sequence @samp{cd
+"$(dirname "$name")"; ls "$(basename "$name")"} will too.  This works
+for everything except filenames containing a trailing newline.
+
address@hidden allows the implementation to define the results if
address@hidden is @samp{//}.  With @acronym{GNU} @command{dirname}, the
+result is @samp{//} on platforms where @var{//} is distinct from
address@hidden/}, and @samp{/} on platforms where there is no difference.
+
 The only options are @option{--help} and @option{--version}.  @xref{Common
 options}.
 
Index: lib/backupfile.c
===================================================================
RCS file: /sources/coreutils/coreutils/lib/backupfile.c,v
retrieving revision 1.49
diff -u -p -r1.49 backupfile.c
--- lib/backupfile.c    22 Sep 2005 06:05:39 -0000      1.49
+++ lib/backupfile.c    11 Mar 2006 14:33:16 -0000
@@ -1,7 +1,8 @@
 /* backupfile.c -- make Emacs style backup file names
 
    Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 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
@@ -115,7 +116,7 @@ char const *simple_backup_suffix = "~";
 static void
 check_extension (char *file, size_t filelen, char e)
 {
-  char *base = base_name (file);
+  char *base = last_component (file);
   size_t baselen = base_len (base);
   size_t baselen_max = HAVE_LONG_FILE_NAMES ? 255 : NAME_MAX_MINIMUM;
 
@@ -202,7 +203,7 @@ numbered_backup (char **buffer, size_t b
   struct dirent *dp;
   char *buf = *buffer;
   size_t versionlenmax = 1;
-  char *base = base_name (buf);
+  char *base = last_component (buf);
   size_t base_offset = base - buf;
   size_t baselen = base_len (base);
 
Index: lib/basename.c
===================================================================
RCS file: /sources/coreutils/coreutils/lib/basename.c,v
retrieving revision 1.26
diff -u -p -r1.26 basename.c
--- lib/basename.c      22 Sep 2005 06:05:39 -0000      1.26
+++ lib/basename.c      11 Mar 2006 14:33:16 -0000
@@ -1,6 +1,6 @@
 /* basename.c -- return the last element in a file name
 
-   Copyright (C) 1990, 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free
+   Copyright (C) 1990, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -22,58 +22,110 @@
 #endif
 
 #include "dirname.h"
-#include <string.h>
 
-/* In general, we can't use the builtin `basename' function if available,
-   since it has different meanings in different environments.
-   In some environments the builtin `basename' modifies its argument.
+#include <string.h>
+#include "xalloc.h"
+#include "xstrndup.h"
 
-   Return the address of the last file name component of NAME.  If
-   NAME has no file name components because it is all slashes, return
-   NAME if it is empty, the address of its last slash otherwise.  */
+/* Return the address of the last file name component of NAME.  If
+   NAME has no relative file name components because it is a file
+   system root, return the empty string.  */
 
 char *
-base_name (char const *name)
+last_component (char const *name)
 {
   char const *base = name + FILE_SYSTEM_PREFIX_LEN (name);
   char const *p;
+  bool saw_slash = false;
+
+  while (ISSLASH (*base))
+    base++;
 
   for (p = base; *p; p++)
     {
       if (ISSLASH (*p))
+       saw_slash = true;
+      else if (saw_slash)
        {
-         /* Treat multiple adjacent slashes like a single slash.  */
-         do p++;
-         while (ISSLASH (*p));
-
-         /* If the file name ends in slash, use the trailing slash as
-            the basename if no non-slashes have been found.  */
-         if (! *p)
-           {
-             if (ISSLASH (*base))
-               base = p - 1;
-             break;
-           }
-
-         /* *P is a non-slash preceded by a slash.  */
          base = p;
+         saw_slash = false;
        }
     }
 
   return (char *) base;
 }
 
-/* Return the length of of the basename NAME.  Typically NAME is the
-   value returned by base_name.  Act like strlen (NAME), except omit
-   redundant trailing slashes.  */
+
+/* In general, we can't use the builtin `basename' function if available,
+   since it has different meanings in different environments.
+   In some environments the builtin `basename' modifies its argument.
+
+   Return the last file name component of NAME, allocated with
+   xmalloc.  On systems with drive letters, a leading "./"
+   distinguishes relative names that would otherwise look like a drive
+   letter.  Unlike POSIX basename(), NAME cannot be NULL,
+   base_name("") returns "", and the first trailing slash is not
+   stripped.
+
+   If lstat (NAME) would succeed, then { chdir (dir_name (NAME));
+   lstat (base_name (NAME)); } will access the same file.  Likewise,
+   if the sequence { chdir (dir_name (NAME));
+   rename (base_name (NAME), "foo"); } succeeds, you have renamed NAME
+   to "foo" in the same directory NAME was in.  */
+
+char *
+base_name (char const *name)
+{
+  char const *base = last_component (name);
+  size_t length;
+
+  /* If there is no last component, then name is a file system root or the
+     empty string.  */
+  if (! *base)
+    return xstrndup (name, base_len (name));
+
+  /* Collapse a sequence of trailing slashes into one.  */
+  length = base_len (base);
+  if (ISSLASH (base[length]))
+    length++;
+
+  /* On systems with drive letters, `a/b:c' must return `./b:c' rather
+     than `b:c' to avoid confusion with a drive letter.  On systems
+     with pure POSIX semantics, this is not an issue.  */
+  if (FILE_SYSTEM_PREFIX_LEN (base))
+    {
+      char *p = xmalloc (length + 3);
+      p[0] = '.';
+      p[1] = '/';
+      memcpy (p + 2, base, length);
+      p[length + 2] = '\0';
+      return p;
+    }
+
+  /* Finally, copy the basename.  */
+  return xstrndup (base, length);
+}
+
+/* Return the length of the basename NAME.  Typically NAME is the
+   value returned by base_name or last_component.  Act like strlen
+   (NAME), except omit all trailing slashes.  */
 
 size_t
 base_len (char const *name)
 {
   size_t len;
+  size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name);
 
   for (len = strlen (name);  1 < len && ISSLASH (name[len - 1]);  len--)
     continue;
 
+  if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1
+      && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2])
+    return 2;
+
+  if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len
+      && len == prefix_len && ISSLASH (name[prefix_len]))
+    return prefix_len + 1;
+
   return len;
 }
Index: lib/dirname.c
===================================================================
RCS file: /sources/coreutils/coreutils/lib/dirname.c,v
retrieving revision 1.36
diff -u -p -r1.36 dirname.c
--- lib/dirname.c       22 Sep 2005 06:05:39 -0000      1.36
+++ lib/dirname.c       11 Mar 2006 14:33:16 -0000
@@ -1,6 +1,6 @@
 /* dirname.c -- return all but the last element in a file name
 
-   Copyright (C) 1990, 1998, 2000, 2001, 2003, 2004, 2005 Free Software
+   Copyright (C) 1990, 1998, 2000, 2001, 2003, 2004, 2005, 2006 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -26,96 +26,62 @@
 #include <string.h>
 #include "xalloc.h"
 
-/* Return the length of `dirname (FILE)', or zero if FILE is
-   in the working directory.  Works properly even if
-   there are trailing slashes (by effectively ignoring them).  */
+/* Return the length of the prefix of FILE that will be used by
+   dir_name.  If FILE is in the working directory, this returns zero
+   even though `dir_name (FILE)' will return ".".  Works properly even
+   if there are trailing slashes (by effectively ignoring them).  */
+
 size_t
 dir_len (char const *file)
 {
   size_t prefix_length = FILE_SYSTEM_PREFIX_LEN (file);
   size_t length;
 
+  /* Advance prefix_length beyond important leading slashes.  */
+  prefix_length += (prefix_length != 0
+                   ? (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+                      && ISSLASH (file[prefix_length]))
+                   : (ISSLASH (file[0])
+                      ? ((DOUBLE_SLASH_IS_DISTINCT_ROOT
+                          && ISSLASH (file[1]) && ! ISSLASH (file[2])
+                          ? 2 : 1))
+                      : 0));
+
   /* Strip the basename and any redundant slashes before it.  */
-  for (length = base_name (file) - file;  prefix_length < length;  length--)
+  for (length = last_component (file) - file;
+       prefix_length < length; length--)
     if (! ISSLASH (file[length - 1]))
-      return length;
-
-  /* But don't strip the only slash from "/".  */
-  return prefix_length + ISSLASH (file[prefix_length]);
+      break;
+  return length;
 }
 
-/* Return the leading directories part of FILE,
-   allocated with xmalloc.
-   Works properly even if there are trailing slashes
-   (by effectively ignoring them).  */
+
+/* In general, we can't use the builtin `dirname' function if available,
+   since it has different meanings in different environments.
+   In some environments the builtin `dirname' modifies its argument.
+
+   Return the leading directories part of FILE, allocated with xmalloc.
+   Works properly even if there are trailing slashes (by effectively
+   ignoring them).  Unlike POSIX dirname(), FILE cannot be NULL.
+
+   If lstat (FILE) would succeed, then { chdir (dir_name (FILE));
+   lstat (base_name (FILE)); } will access the same file.  Likewise,
+   if the sequence { chdir (dir_name (FILE));
+   rename (base_name (FILE), "foo"); } succeeds, you have renamed FILE
+   to "foo" in the same directory FILE was in.  */
 
 char *
 dir_name (char const *file)
 {
   size_t length = dir_len (file);
-  bool append_dot = (length == FILE_SYSTEM_PREFIX_LEN (file));
+  bool append_dot = (length == 0
+                    || (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE
+                        && length == FILE_SYSTEM_PREFIX_LEN (file)
+                        && file[2] != '\0' && ! ISSLASH (file[2])));
   char *dir = xmalloc (length + append_dot + 1);
   memcpy (dir, file, length);
   if (append_dot)
     dir[length++] = '.';
-  dir[length] = 0;
+  dir[length] = '\0';
   return dir;
 }
-
-#ifdef TEST_DIRNAME
-/*
-
-Run the test like this (expect no output):
-  gcc -DHAVE_CONFIG_H -DTEST_DIRNAME -I.. -O -Wall \
-     basename.c dirname.c xmalloc.c error.c
-  sed -n '/^BEGIN-DATA$/,/^END-DATA$/p' dirname.c|grep -v DATA|./a.out
-
-If it's been built on a DOS or Windows platforms, run another test like
-this (again, expect no output):
-  sed -n '/^BEGIN-DOS-DATA$/,/^END-DOS-DATA$/p' dirname.c|grep -v DATA|./a.out
-
-BEGIN-DATA
-foo//// .
-bar/foo//// bar
-foo/ .
-/ /
-. .
-a .
-END-DATA
-
-BEGIN-DOS-DATA
-c:///// c:/
-c:/ c:/
-c:/. c:/
-c:foo c:.
-c:foo/bar c:foo
-END-DOS-DATA
-
-*/
-
-# define MAX_BUFF_LEN 1024
-# include <stdio.h>
-
-char *program_name;
-
-int
-main (int argc, char *argv[])
-{
-  char buff[MAX_BUFF_LEN + 1];
-
-  program_name = argv[0];
-
-  buff[MAX_BUFF_LEN] = 0;
-  while (fgets (buff, MAX_BUFF_LEN, stdin) && buff[0])
-    {
-      char file[MAX_BUFF_LEN];
-      char expected_result[MAX_BUFF_LEN];
-      char const *result;
-      sscanf (buff, "%s %s", file, expected_result);
-      result = dir_name (file);
-      if (strcmp (result, expected_result))
-       printf ("%s: got %s, expected %s\n", file, result, expected_result);
-    }
-  return 0;
-}
-#endif
Index: lib/dirname.h
===================================================================
RCS file: /sources/coreutils/coreutils/lib/dirname.h,v
retrieving revision 1.15
diff -u -p -r1.15 dirname.h
--- lib/dirname.h       2 Jun 2005 05:05:29 -0000       1.15
+++ lib/dirname.h       11 Mar 2006 14:33:16 -0000
@@ -1,6 +1,7 @@
 /*  Take file names apart into directory and base names.
 
-    Copyright (C) 1998, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+    Copyright (C) 1998, 2001, 2003, 2004, 2005, 2006 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
@@ -31,16 +32,39 @@
 # endif
 
 # ifndef FILE_SYSTEM_PREFIX_LEN
-#  define FILE_SYSTEM_PREFIX_LEN(File_name) 0
+#  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
 
-# define IS_ABSOLUTE_FILE_NAME(F) ISSLASH ((F)[FILE_SYSTEM_PREFIX_LEN (F)])
+# 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 1
+# 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))
 
 char *base_name (char const *file);
 char *dir_name (char const *file);
 size_t base_len (char const *file);
 size_t dir_len (char const *file);
+char *last_component (char const *file);
 
 bool strip_trailing_slashes (char *file);
 
Index: lib/filenamecat.c
===================================================================
RCS file: /sources/coreutils/coreutils/lib/filenamecat.c,v
retrieving revision 1.2
diff -u -p -r1.2 filenamecat.c
--- lib/filenamecat.c   22 Sep 2005 06:05:39 -0000      1.2
+++ lib/filenamecat.c   11 Mar 2006 14:33:16 -0000
@@ -1,7 +1,7 @@
 /* Concatenate two arbitrary file names.
 
-   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 
Free
-   Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+   2005, 2006 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
@@ -64,7 +64,7 @@ longest_relative_suffix (char const *f)
 char *
 file_name_concat (char const *dir, char const *abase, char **base_in_result)
 {
-  char const *dirbase = base_name (dir);
+  char const *dirbase = last_component (dir);
   size_t dirbaselen = base_len (dirbase);
   size_t dirlen = dirbase - dir + dirbaselen;
   size_t needs_separator = (dirbaselen && ! ISSLASH (dirbase[dirbaselen - 1]));
Index: lib/same.c
===================================================================
RCS file: /sources/coreutils/coreutils/lib/same.c,v
retrieving revision 1.18
diff -u -p -r1.18 same.c
--- lib/same.c  22 Sep 2005 06:05:39 -0000      1.18
+++ lib/same.c  11 Mar 2006 14:33:16 -0000
@@ -1,6 +1,6 @@
 /* Determine whether two file names refer to the same file.
 
-   Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005 Free
+   Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006 Free
    Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -59,8 +59,8 @@ bool
 same_name (const char *source, const char *dest)
 {
   /* Compare the basenames.  */
-  char const *source_basename = base_name (source);
-  char const *dest_basename = base_name (dest);
+  char const *source_basename = last_component (source);
+  char const *dest_basename = last_component (dest);
   size_t source_baselen = base_len (source_basename);
   size_t dest_baselen = base_len (dest_basename);
   bool identical_basenames =
Index: lib/stripslash.c
===================================================================
RCS file: /sources/coreutils/coreutils/lib/stripslash.c,v
retrieving revision 1.15
diff -u -p -r1.15 stripslash.c
--- lib/stripslash.c    22 Sep 2005 06:05:39 -0000      1.15
+++ lib/stripslash.c    11 Mar 2006 14:33:16 -0000
@@ -1,6 +1,7 @@
 /* stripslash.c -- remove redundant trailing slashes from a file name
 
-   Copyright (C) 1990, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright (C) 1990, 2001, 2003, 2004, 2005, 2006 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,19 +23,26 @@
 
 #include "dirname.h"
 
-/* Remove trailing slashes from FILE.
-   Return true if a trailing slash was removed.
-   This is useful when using file name 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 file that ends in "/" (except for the root directory).  */
+/* Remove trailing slashes from FILE.  Return true if a trailing slash
+   was removed.  This is useful when using file name completion from a
+   shell that adds a "/" after directory names (such as tcsh and
+   bash), because on symlinks to directories, several system calls
+   have different semantics according to whether a trailing slash is
+   present.  */
 
 bool
 strip_trailing_slashes (char *file)
 {
-  char *base = base_name (file);
-  char *base_lim = base + base_len (base);
-  bool had_slash = (*base_lim != '\0');
+  char *base = last_component (file);
+  char *base_lim;
+  bool had_slash;
+
+  /* last_component returns "" for file system roots, but we need to turn
+     `///' into `/'.  */
+  if (! *base)
+    base = file;
+  base_lim = base + base_len (base);
+  had_slash = (*base_lim != '\0');
   *base_lim = '\0';
   return had_slash;
 }
Index: m4/dirname.m4
===================================================================
RCS file: /sources/coreutils/coreutils/m4/dirname.m4,v
retrieving revision 1.7
diff -u -p -r1.7 dirname.m4
--- m4/dirname.m4       29 Jan 2005 00:16:39 -0000      1.7
+++ m4/dirname.m4       11 Mar 2006 14:33:16 -0000
@@ -1,5 +1,5 @@
-# dirname.m4 serial 5
-dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+# dirname.m4 serial 6   -*- autoconf -*-
+dnl Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -11,6 +11,7 @@ AC_DEFUN([gl_DIRNAME],
 
   dnl Prerequisites of lib/dirname.h.
   AC_REQUIRE([gl_AC_DOS])
+  AC_REQUIRE([gl_DOUBLE_SLASH_ROOT])
 
   dnl No prerequisites of lib/basename.c, lib/dirname.c, lib/stripslash.c.
 ])
Index: m4/dos.m4
===================================================================
RCS file: /sources/coreutils/coreutils/m4/dos.m4,v
retrieving revision 1.13
diff -u -p -r1.13 dos.m4
--- m4/dos.m4   23 Jan 2005 09:07:57 -0000      1.13
+++ m4/dos.m4   11 Mar 2006 14:33:16 -0000
@@ -1,9 +1,9 @@
-#serial 9
+#dos.m4 serial 10   -*- autoconf -*-
 
 # Define some macros required for proper operation of code in lib/*.c
 # on MSDOS/Windows systems.
 
-# Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2004, 2005, 2006 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.
@@ -14,30 +14,38 @@ AC_DEFUN([gl_AC_DOS],
   [
     AC_CACHE_CHECK([whether system is Windows or MSDOS], [ac_cv_win_or_dos],
       [
-        AC_TRY_COMPILE([],
-        [#if !defined _WIN32 && !defined __WIN32__ && !defined __MSDOS__ && 
!defined __CYGWIN__
+       AC_TRY_COMPILE([],
+       [#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])
+       [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_TRY_COMPILE([],
+         [#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
 
-    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 FILE_SYSTEM_PREFIX_LEN(Filename) 0
-#endif])
-
     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
@@ -55,4 +63,9 @@ neither MSDOS nor Windows
       $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.])
   ])
Index: m4/double-slash-root.m4
===================================================================
RCS file: m4/double-slash-root.m4
diff -N m4/double-slash-root.m4
--- m4/double-slash-root.m4     1 Jan 1970 00:00:00 -0000
+++ m4/double-slash-root.m4     11 Mar 2006 14:33:16 -0000
@@ -0,0 +1,43 @@
+# double-slash-root.m4 serial 1   -*- autoconf -*-
+dnl Copyright (C) 2006 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_DOUBLE_SLASH_ROOT],
+[
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_CACHE_CHECK([whether // is distinct from /], [ac_cv_double_slash_root],
+    [ if test x"$cross_compiling" = xyes ; then
+       # When cross-compiling, there is no way to tell whether // is special
+       # short of a list of hosts.  However, the only known hosts to date
+       # that have a distinct // are Apollo DomainOS (too old to port to)
+       # and Cygwin.  If anyone knows of another system for which // has
+       # special semantics and is distinct from /, please report it to
+       # <address@hidden>.
+       case $host in
+         *-cygwin)
+           ac_cv_double_slash_root=yes ;;
+         *)
+           # Be optimistic and assume that / and // are the same when we
+           # don't know.
+           ac_cv_double_slash_root='unknown, assuming no' ;;
+       esac
+      else
+       set x `ls -di / //`
+       if test $[2] = $[4]; then
+         ac_cv_double_slash_root=no
+       else
+         ac_cv_double_slash_root=yes
+       fi
+      fi])
+  if test x"$ac_cv_double_slash_root" = xyes; then
+    ac_double_slash_root=1
+  else
+    ac_double_slash_root=0
+  fi
+
+  AC_DEFINE_UNQUOTED([DOUBLE_SLASH_IS_DISTINCT_ROOT],
+   $ac_double_slash_root,
+   [Define to 1 if // is a file system root distinct from /.])
+])
Index: src/basename.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/basename.c,v
retrieving revision 1.63
diff -u -p -r1.63 basename.c
--- src/basename.c      2 Jun 2005 05:17:24 -0000       1.63
+++ src/basename.c      11 Mar 2006 14:33:16 -0000
@@ -1,5 +1,5 @@
 /* basename -- strip directory and suffix from file names
-   Copyright (C) 1990-1997, 1999-2005 Free Software Foundation, Inc.
+   Copyright (C) 1990-1997, 1999-2006 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
@@ -126,12 +126,20 @@ main (int argc, char **argv)
     }
 
   name = base_name (argv[optind]);
-  name[base_len (name)] = '\0';
+  strip_trailing_slashes (name);
 
-  if (argc == optind + 2)
+  /* Per POSIX, `basename // /' must return `//' on platforms with
+     distinct //.  On platforms with drive letters, this generalizes
+     to making `basename c: :' return `c:'.  This rule is captured by
+     skipping suffix stripping if base_name returned an absolute path
+     or a drive letter (only possible if name is a file-system
+     root).  */
+  if (argc == optind + 2 && IS_RELATIVE_FILE_NAME (name)
+      && ! FILE_SYSTEM_PREFIX_LEN (name))
     remove_suffix (name, argv[optind + 1]);
 
   puts (name);
+  free (name);
 
   exit (EXIT_SUCCESS);
 }
Index: src/cp.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/cp.c,v
retrieving revision 1.219
diff -u -p -r1.219 cp.c
--- src/cp.c    6 Feb 2006 07:39:37 -0000       1.219
+++ src/cp.c    11 Mar 2006 14:33:16 -0000
@@ -42,8 +42,8 @@
     {                                                  \
       char *tmp_abns_;                                 \
       ASSIGN_STRDUPA (tmp_abns_, (File_name));         \
+      Dest = last_component (tmp_abns_);               \
       strip_trailing_slashes (tmp_abns_);              \
-      Dest = base_name (tmp_abns_);                    \
     }                                                  \
   while (0)
 
@@ -519,7 +519,7 @@ make_dir_parents_private (char const *co
 static bool
 target_directory_operand (char const *file, struct stat *st, bool *new_dst)
 {
-  char const *b = base_name (file);
+  char const *b = last_component (file);
   size_t blen = strlen (b);
   bool looks_like_a_dir = (blen == 0 || ISSLASH (b[blen - 1]));
   int err = (stat (file, st) == 0 ? 0 : errno);
Index: src/dircolors.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/dircolors.c,v
retrieving revision 1.97
diff -u -p -r1.97 dircolors.c
--- src/dircolors.c     24 Oct 2005 10:39:46 -0000      1.97
+++ src/dircolors.c     11 Mar 2006 14:33:16 -0000
@@ -1,5 +1,5 @@
 /* dircolors - output commands to set the LS_COLOR environment variable
-   Copyright (C) 1996-2005 Free Software Foundation, Inc.
+   Copyright (C) 1996-2006 Free Software Foundation, Inc.
    Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000 H. Peter Anvin
 
    This program is free software; you can redistribute it and/or modify
@@ -137,7 +137,7 @@ guess_shell_syntax (void)
   if (shell == NULL || *shell == '\0')
     return SHELL_SYNTAX_UNKNOWN;
 
-  shell = base_name (shell);
+  shell = last_component (shell);
 
   if (STREQ (shell, "csh") || STREQ (shell, "tcsh"))
     return SHELL_SYNTAX_C;
Index: src/install.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/install.c,v
retrieving revision 1.191
diff -u -p -r1.191 install.c
--- src/install.c       18 Feb 2006 07:23:05 -0000      1.191
+++ src/install.c       11 Mar 2006 14:33:16 -0000
@@ -167,7 +167,7 @@ cp_option_init (struct cp_options *x)
 static bool
 target_directory_operand (char const *file)
 {
-  char const *b = base_name (file);
+  char const *b = last_component (file);
   size_t blen = strlen (b);
   bool looks_like_a_dir = (blen == 0 || ISSLASH (b[blen - 1]));
   struct stat st;
@@ -463,7 +463,7 @@ static bool
 install_file_in_dir (const char *from, const char *to_dir,
                     const struct cp_options *x)
 {
-  const char *from_base = base_name (from);
+  const char *from_base = last_component (from);
   char *to = file_name_concat (to_dir, from_base, NULL);
   bool ret = install_file_in_file (from, to, x);
   free (to);
Index: src/ln.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/ln.c,v
retrieving revision 1.155
diff -u -p -r1.155 ln.c
--- src/ln.c    16 Nov 2005 22:32:45 -0000      1.155
+++ src/ln.c    11 Mar 2006 14:33:16 -0000
@@ -1,5 +1,5 @@
 /* `ln' program to create links between files.
-   Copyright (C) 86, 89, 90, 91, 1995-2005 Free Software Foundation, Inc.
+   Copyright (C) 1986, 1989-1991, 1995-2006 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
@@ -113,7 +113,7 @@ static struct option const long_options[
 static bool
 target_directory_operand (char const *file)
 {
-  char const *b = base_name (file);
+  char const *b = last_component (file);
   size_t blen = strlen (b);
   bool looks_like_a_dir = (blen == 0 || ISSLASH (b[blen - 1]));
   struct stat st;
@@ -525,7 +525,8 @@ main (int argc, char **argv)
       for (i = 0; i < n_files; ++i)
        {
          char *dest_base;
-         char *dest = file_name_concat (target_directory, base_name (file[i]),
+         char *dest = file_name_concat (target_directory,
+                                        last_component (file[i]),
                                         &dest_base);
          strip_trailing_slashes (dest_base);
          ok &= do_link (file[i], dest);
Index: src/ls.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/ls.c,v
retrieving revision 1.407
diff -u -p -r1.407 ls.c
--- src/ls.c    6 Mar 2006 07:02:39 -0000       1.407
+++ src/ls.c    11 Mar 2006 14:33:17 -0000
@@ -2794,7 +2794,7 @@ make_link_name (char const *name, char c
 static bool
 basename_is_dot_or_dotdot (const char *name)
 {
-  char const *base = base_name (name);
+  char const *base = last_component (name);
   return DOT_OR_DOTDOT (base);
 }
 
Index: src/mv.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/mv.c,v
retrieving revision 1.173
diff -u -p -r1.173 mv.c
--- src/mv.c    6 Feb 2006 07:39:53 -0000       1.173
+++ src/mv.c    11 Mar 2006 14:33:17 -0000
@@ -148,7 +148,7 @@ cp_option_init (struct cp_options *x)
 static bool
 target_directory_operand (char const *file)
 {
-  char const *b = base_name (file);
+  char const *b = last_component (file);
   size_t blen = strlen (b);
   bool looks_like_a_dir = (blen == 0 || ISSLASH (b[blen - 1]));
   struct stat st;
@@ -266,7 +266,7 @@ movefile (char *source, char *dest, bool
   if (dest_is_dir)
     {
       /* Treat DEST as a directory; build the full filename.  */
-      char const *src_basename = base_name (source);
+      char const *src_basename = last_component (source);
       char *new_dest = file_name_concat (dest, src_basename, NULL);
       strip_trailing_slashes (new_dest);
       ok = do_move (source, new_dest, x);
Index: src/remove.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/remove.c,v
retrieving revision 1.147
diff -u -p -r1.147 remove.c
--- src/remove.c        10 Mar 2006 21:47:34 -0000      1.147
+++ src/remove.c        11 Mar 2006 14:33:18 -0000
@@ -1338,7 +1338,7 @@ static enum RM_status
 rm_1 (Dirstack_state *ds, char const *filename,
       struct rm_options const *x, int *cwd_errno)
 {
-  char const *base = base_name (filename);
+  char const *base = last_component (filename);
   if (DOT_OR_DOTDOT (base))
     {
       error (0, 0, _("cannot remove `.' or `..'"));
Index: src/shred.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/shred.c,v
retrieving revision 1.122
diff -u -p -r1.122 shred.c
--- src/shred.c 27 Dec 2005 08:00:12 -0000      1.122
+++ src/shred.c 11 Mar 2006 14:33:18 -0000
@@ -1,6 +1,6 @@
 /* shred.c - overwrite files and devices to make it harder to recover data
 
-   Copyright (C) 1999-2005 Free Software Foundation, Inc.
+   Copyright (C) 1999-2006 Free Software Foundation, Inc.
    Copyright (C) 1997, 1998, 1999 Colin Plumb.
 
    This program is free software; you can redistribute it and/or modify
@@ -1024,7 +1024,7 @@ static bool
 wipename (char *oldname, char const *qoldname, struct Options const *flags)
 {
   char *newname = xstrdup (oldname);
-  char *base = base_name (newname);
+  char *base = last_component (newname);
   size_t len = base_len (base);
   char *dir = dir_name (newname);
   char *qdir = xstrdup (quotearg_colon (dir));
Index: src/split.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/split.c,v
retrieving revision 1.112
diff -u -p -r1.112 split.c
--- src/split.c 11 Jul 2005 18:24:42 -0000      1.112
+++ src/split.c 11 Mar 2006 14:33:18 -0000
@@ -1,5 +1,5 @@
 /* split.c -- split a file into pieces.
-   Copyright (C) 88, 91, 1995-2005 Free Software Foundation, Inc.
+   Copyright (C) 1988, 1991, 1995-2006 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
@@ -171,7 +171,7 @@ next_file_name (void)
       {
        char *dir = dir_name (outfile);
        long name_max = pathconf (dir, _PC_NAME_MAX);
-       if (0 <= name_max && name_max < base_len (base_name (outfile)))
+       if (0 <= name_max && name_max < base_len (last_component (outfile)))
          error (EXIT_FAILURE, ENAMETOOLONG, "%s", outfile);
        free (dir);
       }
Index: src/su.c
===================================================================
RCS file: /sources/coreutils/coreutils/src/su.c,v
retrieving revision 1.89
diff -u -p -r1.89 su.c
--- src/su.c    23 Aug 2005 15:09:13 -0000      1.89
+++ src/su.c    11 Mar 2006 14:33:18 -0000
@@ -1,5 +1,5 @@
 /* su for GNU.  Run a shell with substitute user and group IDs.
-   Copyright (C) 1992-2005 Free Software Foundation, Inc.
+   Copyright (C) 1992-2006 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
@@ -219,7 +219,7 @@ log_su (struct passwd const *pw, bool su
   if (!tty)
     tty = "none";
   /* 4.2BSD openlog doesn't have the third parameter.  */
-  openlog (base_name (program_name), 0
+  openlog (last_component (program_name), 0
 # ifdef LOG_AUTH
           , LOG_AUTH
 # endif
@@ -350,14 +350,14 @@ run_shell (char const *shell, char const
       char *arg0;
       char *shell_basename;
 
-      shell_basename = base_name (shell);
+      shell_basename = last_component (shell);
       arg0 = xmalloc (strlen (shell_basename) + 2);
       arg0[0] = '-';
       strcpy (arg0 + 1, shell_basename);
       args[0] = arg0;
     }
   else
-    args[0] = base_name (shell);
+    args[0] = last_component (shell);
   if (fast_startup)
     args[argno++] = "-f";
   if (command)
Index: tests/Makefile.am
===================================================================
RCS file: /sources/coreutils/coreutils/tests/Makefile.am,v
retrieving revision 1.27
diff -u -p -r1.27 Makefile.am
--- tests/Makefile.am   24 Jan 2006 22:54:49 -0000      1.27
+++ tests/Makefile.am   11 Mar 2006 14:33:18 -0000
@@ -22,10 +22,10 @@ EXTRA_DIST = \
 ## Some people feel that there are too many already.
 ## Put new tests in misc/.
 SUBDIRS = \
-  basename chgrp chmod chown cp cut dd dircolors du expr factor \
-  fmt head install join ln ls ls-2 md5sum misc mkdir mv od pr readlink \
-  rm rmdir seq sha1sum shred sort stty sum tac tail tail-2 tee test \
-  touch tr tsort unexpand uniq wc
+  chgrp chmod chown cp cut dd dircolors du expr factor fmt head \
+  install join ln ls ls-2 md5sum misc mkdir mv od pr readlink rm rmdir \
+  seq sha1sum shred sort stty sum tac tail tail-2 tee test touch tr \
+  tsort unexpand uniq wc
 ## N O T E :: Please do not add new directories.
 
 .PHONY: check-root
Index: tests/basename/.cvsignore
===================================================================
RCS file: tests/basename/.cvsignore
diff -N tests/basename/.cvsignore
--- tests/basename/.cvsignore   8 Mar 1999 14:42:45 -0000       1.1
+++ tests/basename/.cvsignore   1 Jan 1970 00:00:00 -0000
@@ -1,8 +0,0 @@
-*.I
-*.E
-*.X
-*.O
-*-tests
-build-script
-Makefile
-mk-script
Index: tests/basename/Makefile.am
===================================================================
RCS file: tests/basename/Makefile.am
diff -N tests/basename/Makefile.am
--- tests/basename/Makefile.am  5 Apr 2003 18:03:47 -0000       1.4
+++ tests/basename/Makefile.am  1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-## Process this file with automake to produce Makefile.in -*-Makefile-*-.
-AUTOMAKE_OPTIONS = 1.4 gnits
-
-TESTS = basic
-EXTRA_DIST = $(TESTS)
-TESTS_ENVIRONMENT = \
-  top_srcdir=$(top_srcdir) \
-  srcdir=$(srcdir) \
-  PERL="$(PERL)" \
-  PATH="`pwd`/../../src$(PATH_SEPARATOR)$$PATH" \
-  PROG=basename
Index: tests/basename/Makefile.in
===================================================================
RCS file: tests/basename/Makefile.in
diff -N tests/basename/Makefile.in
--- tests/basename/Makefile.in  3 Dec 2005 23:20:03 -0000       1.148
+++ tests/basename/Makefile.in  1 Jan 1970 00:00:00 -0000
@@ -1,534 +0,0 @@
-# Makefile.in generated by automake 1.9.6 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
-# This Makefile.in 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.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
address@hidden@
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ../..
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = tests/basename
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/acl.m4 $(top_srcdir)/m4/afs.m4 \
-       $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/allocsa.m4 \
-       $(top_srcdir)/m4/argmatch.m4 $(top_srcdir)/m4/assert.m4 \
-       $(top_srcdir)/m4/atexit.m4 $(top_srcdir)/m4/autobuild.m4 \
-       $(top_srcdir)/m4/backupfile.m4 $(top_srcdir)/m4/basename.m4 \
-       $(top_srcdir)/m4/bison.m4 $(top_srcdir)/m4/boottime.m4 \
-       $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/calloc.m4 \
-       $(top_srcdir)/m4/canon-host.m4 \
-       $(top_srcdir)/m4/canonicalize.m4 \
-       $(top_srcdir)/m4/chdir-long.m4 $(top_srcdir)/m4/check-decl.m4 \
-       $(top_srcdir)/m4/chown.m4 $(top_srcdir)/m4/clock_time.m4 \
-       $(top_srcdir)/m4/cloexec.m4 $(top_srcdir)/m4/closeout.m4 \
-       $(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/cycle-check.m4 \
-       $(top_srcdir)/m4/d-ino.m4 $(top_srcdir)/m4/d-type.m4 \
-       $(top_srcdir)/m4/diacrit.m4 $(top_srcdir)/m4/dirfd.m4 \
-       $(top_srcdir)/m4/dirname.m4 $(top_srcdir)/m4/dos.m4 \
-       $(top_srcdir)/m4/dup2.m4 $(top_srcdir)/m4/eealloc.m4 \
-       $(top_srcdir)/m4/eoverflow.m4 $(top_srcdir)/m4/error.m4 \
-       $(top_srcdir)/m4/euidaccess-stat.m4 \
-       $(top_srcdir)/m4/euidaccess.m4 $(top_srcdir)/m4/exclude.m4 \
-       $(top_srcdir)/m4/exitfail.m4 $(top_srcdir)/m4/extensions.m4 \
-       $(top_srcdir)/m4/fcntl-safer.m4 $(top_srcdir)/m4/fd-reopen.m4 \
-       $(top_srcdir)/m4/file-type.m4 $(top_srcdir)/m4/fileblocks.m4 \
-       $(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/filenamecat.m4 \
-       $(top_srcdir)/m4/fnmatch.m4 $(top_srcdir)/m4/fpending.m4 \
-       $(top_srcdir)/m4/free.m4 $(top_srcdir)/m4/fstypename.m4 \
-       $(top_srcdir)/m4/fsusage.m4 $(top_srcdir)/m4/ftruncate.m4 \
-       $(top_srcdir)/m4/fts.m4 $(top_srcdir)/m4/getaddrinfo.m4 \
-       $(top_srcdir)/m4/getcwd-path-max.m4 $(top_srcdir)/m4/getcwd.m4 \
-       $(top_srcdir)/m4/getdate.m4 $(top_srcdir)/m4/getdelim.m4 \
-       $(top_srcdir)/m4/getgroups.m4 $(top_srcdir)/m4/gethostname.m4 \
-       $(top_srcdir)/m4/gethrxtime.m4 $(top_srcdir)/m4/getline.m4 \
-       $(top_srcdir)/m4/getndelim2.m4 $(top_srcdir)/m4/getopt.m4 \
-       $(top_srcdir)/m4/getpagesize.m4 $(top_srcdir)/m4/getpass.m4 \
-       $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/gettime.m4 \
-       $(top_srcdir)/m4/gettimeofday.m4 \
-       $(top_srcdir)/m4/getugroups.m4 \
-       $(top_srcdir)/m4/getusershell.m4 $(top_srcdir)/m4/glibc21.m4 \
-       $(top_srcdir)/m4/group-member.m4 \
-       $(top_srcdir)/m4/hard-locale.m4 $(top_srcdir)/m4/hash-pjw.m4 \
-       $(top_srcdir)/m4/hash.m4 $(top_srcdir)/m4/host-os.m4 \
-       $(top_srcdir)/m4/human.m4 $(top_srcdir)/m4/iconv.m4 \
-       $(top_srcdir)/m4/idcache.m4 $(top_srcdir)/m4/intmax_t.m4 \
-       $(top_srcdir)/m4/inttostr.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
-       $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \
-       $(top_srcdir)/m4/jm-macros.m4 $(top_srcdir)/m4/jm-winsz1.m4 \
-       $(top_srcdir)/m4/jm-winsz2.m4 $(top_srcdir)/m4/lchown.m4 \
-       $(top_srcdir)/m4/lib-check.m4 $(top_srcdir)/m4/lib-ld.m4 \
-       $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
-       $(top_srcdir)/m4/linebuffer.m4 $(top_srcdir)/m4/link-follow.m4 \
-       $(top_srcdir)/m4/localcharset.m4 \
-       $(top_srcdir)/m4/long-options.m4 \
-       $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \
-       $(top_srcdir)/m4/ls-mntd-fs.m4 $(top_srcdir)/m4/lstat.m4 \
-       $(top_srcdir)/m4/mbchar.m4 $(top_srcdir)/m4/mbiter.m4 \
-       $(top_srcdir)/m4/mbrtowc.m4 $(top_srcdir)/m4/mbstate_t.m4 \
-       $(top_srcdir)/m4/mbswidth.m4 $(top_srcdir)/m4/md5.m4 \
-       $(top_srcdir)/m4/memcasecmp.m4 $(top_srcdir)/m4/memchr.m4 \
-       $(top_srcdir)/m4/memcmp.m4 $(top_srcdir)/m4/memcoll.m4 \
-       $(top_srcdir)/m4/memcpy.m4 $(top_srcdir)/m4/memmove.m4 \
-       $(top_srcdir)/m4/mempcpy.m4 $(top_srcdir)/m4/memrchr.m4 \
-       $(top_srcdir)/m4/memset.m4 $(top_srcdir)/m4/mkdir-p.m4 \
-       $(top_srcdir)/m4/mkdir-slash.m4 $(top_srcdir)/m4/mkstemp.m4 \
-       $(top_srcdir)/m4/mktime.m4 $(top_srcdir)/m4/modechange.m4 \
-       $(top_srcdir)/m4/mountlist.m4 $(top_srcdir)/m4/nanosleep.m4 \
-       $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/obstack.m4 \
-       $(top_srcdir)/m4/onceonly_2_57.m4 $(top_srcdir)/m4/openat.m4 \
-       $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/perl.m4 \
-       $(top_srcdir)/m4/physmem.m4 $(top_srcdir)/m4/po.m4 \
-       $(top_srcdir)/m4/posixtm.m4 $(top_srcdir)/m4/posixver.m4 \
-       $(top_srcdir)/m4/prereq.m4 $(top_srcdir)/m4/progtest.m4 \
-       $(top_srcdir)/m4/putenv.m4 $(top_srcdir)/m4/quote.m4 \
-       $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/readlink.m4 \
-       $(top_srcdir)/m4/readtokens.m4 $(top_srcdir)/m4/readutmp.m4 \
-       $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/rename.m4 \
-       $(top_srcdir)/m4/restrict.m4 $(top_srcdir)/m4/rmdir-errno.m4 \
-       $(top_srcdir)/m4/rmdir.m4 $(top_srcdir)/m4/root-dev-ino.m4 \
-       $(top_srcdir)/m4/rpmatch.m4 $(top_srcdir)/m4/safe-read.m4 \
-       $(top_srcdir)/m4/safe-write.m4 $(top_srcdir)/m4/same.m4 \
-       $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/savedir.m4 \
-       $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/settime.m4 \
-       $(top_srcdir)/m4/sha1.m4 $(top_srcdir)/m4/sha256.m4 \
-       $(top_srcdir)/m4/sha512.m4 $(top_srcdir)/m4/sig2str.m4 \
-       $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/socklen.m4 \
-       $(top_srcdir)/m4/sockpfaf.m4 $(top_srcdir)/m4/ssize_t.m4 \
-       $(top_srcdir)/m4/st_dm_mode.m4 $(top_srcdir)/m4/stat-macros.m4 \
-       $(top_srcdir)/m4/stat-prog.m4 $(top_srcdir)/m4/stat-time.m4 \
-       $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h.m4 \
-       $(top_srcdir)/m4/stdio-safer.m4 \
-       $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \
-       $(top_srcdir)/m4/strcase.m4 $(top_srcdir)/m4/strcspn.m4 \
-       $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strftime.m4 \
-       $(top_srcdir)/m4/stripslash.m4 $(top_srcdir)/m4/strndup.m4 \
-       $(top_srcdir)/m4/strnlen.m4 $(top_srcdir)/m4/strnumcmp.m4 \
-       $(top_srcdir)/m4/strpbrk.m4 $(top_srcdir)/m4/strstr.m4 \
-       $(top_srcdir)/m4/strtod.m4 $(top_srcdir)/m4/strtoimax.m4 \
-       $(top_srcdir)/m4/strtol.m4 $(top_srcdir)/m4/strtoll.m4 \
-       $(top_srcdir)/m4/strtoul.m4 $(top_srcdir)/m4/strtoull.m4 \
-       $(top_srcdir)/m4/strtoumax.m4 $(top_srcdir)/m4/strverscmp.m4 \
-       $(top_srcdir)/m4/timespec.m4 $(top_srcdir)/m4/tm_gmtoff.m4 \
-       $(top_srcdir)/m4/tzset.m4 $(top_srcdir)/m4/uint32_t.m4 \
-       $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/uintptr_t.m4 \
-       $(top_srcdir)/m4/ullong_max.m4 $(top_srcdir)/m4/ulonglong.m4 \
-       $(top_srcdir)/m4/unicodeio.m4 $(top_srcdir)/m4/unistd-safer.m4 \
-       $(top_srcdir)/m4/unlink-busy.m4 $(top_srcdir)/m4/unlinkdir.m4 \
-       $(top_srcdir)/m4/unlocked-io.m4 $(top_srcdir)/m4/uptime.m4 \
-       $(top_srcdir)/m4/userspec.m4 $(top_srcdir)/m4/utimbuf.m4 \
-       $(top_srcdir)/m4/utime.m4 $(top_srcdir)/m4/utimecmp.m4 \
-       $(top_srcdir)/m4/utimens.m4 $(top_srcdir)/m4/utimes-null.m4 \
-       $(top_srcdir)/m4/utimes.m4 $(top_srcdir)/m4/vasnprintf.m4 \
-       $(top_srcdir)/m4/vasprintf.m4 $(top_srcdir)/m4/version-etc.m4 \
-       $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
-       $(top_srcdir)/m4/xalloc.m4 $(top_srcdir)/m4/xfts.m4 \
-       $(top_srcdir)/m4/xgetcwd.m4 $(top_srcdir)/m4/xnanosleep.m4 \
-       $(top_srcdir)/m4/xreadlink.m4 $(top_srcdir)/m4/xstrtod.m4 \
-       $(top_srcdir)/m4/xstrtoimax.m4 $(top_srcdir)/m4/xstrtol.m4 \
-       $(top_srcdir)/m4/xstrtoumax.m4 $(top_srcdir)/m4/yesno.m4 \
-       $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-ALLOCA_H = @ALLOCA_H@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
-AMTAR = @AMTAR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFAULT_POSIX2_VERSION = @DEFAULT_POSIX2_VERSION@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DF_PROG = @DF_PROG@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EOVERFLOW = @EOVERFLOW@
-EXEEXT = @EXEEXT@
-FNMATCH_H = @FNMATCH_H@
-GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
-GETOPT_H = @GETOPT_H@
-GLIBC21 = @GLIBC21@
-GMSGFMT = @GMSGFMT@
-GNU_PACKAGE = @GNU_PACKAGE@
-GREP = @GREP@
-HELP2MAN = @HELP2MAN@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-INTLLIBS = @INTLLIBS@
-INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@
-KMEM_GROUP = @KMEM_GROUP@
-LDFLAGS = @LDFLAGS@
-LIBICONV = @LIBICONV@
-LIBINTL = @LIBINTL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
-LIB_CRYPT = @LIB_CRYPT@
-LIB_EACCESS = @LIB_EACCESS@
-LIB_FDATASYNC = @LIB_FDATASYNC@
-LIB_GETHRXTIME = @LIB_GETHRXTIME@
-LIB_NANOSLEEP = @LIB_NANOSLEEP@
-LN_S = @LN_S@
-LTLIBICONV = @LTLIBICONV@
-LTLIBINTL = @LTLIBINTL@
-LTLIBOBJS = @LTLIBOBJS@
-MAKEINFO = @MAKEINFO@
-MAN = @MAN@
-MKINSTALLDIRS = @MKINSTALLDIRS@
-MSGFMT = @MSGFMT@
-MSGMERGE = @MSGMERGE@
-NEED_SETGID = @NEED_SETGID@
-OBJEXT = @OBJEXT@
-OPTIONAL_BIN_PROGS = @OPTIONAL_BIN_PROGS@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PERL = @PERL@
-POSUB = @POSUB@
-POW_LIB = @POW_LIB@
-RANLIB = @RANLIB@
-SEQ_LIBM = @SEQ_LIBM@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STDBOOL_H = @STDBOOL_H@
-STRIP = @STRIP@
-U = @U@
-USE_NLS = @USE_NLS@
-VERSION = @VERSION@
-XGETTEXT = @XGETTEXT@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_RANLIB = @ac_ct_RANLIB@
-ac_ct_STRIP = @ac_ct_STRIP@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-AUTOMAKE_OPTIONS = 1.4 gnits
-TESTS = basic
-EXTRA_DIST = $(TESTS)
-TESTS_ENVIRONMENT = \
-  top_srcdir=$(top_srcdir) \
-  srcdir=$(srcdir) \
-  PERL="$(PERL)" \
-  PATH="`pwd`/../../src$(PATH_SEPARATOR)$$PATH" \
-  PROG=basename
-
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
-               && exit 0; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits  
tests/basename/Makefile'; \
-       cd $(top_srcdir) && \
-         $(AUTOMAKE) --gnits  tests/basename/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 
$(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ 
$(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure 
$(CONFIG_STATUS_DEPENDENCIES)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure:  $(am__configure_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
-       cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-uninstall-info-am:
-tags: TAGS
-TAGS:
-
-ctags: CTAGS
-CTAGS:
-
-
-check-TESTS: $(TESTS)
-       @failed=0; all=0; xfail=0; xpass=0; skip=0; \
-       srcdir=$(srcdir); export srcdir; \
-       list='$(TESTS)'; \
-       if test -n "$$list"; then \
-         for tst in $$list; do \
-           if test -f ./$$tst; then dir=./; \
-           elif test -f $$tst; then dir=; \
-           else dir="$(srcdir)/"; fi; \
-           if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
-             all=`expr $$all + 1`; \
-             case " $(XFAIL_TESTS) " in \
-             *" $$tst "*) \
-               xpass=`expr $$xpass + 1`; \
-               failed=`expr $$failed + 1`; \
-               echo "XPASS: $$tst"; \
-             ;; \
-             *) \
-               echo "PASS: $$tst"; \
-             ;; \
-             esac; \
-           elif test $$? -ne 77; then \
-             all=`expr $$all + 1`; \
-             case " $(XFAIL_TESTS) " in \
-             *" $$tst "*) \
-               xfail=`expr $$xfail + 1`; \
-               echo "XFAIL: $$tst"; \
-             ;; \
-             *) \
-               failed=`expr $$failed + 1`; \
-               echo "FAIL: $$tst"; \
-             ;; \
-             esac; \
-           else \
-             skip=`expr $$skip + 1`; \
-             echo "SKIP: $$tst"; \
-           fi; \
-         done; \
-         if test "$$failed" -eq 0; then \
-           if test "$$xfail" -eq 0; then \
-             banner="All $$all tests passed"; \
-           else \
-             banner="All $$all tests behaved as expected ($$xfail expected 
failures)"; \
-           fi; \
-         else \
-           if test "$$xpass" -eq 0; then \
-             banner="$$failed of $$all tests failed"; \
-           else \
-             banner="$$failed of $$all tests did not behave as expected 
($$xpass unexpected passes)"; \
-           fi; \
-         fi; \
-         dashes="$$banner"; \
-         skipped=""; \
-         if test "$$skip" -ne 0; then \
-           skipped="($$skip tests were not run)"; \
-           test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
-             dashes="$$skipped"; \
-         fi; \
-         report=""; \
-         if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
-           report="Please report to $(PACKAGE_BUGREPORT)"; \
-           test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
-             dashes="$$report"; \
-         fi; \
-         dashes=`echo "$$dashes" | sed s/./=/g`; \
-         echo "$$dashes"; \
-         echo "$$banner"; \
-         test -z "$$skipped" || echo "$$skipped"; \
-         test -z "$$report" || echo "$$report"; \
-         echo "$$dashes"; \
-         test "$$failed" -eq 0; \
-       else :; fi
-
-distdir: $(DISTFILES)
-       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-       list='$(DISTFILES)'; for file in $$list; do \
-         case $$file in \
-           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-           $(top_srcdir)/*) file=`echo "$$file" | sed 
"s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-         esac; \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-           dir="/$$dir"; \
-           $(mkdir_p) "$(distdir)$$dir"; \
-         else \
-           dir=''; \
-         fi; \
-         if test -d $$d/$$file; then \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
-           fi; \
-           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
-         else \
-           test -f $(distdir)/$$file \
-           || cp -p $$d/$$file $(distdir)/$$file \
-           || exit 1; \
-         fi; \
-       done
-check-am: all-am
-       $(MAKE) $(AM_MAKEFLAGS) check-TESTS
-check: check-am
-all-am: Makefile
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
-       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-         `test -z '$(STRIP)' || \
-           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic mostlyclean-am
-
-distclean: distclean-am
-       -rm -f Makefile
-distclean-am: clean-am distclean-generic
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-exec-am:
-
-install-info: install-info-am
-
-install-man:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-generic
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am: uninstall-info-am
-
-.PHONY: all all-am check check-TESTS check-am clean clean-generic \
-       distclean distclean-generic distdir dvi dvi-am html html-am \
-       info info-am install install-am install-data install-data-am \
-       install-exec install-exec-am install-info install-info-am \
-       install-man install-strip installcheck installcheck-am \
-       installdirs maintainer-clean maintainer-clean-generic \
-       mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
-       uninstall-am uninstall-info-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
Index: tests/basename/basic
===================================================================
RCS file: tests/basename/basic
diff -N tests/basename/basic
--- tests/basename/basic        20 Apr 2005 07:54:54 -0000      1.6
+++ tests/basename/basic        1 Jan 1970 00:00:00 -0000
@@ -1,66 +0,0 @@
-#!/bin/sh
-# -*-perl-*-
-
-: ${PERL=perl}
-: ${srcdir=.}
-
-$PERL -e 1 > /dev/null 2>&1 || {
-  echo 1>&2 "$0: configure didn't find a usable version of Perl," \
-    "so can't run this test"
-  exit 77
-}
-
-d=$srcdir/..
-exec $PERL -w -I$d -MCoreutils -- - << \EOF
-require 5.003;
-use strict;
-
-(my $program_name = $0) =~ s|.*/||;
-
-# Turn off localisation of executable's ouput.
address@hidden(LANGUAGE LANG LC_ALL)} = ('C') x 3;
-
-my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
-
-my @Tests =
-    (
-     ['fail-1', {ERR => "$prog: missing operand\n"
-       . "Try `$prog --help' for more information.\n"}, {EXIT => '1'}],
-     ['fail-2', qw(a b c), {ERR => "$prog: extra operand `c'\n"
-       . "Try `$prog --help' for more information.\n"}, {EXIT => '1'}],
-
-     ['a', qw(d/f),        {OUT => 'f'}],
-     ['b', qw(/d/f),       {OUT => 'f'}],
-     ['c', qw(d/f/),       {OUT => 'f'}],
-     ['d', qw(d/f//),      {OUT => 'f'}],
-     ['e', qw(f),          {OUT => 'f'}],
-     ['f', qw(/),          {OUT => '/'}],
-     ['g', qw(//),         {OUT => '/'}],
-     ['h', qw(///),        {OUT => '/'}],
-     ['i', qw(///a///),    {OUT => 'a'}],
-     ['1', qw(f.s .s),     {OUT => 'f'}],
-     ['2', qw(fs s),       {OUT => 'f'}],
-     ['3', qw(fs fs),      {OUT => 'fs'}],
-     ['4', qw(fs fs),      {OUT => 'fs'}],
-     ['5', qw(dir/file.suf .suf),      {OUT => 'file'}],
-    );
-
-# Append a newline to end of each expected `OUT' string.
-my $t;
-foreach $t (@Tests)
-  {
-    my $arg1 = $t->[1];
-    my $e;
-    foreach $e (@$t)
-      {
-       $e->{OUT} = "$e->{OUT}\n"
-         if ref $e eq 'HASH' and exists $e->{OUT};
-      }
-  }
-
-my $save_temps = $ENV{SAVE_TEMPS};
-my $verbose = $ENV{VERBOSE};
-
-my $fail = run_tests ($program_name, $prog, address@hidden, $save_temps, 
$verbose);
-exit $fail;
-EOF
Index: tests/misc/Makefile.am
===================================================================
RCS file: /sources/coreutils/coreutils/tests/misc/Makefile.am,v
retrieving revision 1.36
diff -u -p -r1.36 Makefile.am
--- tests/misc/Makefile.am      27 Feb 2006 13:38:42 -0000      1.36
+++ tests/misc/Makefile.am      11 Mar 2006 14:33:18 -0000
@@ -13,27 +13,38 @@ TESTS_ENVIRONMENT = \
 
 TESTS = \
   base64 \
-  test \
-  mknod \
-  stat-printf \
-  stat-fmt \
-  sort-rand \
-  sha224sum \
-  sha256sum \
-  sha384sum \
-  sha512sum \
-  date \
-  tac-continue \
+  basename \
   close-stdout \
-  pwd \
+  csplit \
+  date \
   date-sec \
-  paste-no-nl \
+  dirname \
   expand \
+  false \
   fold \
-  nohup \
+  head-c \
   head-elide-tail \
-  split-fail \
-  false \
-  tty-eof \
+  head-pos \
+  mknod \
+  nice \
+  nl \
+  nohup \
+  paste-no-nl \
+  pathchk1 \
+  printf \
   printf-hex \
-  nl split-l printf split-a head-pos sort head-c csplit nice pathchk1
+  pwd \
+  sha224sum \
+  sha256sum \
+  sha384sum \
+  sha512sum \
+  sort \
+  sort-rand \
+  split-a \
+  split-fail \
+  split-l \
+  stat-fmt \
+  stat-printf \
+  tac-continue \
+  test \
+  tty-eof
Index: tests/misc/basename
===================================================================
RCS file: tests/misc/basename
diff -N tests/misc/basename
--- tests/misc/basename 1 Jan 1970 00:00:00 -0000
+++ tests/misc/basename 11 Mar 2006 14:33:18 -0000
@@ -0,0 +1,78 @@
+#!/bin/sh
+# -*-perl-*-
+
+: ${PERL=perl}
+: ${srcdir=.}
+
+$PERL -e 1 > /dev/null 2>&1 || {
+  echo 1>&2 "$0: configure didn't find a usable version of Perl," \
+    "so can't run this test"
+  exit 77
+}
+
+d=$srcdir/..
+exec $PERL -w -I$d -MCoreutils -- - << \EOF
+require 5.003;
+use strict;
+use File::stat;
+
+(my $program_name = $0) =~ s|.*/||;
+
+# Turn off localisation of executable's ouput.
address@hidden(LANGUAGE LANG LC_ALL)} = ('C') x 3;
+
+my $stat_single = stat('/');
+my $stat_double = stat('//');
+my $double_slash = ($stat_single->dev == $stat_double->dev
+                   && $stat_single->ino == $stat_double->ino) ? '/' : '//';
+
+my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+
+my @Tests =
+    (
+     ['fail-1', {ERR => "$prog: missing operand\n"
+       . "Try `$prog --help' for more information.\n"}, {EXIT => '1'}],
+     ['fail-2', qw(a b c), {ERR => "$prog: extra operand `c'\n"
+       . "Try `$prog --help' for more information.\n"}, {EXIT => '1'}],
+
+     ['a', qw(d/f),        {OUT => 'f'}],
+     ['b', qw(/d/f),       {OUT => 'f'}],
+     ['c', qw(d/f/),       {OUT => 'f'}],
+     ['d', qw(d/f//),      {OUT => 'f'}],
+     ['e', qw(f),          {OUT => 'f'}],
+     ['f', qw(/),          {OUT => '/'}],
+     ['g', qw(//),         {OUT => "$double_slash"}],
+     ['h', qw(///),        {OUT => '/'}],
+     ['i', qw(///a///),    {OUT => 'a'}],
+     ['j', qw(''),         {OUT => ''}],
+     ['1', qw(f.s .s),     {OUT => 'f'}],
+     ['2', qw(fs s),       {OUT => 'f'}],
+     ['3', qw(fs fs),      {OUT => 'fs'}],
+     ['4', qw(fs/ s),      {OUT => 'f'}],
+     ['5', qw(dir/file.suf .suf),      {OUT => 'file'}],
+     ['6', qw(// /),       {OUT => "$double_slash"}],
+     ['7', qw(// //),      {OUT => "$double_slash"}],
+     ['8', qw(fs x),       {OUT => 'fs'}],
+     ['9', qw(fs ''),      {OUT => 'fs'}],
+     ['10', qw(fs/ s/),    {OUT => 'fs'}],
+   );
+
+# Append a newline to end of each expected `OUT' string.
+my $t;
+foreach $t (@Tests)
+  {
+    my $arg1 = $t->[1];
+    my $e;
+    foreach $e (@$t)
+      {
+       $e->{OUT} = "$e->{OUT}\n"
+         if ref $e eq 'HASH' and exists $e->{OUT};
+      }
+  }
+
+my $save_temps = $ENV{SAVE_TEMPS};
+my $verbose = $ENV{VERBOSE};
+
+my $fail = run_tests ($program_name, $prog, address@hidden, $save_temps, 
$verbose);
+exit $fail;
+EOF
Index: tests/misc/dirname
===================================================================
RCS file: tests/misc/dirname
diff -N tests/misc/dirname
--- tests/misc/dirname  1 Jan 1970 00:00:00 -0000
+++ tests/misc/dirname  11 Mar 2006 14:33:18 -0000
@@ -0,0 +1,71 @@
+#!/bin/sh
+# -*-perl-*-
+
+: ${PERL=perl}
+: ${srcdir=.}
+
+$PERL -e 1 > /dev/null 2>&1 || {
+  echo 1>&2 "$0: configure didn't find a usable version of Perl," \
+    "so can't run this test"
+  exit 77
+}
+
+d=$srcdir/..
+exec $PERL -w -I$d -MCoreutils -- - << \EOF
+require 5.003;
+use strict;
+use File::stat;
+
+(my $program_name = $0) =~ s|.*/||;
+
+# Turn off localisation of executable's ouput.
address@hidden(LANGUAGE LANG LC_ALL)} = ('C') x 3;
+
+my $stat_single = stat('/');
+my $stat_double = stat('//');
+my $double_slash = ($stat_single->dev == $stat_double->dev
+                   && $stat_single->ino == $stat_double->ino) ? '/' : '//';
+
+my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n";
+
+my @Tests =
+    (
+     ['fail-1', {ERR => "$prog: missing operand\n"
+       . "Try `$prog --help' for more information.\n"}, {EXIT => '1'}],
+     ['fail-2', qw(a b), {ERR => "$prog: extra operand `b'\n"
+       . "Try `$prog --help' for more information.\n"}, {EXIT => '1'}],
+
+     ['a', qw(d/f),        {OUT => 'd'}],
+     ['b', qw(/d/f),       {OUT => '/d'}],
+     ['c', qw(d/f/),       {OUT => 'd'}],
+     ['d', qw(d/f//),      {OUT => 'd'}],
+     ['e', qw(f),          {OUT => '.'}],
+     ['f', qw(/),          {OUT => '/'}],
+     ['g', qw(//),         {OUT => "$double_slash"}],
+     ['h', qw(///),        {OUT => '/'}],
+     ['i', qw(//a//),      {OUT => "$double_slash"}],
+     ['j', qw(///a///),    {OUT => '/'}],
+     ['k', qw(///a///b),   {OUT => '///a'}],
+     ['l', qw(///a//b/),   {OUT => '///a'}],
+     ['m', qw(''),         {OUT => '.'}],
+    );
+
+# Append a newline to end of each expected `OUT' string.
+my $t;
+foreach $t (@Tests)
+  {
+    my $arg1 = $t->[1];
+    my $e;
+    foreach $e (@$t)
+      {
+       $e->{OUT} = "$e->{OUT}\n"
+         if ref $e eq 'HASH' and exists $e->{OUT};
+      }
+  }
+
+my $save_temps = $ENV{SAVE_TEMPS};
+my $verbose = $ENV{VERBOSE};
+
+my $fail = run_tests ($program_name, $prog, address@hidden, $save_temps, 
$verbose);
+exit $fail;
+EOF

reply via email to

[Prev in Thread] Current Thread [Next in Thread]