basename,dirname,freeramdisk,rx,raidautorun,runsv,chvt: skip "--" argument
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 11 Apr 2011 01:58:30 +0000 (03:58 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 11 Apr 2011 01:58:30 +0000 (03:58 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
coreutils/basename.c
libbb/single_argv.c

index 177e023cd3a3abcf0f7dddde8bc1a96ae897c01e..1f7a13713c5db6c402f0a7779538a97513709520 100644 (file)
@@ -51,6 +51,11 @@ int basename_main(int argc, char **argv)
        size_t m, n;
        char *s;
 
+       if (argv[1] && strcmp(argv[1], "--") == 0) {
+               argv++;
+               argc--;
+       }
+
        if ((unsigned)(argc-2) >= 2) {
                bb_show_usage();
        }
index 85137b40fe625556d6d1276941f36040e0906246..64844ddf8f6dae780b6330404a58134b9232c0ba 100644 (file)
@@ -10,6 +10,8 @@
 
 char* FAST_FUNC single_argv(char **argv)
 {
+       if (argv[1] && strcmp(argv[1], "--") == 0)
+               argv++;
        if (!argv[1] || argv[2])
                bb_show_usage();
        return argv[1];