summaryrefslogtreecommitdiff
path: root/basename.c
diff options
context:
space:
mode:
authorErik Andersen2000-04-13 01:18:56 +0000
committerErik Andersen2000-04-13 01:18:56 +0000
commit61677feff7f549a48267c2c0c50a7420de6e2599 (patch)
tree1ea829e51641647a35c552e289f4482ab9f5db27 /basename.c
parent62dc17a3b100496a5c7433cc598d674e244cb6f8 (diff)
downloadbusybox-61677feff7f549a48267c2c0c50a7420de6e2599.zip
busybox-61677feff7f549a48267c2c0c50a7420de6e2599.tar.gz
Upates to include copyright 2000 to everything
-Erik
Diffstat (limited to 'basename.c')
-rw-r--r--basename.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/basename.c b/basename.c
index 1db885f..06e2766 100644
--- a/basename.c
+++ b/basename.c
@@ -2,7 +2,7 @@
/*
* Mini basename implementation for busybox
*
- * Copyright (C) 1999 by Lineo, inc.
+ * Copyright (C) 1999,2000 by Lineo, inc.
* Written by Erik Andersen <andersen@lineo.com>, <andersee@debian.org>
*
* This program is free software; you can redistribute it and/or modify
@@ -26,13 +26,16 @@
extern int basename_main(int argc, char **argv)
{
- char* s;
+ char* s, *s1;
if ((argc < 2) || (**(argv + 1) == '-')) {
usage("basename [file ...]\n");
}
argv++;
+ s1=*argv+strlen(*argv)-1;
+ if (*s1 == '/')
+ *s1 = '\0';
s = strrchr(*argv, '/');
printf("%s\n", (s)? s + 1 : *argv);
exit(TRUE);