From b14b621029cb103e21d5f6af471776dec180341c Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 16 Mar 1996 05:42:53 +0000 Subject: Remove __P-protected prototype for basename. Reported by François Pinard. (remove_suffix): Move to precede use. Remove prototype. Declare formal parameter SUFFIX to be const. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/basename.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'src/basename.c') diff --git a/src/basename.c b/src/basename.c index 6d2ea21f1..9a9ca0cbd 100644 --- a/src/basename.c +++ b/src/basename.c @@ -34,10 +34,8 @@ #include "long-options.h" #include "error.h" -char *basename __P ((char *)); -void strip_trailing_slashes (); - -static void remove_suffix __P ((register char *name, register char *suffix)); +extern char *basename (); +extern void strip_trailing_slashes (); /* The name this program was run with. */ char *program_name; @@ -66,6 +64,25 @@ If specified, also remove a trailing SUFFIX.\n\ exit (status); } +/* Remove SUFFIX from the end of NAME if it is there, unless NAME + consists entirely of SUFFIX. */ + +static void +remove_suffix (char *name, const char *suffix) +{ + char *np; + const char *sp; + + np = name + strlen (name); + sp = suffix + strlen (suffix); + + while (np > name && sp > suffix) + if (*--np != *--sp) + return; + if (np > name) + *np = '\0'; +} + void main (int argc, char **argv) { @@ -95,21 +112,3 @@ main (int argc, char **argv) exit (0); } - -/* Remove SUFFIX from the end of NAME if it is there, unless NAME - consists entirely of SUFFIX. */ - -static void -remove_suffix (register char *name, register char *suffix) -{ - register char *np, *sp; - - np = name + strlen (name); - sp = suffix + strlen (suffix); - - while (np > name && sp > suffix) - if (*--np != *--sp) - return; - if (np > name) - *np = '\0'; -} -- cgit v1.2.3-54-g00ecf