From e8f01efc9c84991f7ce5d01eeb44645be842e6d4 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 2 Jul 2011 15:20:35 +0000 Subject: [PATCH] main.c, shrink scope of `c' and `optind' --- src/main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main.c b/src/main.c index 6e21e8444..b17f44cc0 100644 --- a/src/main.c +++ b/src/main.c @@ -775,7 +775,7 @@ print_news(void) int main(int argc, char **argv) { - int c, err; + int err; bool gotone = FALSE; bool addctrlsect = TRUE; /* PN: for autorun */ @@ -867,7 +867,7 @@ main(int argc, char **argv) /* --- Process command line options --- */ for(;;) { - int option_index = 0; + static struct option long_options[] = { {"help", 0, 0, 'h'}, {"version", 0, 0, 'v'}, @@ -885,8 +885,11 @@ main(int argc, char **argv) {0, 0, 0, 0} }; - c = getopt_long (argc, argv, "hvbac:ino:pqr:st:", - long_options, &option_index); + int option_index = 0; + + int c = getopt_long (argc, argv, "hvbac:ino:pqr:st:", + long_options, &option_index); + if (c == -1) break;