diff options
author | David Sterba <dsterba@suse.cz> | 2015-01-19 13:30:06 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2015-01-19 13:30:06 +0100 |
commit | ecbf1339a63e99a8ef7d5ddc334e38a39f291d3d (patch) | |
tree | 0483487c6fa237ac649c4bd0414bb564a7111925 /cmds-receive.c | |
parent | ca7b429f263ab19acf606846dd560be7e8519302 (diff) |
btrfs-progs: cleanup, move getop long options close to their use
Move long_option defintions just before getopt_long everywhere.
Signed-off-by: David Sterba <dsterba@suse.cz>
Diffstat (limited to 'cmds-receive.c')
-rw-r--r-- | cmds-receive.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/cmds-receive.c b/cmds-receive.c index f269adec..bffc7dc7 100644 --- a/cmds-receive.c +++ b/cmds-receive.c @@ -922,14 +922,8 @@ out: return ret; } -static const struct option long_opts[] = { - { "max-errors", 1, NULL, 'E' }, - { NULL, 0, NULL, 0 } -}; - int cmd_receive(int argc, char **argv) { - int c; char *tomnt = NULL; char *fromfile = NULL; struct btrfs_receive r; @@ -942,7 +936,17 @@ int cmd_receive(int argc, char **argv) r.write_fd = -1; r.dest_dir_fd = -1; - while ((c = getopt_long(argc, argv, "evf:", long_opts, NULL)) != -1) { + while (1) { + int c; + static const struct option long_opts[] = { + { "max-errors", 1, NULL, 'E' }, + { NULL, 0, NULL, 0 } + }; + + c = getopt_long(argc, argv, "evf:", long_opts, NULL); + if (c < 0) + break; + switch (c) { case 'v': g_verbose++; |