From 342901930c1baefe49688c7d25a69196cf644180 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Wed, 18 Apr 2012 10:58:24 -0400 Subject: Revert recent commit re positional arguments. --- src/bin/scripts/reindexdb.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'src/bin/scripts/reindexdb.c') 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(); -- cgit v1.2.3