diff options
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/single_argv.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libbb/single_argv.c b/libbb/single_argv.c index 64844dd..594cb0d 100644 --- a/libbb/single_argv.c +++ b/libbb/single_argv.c @@ -8,11 +8,18 @@ */ #include "libbb.h" -char* FAST_FUNC single_argv(char **argv) +char** FAST_FUNC skip_dash_dash(char **argv) { - if (argv[1] && strcmp(argv[1], "--") == 0) + argv++; + if (argv[0] && argv[0][0] == '-' && argv[0][1] == '-' && argv[0][2] == '\0') argv++; - if (!argv[1] || argv[2]) + return argv; +} + +char* FAST_FUNC single_argv(char **argv) +{ + argv = skip_dash_dash(argv); + if (!argv[0] || argv[1]) bb_show_usage(); - return argv[1]; + return argv[0]; } |