1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-21 16:02:15 +03:00

Revert recent commit re positional arguments.

This commit is contained in:
Andrew Dunstan
2012-04-18 10:58:01 -04:00
parent 4fd49c7336
commit 5969ee4df7
6 changed files with 38 additions and 75 deletions

View File

@ -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();