summaryrefslogtreecommitdiff
path: root/coreutils/basename.c
diff options
context:
space:
mode:
authorDenys Vlasenko2017-07-21 18:41:46 +0200
committerDenys Vlasenko2017-07-21 18:41:46 +0200
commitfd5e66eb8eb4e39460a6cfde4b10dcab3870f26b (patch)
tree47bfea148a09f17a6ba1ed7c2105103cd07d2dcf /coreutils/basename.c
parent578008a9897b2d64532ed5843807c05fba1f862f (diff)
downloadbusybox-fd5e66eb8eb4e39460a6cfde4b10dcab3870f26b.zip
busybox-fd5e66eb8eb4e39460a6cfde4b10dcab3870f26b.tar.gz
basename: do not use argc
function old new delta basename_main 153 148 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/basename.c')
-rw-r--r--coreutils/basename.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/coreutils/basename.c b/coreutils/basename.c
index 481cdce..566aeeb 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -47,25 +47,24 @@
/* This is a NOFORK applet. Be very careful! */
int basename_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int basename_main(int argc, char **argv)
+int basename_main(int argc UNUSED_PARAM, char **argv)
{
size_t m, n;
char *s;
if (argv[1] && strcmp(argv[1], "--") == 0) {
argv++;
- argc--;
}
-
- if ((unsigned)(argc-2) >= 2) {
+ if (!argv[1])
bb_show_usage();
- }
/* It should strip slash: /abc/def/ -> def */
s = bb_get_last_path_component_strip(*++argv);
m = strlen(s);
if (*++argv) {
+ if (argv[1])
+ bb_show_usage();
n = strlen(*argv);
if ((m > n) && (strcmp(s+m-n, *argv) == 0)) {
m -= n;