diff options
author | Andrew Dunstan <andrew@dunslane.net> | 2012-04-18 10:58:24 -0400 |
---|---|---|
committer | Andrew Dunstan <andrew@dunslane.net> | 2012-04-18 10:58:24 -0400 |
commit | 342901930c1baefe49688c7d25a69196cf644180 (patch) | |
tree | 7e83a1f3f861289982d217ea742697355de60ecb /src/bin/scripts/reindexdb.c | |
parent | f8c53d5b411da9518876c93161199e38eaaa5118 (diff) |
Revert recent commit re positional arguments.
Diffstat (limited to 'src/bin/scripts/reindexdb.c')
-rw-r--r-- | src/bin/scripts/reindexdb.c | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c index f9272fecc39..53fff01a74b 100644 --- a/src/bin/scripts/reindexdb.c +++ b/src/bin/scripts/reindexdb.c @@ -116,22 +116,17 @@ main(int argc, char *argv[]) } } - /* - * Non-option argument specifies database name - * as long as it wasn't already specified with -d / --dbname - */ - if (optind < argc && dbname == NULL) + switch (argc - optind) { - dbname = argv[optind]; - optind++; - } - - if (optind < argc) - { - fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"), - progname, argv[optind + 1]); - fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); - exit(1); + case 0: + break; + case 1: + dbname = argv[optind]; + break; + default: + fprintf(stderr, _("%s: too many command-line arguments (first is \"%s\")\n"), progname, argv[optind + 1]); + fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); + exit(1); } setup_cancel_handler(); |