mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +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:
@ -3718,7 +3718,7 @@ process_postgres_switches(int argc, char *argv[], GucContext ctx,
|
||||
* postmaster/postmaster.c (the option sets should not conflict) and with
|
||||
* the common help() function in main/main.c.
|
||||
*/
|
||||
while ((flag = getopt(argc, argv, "B:bc:C:D:d:EeFf:h:ijk:lN:nOPp:r:S:sTt:v:W:-:")) != -1)
|
||||
while ((flag = getopt(argc, argv, "B:bC:c:D:d:EeFf:h:ijk:lN:nOPp:r:S:sTt:v:W:-:")) != -1)
|
||||
{
|
||||
switch (flag)
|
||||
{
|
||||
@ -3736,6 +3736,32 @@ process_postgres_switches(int argc, char *argv[], GucContext ctx,
|
||||
/* ignored for consistency with the postmaster */
|
||||
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, ctx, gucsource);
|
||||
pfree(name);
|
||||
pfree(value);
|
||||
break;
|
||||
}
|
||||
|
||||
case 'D':
|
||||
if (secure)
|
||||
userDoption = strdup(optarg);
|
||||
@ -3850,32 +3876,6 @@ process_postgres_switches(int argc, char *argv[], GucContext ctx,
|
||||
SetConfigOption("post_auth_delay", optarg, ctx, gucsource);
|
||||
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, ctx, gucsource);
|
||||
pfree(name);
|
||||
pfree(value);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
errs++;
|
||||
break;
|
||||
|
Reference in New Issue
Block a user