From c87553ac891f092f5e9bb4eef9cf06b6516e5e48 Mon Sep 17 00:00:00 2001 From: Steve Guminski Date: Fri, 14 Apr 2017 15:57:55 -0400 Subject: [PATCH] LU-6210 utils: Use C99 struct initializers in lshowmount.c This patch makes no functional changes. Struct initializers that use C89 or GCC-only syntax are updated to C99 syntax. Variables of type struct option are renamed to long_opts for consistency. C89 positional initializers require values to be placed in the correct order. This will cause errors if the fields of the struct definition are reordered or fields are added or removed. C99 named initializers avoid this problem, and also automatically clear any values that are not explicitly set. This patch updates lshowmount.c to use the C99 syntax. Test-Parameters: trivial Signed-off-by: Steve Guminski Change-Id: If30db4ee6a825c326eaf246201f9173fc291a436 Reviewed-on: https://review.whamcloud.com/27532 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond --- lustre/utils/lshowmount.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lustre/utils/lshowmount.c b/lustre/utils/lshowmount.c index 89bc3d5..67f8587 100644 --- a/lustre/utils/lshowmount.c +++ b/lustre/utils/lshowmount.c @@ -62,13 +62,12 @@ static void read_exports(char *exports, NIDList nidlist); char *prog; #define OPTIONS "ehlv" -static struct option long_options[] = { - {"enumerate", no_argument, 0, 'e'}, - {"help", no_argument, 0, 'h'}, - {"lookup", no_argument, 0, 'l'}, - {"verbose", no_argument, 0, 'v'}, - {0, 0, 0, 0}, -}; +static struct option long_opts[] = { + { .val = 'e', .name = "enumerate", .has_arg = no_argument }, + { .val = 'h', .name = "help", .has_arg = no_argument }, + { .val = 'l', .name = "lookup", .has_arg = no_argument }, + { .val = 'v', .name = "verbose", .has_arg = no_argument }, + { .name = NULL } }; static void usage(void) { @@ -85,7 +84,7 @@ int main(int argc, char **argv) prog = basename(argv[0]); - while ((opt = getopt_long(argc, argv, OPTIONS, long_options, + while ((opt = getopt_long(argc, argv, OPTIONS, long_opts, &optidx)) != -1) { switch (opt) { case 'e': /* --enumerate */ -- 1.8.3.1