aboutsummaryrefslogtreecommitdiffstats
path: root/cmds-subvolume.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-01-19 13:30:06 +0100
committerDavid Sterba <dsterba@suse.cz>2015-01-19 13:30:06 +0100
commitecbf1339a63e99a8ef7d5ddc334e38a39f291d3d (patch)
tree0483487c6fa237ac649c4bd0414bb564a7111925 /cmds-subvolume.c
parentca7b429f263ab19acf606846dd560be7e8519302 (diff)
downloadbtrfs-progs-ecbf1339a63e99a8ef7d5ddc334e38a39f291d3d.tar.gz
btrfs-progs-ecbf1339a63e99a8ef7d5ddc334e38a39f291d3d.tar.xz
btrfs-progs-ecbf1339a63e99a8ef7d5ddc334e38a39f291d3d.zip
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-subvolume.c')
-rw-r--r--cmds-subvolume.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 3895d11..97293fd 100644
--- a/cmds-subvolume.c
+++ b/cmds-subvolume.c
@@ -219,15 +219,15 @@ static int cmd_subvol_delete(int argc, char **argv)
DIR *dirstream = NULL;
int verbose = 0;
int commit_mode = 0;
- struct option long_options[] = {
- {"commit-after", no_argument, NULL, 'c'}, /* commit mode 1 */
- {"commit-each", no_argument, NULL, 'C'}, /* commit mode 2 */
- {NULL, 0, NULL, 0}
- };
optind = 1;
while (1) {
int c;
+ struct option long_options[] = {
+ {"commit-after", no_argument, NULL, 'c'}, /* commit mode 1 */
+ {"commit-each", no_argument, NULL, 'C'}, /* commit mode 2 */
+ {NULL, 0, NULL, 0}
+ };
c = getopt_long(argc, argv, "cC", long_options, NULL);
if (c < 0)
@@ -391,15 +391,10 @@ static int cmd_subvol_list(int argc, char **argv)
int fd = -1;
u64 top_id;
int ret = -1, uerr = 0;
- int c;
char *subvol;
int is_tab_result = 0;
int is_list_all = 0;
int is_only_in_path = 0;
- struct option long_options[] = {
- {"sort", 1, NULL, 'S'},
- {NULL, 0, NULL, 0}
- };
DIR *dirstream = NULL;
filter_set = btrfs_list_alloc_filter_set();
@@ -407,6 +402,12 @@ static int cmd_subvol_list(int argc, char **argv)
optind = 1;
while(1) {
+ int c;
+ struct option long_options[] = {
+ {"sort", 1, NULL, 'S'},
+ {NULL, 0, NULL, 0}
+ };
+
c = getopt_long(argc, argv,
"acdgopqsurRG:C:t", long_options, NULL);
if (c < 0)