diff options
Diffstat (limited to 'src/bin/scripts/clusterdb.c')
-rw-r--r-- | src/bin/scripts/clusterdb.c | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/bin/scripts/clusterdb.c b/src/bin/scripts/clusterdb.c index 624886e5c9e..f4c317ae149 100644 --- a/src/bin/scripts/clusterdb.c +++ b/src/bin/scripts/clusterdb.c @@ -106,22 +106,18 @@ 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(); |