[git commit] basename, dirname, freeramdisk, rx, raidautorun, runsv, chvt: skip "--" argument

Denys Vlasenko vda.linux at googlemail.com
Mon Apr 11 01:58:30 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=c13ee8c0f32fa816e12f1ac0c55a800066dc1560
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 coreutils/basename.c |    5 +++++
 libbb/single_argv.c  |    2 ++
 2 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/coreutils/basename.c b/coreutils/basename.c
index 177e023..1f7a137 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -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();
 	}
diff --git a/libbb/single_argv.c b/libbb/single_argv.c
index 85137b4..64844dd 100644
--- a/libbb/single_argv.c
+++ b/libbb/single_argv.c
@@ -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];
-- 
1.7.3.4



More information about the busybox-cvs mailing list