summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-03-16 05:42:53 +0000
committerJim Meyering <jim@meyering.net>1996-03-16 05:42:53 +0000
commitb14b621029cb103e21d5f6af471776dec180341c (patch)
tree4115bc84e6815fe2be349c462f9591bfc902cf9c /src
parent8825dba4e717d1cd8dad4cf7d195b713e30c89f9 (diff)
downloadcoreutils-b14b621029cb103e21d5f6af471776dec180341c.tar.xz
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.
Diffstat (limited to 'src')
-rw-r--r--src/basename.c43
1 files changed, 21 insertions, 22 deletions
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';
-}