diff options
author | David Sterba <dsterba@suse.com> | 2016-06-16 13:27:18 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-06-17 17:01:25 +0200 |
commit | 18c6850fe1d06a31834da340387f94a6940197b9 (patch) | |
tree | d32461d01e4072ddf06854ce8b5b5bc350e9ce2e /utils.c | |
parent | 68702ea0096d302a714bda413234e6bb8c7e08d4 (diff) |
btrfs-progs: new helper for option parsing, more permissive for "no options"
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -3930,6 +3930,24 @@ void clean_args_no_options(int argc, char *argv[], const char * const *usagestr) } } +/* + * Same as clean_args_no_options but pass through arguments that could look + * like short options. Eg. reisze which takes a negative resize argument like + * '-123M' . + * + * This accepts only two forms: + * - "-- option1 option2 ..." + * - "option1 option2 ..." + */ +void clean_args_no_options_relaxed(int argc, char *argv[], const char * const *usagestr) +{ + if (argc <= 1) + return; + + if (strcmp(argv[1], "--") == 0) + optind = 2; +} + /* Subvolume helper functions */ /* * test if name is a correct subvolume name |