Include "dirname.h".
authorJim Meyering <jim@meyering.net>
Sat, 12 May 2001 16:05:12 +0000 (16:05 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 12 May 2001 16:05:12 +0000 (16:05 +0000)
(base_name, strip_trailing_slashes): Remove decls; now in dirname.h.
(main): Use base_len instead of strip_trailing_slashes to strip
trailing slashes.

src/basename.c

index 5ac75a5..2c7f8d7 100644 (file)
@@ -1,5 +1,5 @@
 /* basename -- strip directory and suffix from filenames
-   Copyright (C) 1990-1997, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1990-1997, 1999, 2000, 2001 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,6 +31,7 @@
 
 #include "system.h"
 #include "long-options.h"
+#include "dirname.h"
 #include "error.h"
 #include "closeout.h"
 
@@ -39,9 +40,6 @@
 
 #define AUTHORS "FIXME unknown"
 
-char *base_name ();
-void strip_trailing_slashes ();
-
 /* The name this program was run with. */
 char *program_name;
 
@@ -118,9 +116,8 @@ main (int argc, char **argv)
       usage (1);
     }
 
-  strip_trailing_slashes (argv[1]);
-
   name = base_name (argv[1]);
+  name[base_len (name)] = '\0';
 
   if (argc == 3)
     remove_suffix (name, argv[2]);