Btrfs-progs: btrfs: remove dead code in handle_options
Just cleanup: remove useless return type, while loop and dead code. Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
parent
1c1c7caf55
commit
f84db1ca70
33
btrfs.c
33
btrfs.c
|
@ -212,31 +212,20 @@ static int cmd_version(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int handle_options(int *argc, char ***argv)
|
||||
static void handle_options(int *argc, char ***argv)
|
||||
{
|
||||
char **orig_argv = *argv;
|
||||
|
||||
while (*argc > 0) {
|
||||
if (*argc > 0) {
|
||||
const char *arg = (*argv)[0];
|
||||
if (arg[0] != '-')
|
||||
break;
|
||||
|
||||
if (!strcmp(arg, "--help")) {
|
||||
break;
|
||||
} else if (!strcmp(arg, "--version")) {
|
||||
break;
|
||||
} else {
|
||||
fprintf(stderr, "Unknown option: %s\n", arg);
|
||||
fprintf(stderr, "usage: %s\n",
|
||||
btrfs_cmd_group.usagestr[0]);
|
||||
exit(129);
|
||||
}
|
||||
|
||||
(*argv)++;
|
||||
(*argc)--;
|
||||
if (arg[0] != '-' ||
|
||||
!strcmp(arg, "--help") ||
|
||||
!strcmp(arg, "--version"))
|
||||
return;
|
||||
fprintf(stderr, "Unknown option: %s\n", arg);
|
||||
fprintf(stderr, "usage: %s\n",
|
||||
btrfs_cmd_group.usagestr[0]);
|
||||
exit(129);
|
||||
}
|
||||
|
||||
return (*argv) - orig_argv;
|
||||
return;
|
||||
}
|
||||
|
||||
static const struct cmd_group btrfs_cmd_group = {
|
||||
|
|
Loading…
Reference in New Issue