From ecbf1339a63e99a8ef7d5ddc334e38a39f291d3d Mon Sep 17 00:00:00 2001 From: David Sterba Date: Mon, 19 Jan 2015 13:30:06 +0100 Subject: 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 --- cmds-receive.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'cmds-receive.c') 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++; -- cgit v1.2.3