mirror of
https://github.com/postgres/postgres.git
synced 2025-07-26 01:22:12 +03:00
Order getopt arguments
Order the letters in the arguments of getopt() and getopt_long(), as well as in the subsequent switch statements. In most cases, I used alphabetical with lower case first. In a few cases, existing different orders (e.g., upper case first) was kept to reduce the diff size. Discussion: https://www.postgresql.org/message-id/flat/3efd0fe8-351b-f836-9122-886002602357%40enterprisedb.com
This commit is contained in:
@ -228,6 +228,32 @@ BootstrapModeMain(int argc, char *argv[], bool check_only)
|
||||
case 'B':
|
||||
SetConfigOption("shared_buffers", optarg, PGC_POSTMASTER, PGC_S_ARGV);
|
||||
break;
|
||||
case 'c':
|
||||
case '-':
|
||||
{
|
||||
char *name,
|
||||
*value;
|
||||
|
||||
ParseLongOption(optarg, &name, &value);
|
||||
if (!value)
|
||||
{
|
||||
if (flag == '-')
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("--%s requires a value",
|
||||
optarg)));
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("-c %s requires a value",
|
||||
optarg)));
|
||||
}
|
||||
|
||||
SetConfigOption(name, value, PGC_POSTMASTER, PGC_S_ARGV);
|
||||
pfree(name);
|
||||
pfree(value);
|
||||
break;
|
||||
}
|
||||
case 'D':
|
||||
userDoption = pstrdup(optarg);
|
||||
break;
|
||||
@ -265,32 +291,6 @@ BootstrapModeMain(int argc, char *argv[], bool check_only)
|
||||
PGC_S_DYNAMIC_DEFAULT);
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
case '-':
|
||||
{
|
||||
char *name,
|
||||
*value;
|
||||
|
||||
ParseLongOption(optarg, &name, &value);
|
||||
if (!value)
|
||||
{
|
||||
if (flag == '-')
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("--%s requires a value",
|
||||
optarg)));
|
||||
else
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("-c %s requires a value",
|
||||
optarg)));
|
||||
}
|
||||
|
||||
SetConfigOption(name, value, PGC_POSTMASTER, PGC_S_ARGV);
|
||||
pfree(name);
|
||||
pfree(value);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
write_stderr("Try \"%s --help\" for more information.\n",
|
||||
progname);
|
||||
|
Reference in New Issue
Block a user