summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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';
-}