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;
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);
* tcop/postgres.c (the option sets should not conflict) and with the
* common help() function in main/main.c.
*/
- while ((opt = getopt(argc, argv, "B:bc:C:D:d:EeFf:h:ijk:lN:OPp:r:S:sTt:W:-:")) != -1)
+ while ((opt = getopt(argc, argv, "B:bC:c:D:d:EeFf:h:ijk:lN:OPp:r:S:sTt:W:-:")) != -1)
{
switch (opt)
{
output_config_variable = strdup(optarg);
break;
+ case 'c':
+ case '-':
+ {
+ char *name,
+ *value;
+
+ ParseLongOption(optarg, &name, &value);
+ if (!value)
+ {
+ if (opt == '-')
+ 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 = strdup(optarg);
break;
SetConfigOption("post_auth_delay", optarg, PGC_POSTMASTER, PGC_S_ARGV);
break;
- case 'c':
- case '-':
- {
- char *name,
- *value;
-
- ParseLongOption(optarg, &name, &value);
- if (!value)
- {
- if (opt == '-')
- 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);
* 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)
{
/* 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);
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;
handle_help_version_opts(argc, argv, progname, help);
/* process command-line options */
- while ((c = getopt_long(argc, argv, "ad:D:eh:Hi:I:j:p:Pr:R:s:S:t:T:U:wWv",
+ while ((c = getopt_long(argc, argv, "ad:D:eh:Hi:I:j:p:Pr:R:s:S:t:T:U:vwW",
long_options, &optindex)) != -1)
{
char *endptr;
case 'U':
username = pg_strdup(optarg);
break;
+ case 'v':
+ opts.verbose = true;
+ pg_logging_increase_verbosity();
+ break;
case 'w':
prompt_password = TRI_NO;
break;
case 'W':
prompt_password = TRI_YES;
break;
- case 'v':
- opts.verbose = true;
- pg_logging_increase_verbosity();
- break;
case 1:
maintenance_db = pg_strdup(optarg);
break;
}
}
- while ((c = getopt(argc, argv, "x:dn")) != -1)
+ while ((c = getopt(argc, argv, "dnx:")) != -1)
{
switch (c)
{
atexit(cleanup_directories_atexit);
- while ((c = getopt_long(argc, argv, "CD:F:r:RS:t:T:X:l:nNzZ:d:c:h:p:U:s:wWvP",
+ while ((c = getopt_long(argc, argv, "c:Cd:D:F:h:l:nNp:Pr:Rs:S:t:T:U:vwWX:zZ:",
long_options, &option_index)) != -1)
{
switch (c)
{
+ case 'c':
+ if (pg_strcasecmp(optarg, "fast") == 0)
+ fastcheckpoint = true;
+ else if (pg_strcasecmp(optarg, "spread") == 0)
+ fastcheckpoint = false;
+ else
+ pg_fatal("invalid checkpoint argument \"%s\", must be \"fast\" or \"spread\"",
+ optarg);
+ break;
case 'C':
create_slot = true;
break;
+ case 'd':
+ connection_string = pg_strdup(optarg);
+ break;
case 'D':
basedir = pg_strdup(optarg);
break;
pg_fatal("invalid output format \"%s\", must be \"plain\" or \"tar\"",
optarg);
break;
+ case 'h':
+ dbhost = pg_strdup(optarg);
+ break;
+ case 'l':
+ label = pg_strdup(optarg);
+ break;
+ case 'n':
+ noclean = true;
+ break;
+ case 'N':
+ do_sync = false;
+ break;
+ case 'p':
+ dbport = pg_strdup(optarg);
+ break;
+ case 'P':
+ showprogress = true;
+ break;
case 'r':
maxrate = parse_max_rate(optarg);
break;
case 'R':
writerecoveryconf = true;
break;
+ case 's':
+ if (!option_parse_int(optarg, "-s/--status-interval", 0,
+ INT_MAX / 1000,
+ &standby_message_timeout))
+ exit(1);
+ standby_message_timeout *= 1000;
+ break;
case 'S':
/*
replication_slot = pg_strdup(optarg);
temp_replication_slot = false;
break;
- case 2:
- no_slot = true;
- break;
case 't':
backup_target = pg_strdup(optarg);
break;
case 'T':
tablespace_list_append(optarg);
break;
+ case 'U':
+ dbuser = pg_strdup(optarg);
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case 'w':
+ dbgetpassword = -1;
+ break;
+ case 'W':
+ dbgetpassword = 1;
+ break;
case 'X':
if (strcmp(optarg, "n") == 0 ||
strcmp(optarg, "none") == 0)
pg_fatal("invalid wal-method option \"%s\", must be \"fetch\", \"stream\", or \"none\"",
optarg);
break;
- case 1:
- xlog_dir = pg_strdup(optarg);
- break;
- case 'l':
- label = pg_strdup(optarg);
- break;
- case 'n':
- noclean = true;
- break;
- case 'N':
- do_sync = false;
- break;
case 'z':
compression_algorithm = "gzip";
compression_detail = NULL;
backup_parse_compress_options(optarg, &compression_algorithm,
&compression_detail, &compressloc);
break;
- case 'c':
- if (pg_strcasecmp(optarg, "fast") == 0)
- fastcheckpoint = true;
- else if (pg_strcasecmp(optarg, "spread") == 0)
- fastcheckpoint = false;
- else
- pg_fatal("invalid checkpoint argument \"%s\", must be \"fast\" or \"spread\"",
- optarg);
- break;
- case 'd':
- connection_string = pg_strdup(optarg);
- break;
- case 'h':
- dbhost = pg_strdup(optarg);
- break;
- case 'p':
- dbport = pg_strdup(optarg);
- break;
- case 'U':
- dbuser = pg_strdup(optarg);
- break;
- case 'w':
- dbgetpassword = -1;
- break;
- case 'W':
- dbgetpassword = 1;
- break;
- case 's':
- if (!option_parse_int(optarg, "-s/--status-interval", 0,
- INT_MAX / 1000,
- &standby_message_timeout))
- exit(1);
- standby_message_timeout *= 1000;
- break;
- case 'v':
- verbose++;
+ case 1:
+ xlog_dir = pg_strdup(optarg);
break;
- case 'P':
- showprogress = true;
+ case 2:
+ no_slot = true;
break;
case 3:
verify_checksums = false;
static char *basedir = NULL;
static int verbose = 0;
static int compresslevel = 0;
-static int noloop = 0;
+static bool noloop = false;
static int standby_message_timeout = 10 * 1000; /* 10 sec = default */
static volatile sig_atomic_t time_to_stop = false;
static bool do_create_slot = false;
}
}
- while ((c = getopt_long(argc, argv, "D:d:E:h:p:U:s:S:nwWvZ:",
+ while ((c = getopt_long(argc, argv, "d:D:E:h:np:s:S:U:vwWZ:",
long_options, &option_index)) != -1)
{
switch (c)
{
+ case 'd':
+ connection_string = pg_strdup(optarg);
+ break;
case 'D':
basedir = pg_strdup(optarg);
break;
- case 'd':
- connection_string = pg_strdup(optarg);
+ case 'E':
+ if (sscanf(optarg, "%X/%X", &hi, &lo) != 2)
+ pg_fatal("could not parse end position \"%s\"", optarg);
+ endpos = ((uint64) hi) << 32 | lo;
break;
case 'h':
dbhost = pg_strdup(optarg);
break;
+ case 'n':
+ noloop = true;
+ break;
case 'p':
dbport = pg_strdup(optarg);
break;
- case 'U':
- dbuser = pg_strdup(optarg);
- break;
- case 'w':
- dbgetpassword = -1;
- break;
- case 'W':
- dbgetpassword = 1;
- break;
case 's':
if (!option_parse_int(optarg, "-s/--status-interval", 0,
INT_MAX / 1000,
case 'S':
replication_slot = pg_strdup(optarg);
break;
- case 'E':
- if (sscanf(optarg, "%X/%X", &hi, &lo) != 2)
- pg_fatal("could not parse end position \"%s\"", optarg);
- endpos = ((uint64) hi) << 32 | lo;
- break;
- case 'n':
- noloop = 1;
+ case 'U':
+ dbuser = pg_strdup(optarg);
break;
case 'v':
verbose++;
break;
+ case 'w':
+ dbgetpassword = -1;
+ break;
+ case 'W':
+ dbgetpassword = 1;
+ break;
case 'Z':
parse_compress_options(optarg, &compression_algorithm_str,
&compression_detail);
break;
-/* action */
case 1:
do_create_slot = true;
break;
}
}
- while ((c = getopt_long(argc, argv, "E:f:F:nvtd:h:p:U:wWI:o:P:s:S:",
+ while ((c = getopt_long(argc, argv, "E:f:F:ntvd:h:p:U:wWI:o:P:s:S:",
long_options, &option_index)) != -1)
{
switch (c)
case 'n':
noloop = 1;
break;
- case 'v':
- verbose++;
- break;
case 't':
two_phase = true;
break;
+ case 'v':
+ verbose++;
+ break;
/* connection options */
case 'd':
dbname = pg_strdup(optarg);
}
}
- while ((c = getopt_long(argc, argv, "cD:deNPf:v", long_options, &option_index)) != -1)
+ while ((c = getopt_long(argc, argv, "cdD:ef:NPv", long_options, &option_index)) != -1)
{
switch (c)
{
case 'd':
mode = PG_MODE_DISABLE;
break;
+ case 'D':
+ DataDir = optarg;
+ break;
case 'e':
mode = PG_MODE_ENABLE;
break;
case 'N':
do_sync = false;
break;
- case 'v':
- verbose = true;
- break;
- case 'D':
- DataDir = optarg;
- break;
case 'P':
showprogress = true;
break;
+ case 'v':
+ verbose = true;
+ break;
default:
/* getopt_long already emitted a complaint */
pg_log_error_hint("Try \"%s --help\" for more information.", progname);
if (os_user_effective_id == 0)
pg_fatal("%s: cannot be run as root", os_info.progname);
- while ((option = getopt_long(argc, argv, "d:D:b:B:cj:kNo:O:p:P:rs:U:v",
+ while ((option = getopt_long(argc, argv, "b:B:cd:D:j:kNo:O:p:P:rs:U:v",
long_options, &optindex)) != -1)
{
switch (option)
if (!set_random_seed(getenv("PGBENCH_RANDOM_SEED")))
pg_fatal("error while setting random seed from PGBENCH_RANDOM_SEED environment variable");
- while ((c = getopt_long(argc, argv, "iI:h:nvp:dqb:SNc:j:Crs:t:T:U:lf:D:F:M:P:R:L:", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "b:c:CdD:f:F:h:iI:j:lL:M:nNp:P:qrR:s:St:T:U:v", long_options, &optindex)) != -1)
{
char *script;
switch (c)
{
- case 'i':
- is_init_mode = true;
- break;
- case 'I':
- pg_free(initialize_steps);
- initialize_steps = pg_strdup(optarg);
- checkInitSteps(initialize_steps);
- initialization_option_set = true;
- break;
- case 'h':
- pghost = pg_strdup(optarg);
- break;
- case 'n':
- is_no_vacuum = true;
- break;
- case 'v':
+ case 'b':
+ if (strcmp(optarg, "list") == 0)
+ {
+ listAvailableScripts();
+ exit(0);
+ }
+ weight = parseScriptWeight(optarg, &script);
+ process_builtin(findBuiltin(script), weight);
benchmarking_option_set = true;
- do_vacuum_accounts = true;
- break;
- case 'p':
- pgport = pg_strdup(optarg);
- break;
- case 'd':
- pg_logging_increase_verbosity();
+ internal_script_used = true;
break;
case 'c':
benchmarking_option_set = true;
}
#endif /* HAVE_GETRLIMIT */
break;
- case 'j': /* jobs */
- benchmarking_option_set = true;
- if (!option_parse_int(optarg, "-j/--jobs", 1, INT_MAX,
- &nthreads))
- {
- exit(1);
- }
-#ifndef ENABLE_THREAD_SAFETY
- if (nthreads != 1)
- pg_fatal("threads are not supported on this platform; use -j1");
-#endif /* !ENABLE_THREAD_SAFETY */
- break;
case 'C':
benchmarking_option_set = true;
is_connect = true;
break;
- case 'r':
- benchmarking_option_set = true;
- report_per_command = true;
- break;
- case 's':
- scale_given = true;
- if (!option_parse_int(optarg, "-s/--scale", 1, INT_MAX,
- &scale))
- exit(1);
- break;
- case 't':
- benchmarking_option_set = true;
- if (!option_parse_int(optarg, "-t/--transactions", 1, INT_MAX,
- &nxacts))
- exit(1);
- break;
- case 'T':
- benchmarking_option_set = true;
- if (!option_parse_int(optarg, "-T/--time", 1, INT_MAX,
- &duration))
- exit(1);
- break;
- case 'U':
- username = pg_strdup(optarg);
- break;
- case 'l':
- benchmarking_option_set = true;
- use_log = true;
- break;
- case 'q':
- initialization_option_set = true;
- use_quiet = true;
- break;
- case 'b':
- if (strcmp(optarg, "list") == 0)
- {
- listAvailableScripts();
- exit(0);
- }
- weight = parseScriptWeight(optarg, &script);
- process_builtin(findBuiltin(script), weight);
- benchmarking_option_set = true;
- internal_script_used = true;
- break;
- case 'S':
- process_builtin(findBuiltin("select-only"), 1);
- benchmarking_option_set = true;
- internal_script_used = true;
- break;
- case 'N':
- process_builtin(findBuiltin("simple-update"), 1);
- benchmarking_option_set = true;
- internal_script_used = true;
- break;
- case 'f':
- weight = parseScriptWeight(optarg, &script);
- process_file(script, weight);
- benchmarking_option_set = true;
+ case 'd':
+ pg_logging_increase_verbosity();
break;
case 'D':
{
exit(1);
}
break;
+ case 'f':
+ weight = parseScriptWeight(optarg, &script);
+ process_file(script, weight);
+ benchmarking_option_set = true;
+ break;
case 'F':
initialization_option_set = true;
if (!option_parse_int(optarg, "-F/--fillfactor", 10, 100,
&fillfactor))
exit(1);
break;
+ case 'h':
+ pghost = pg_strdup(optarg);
+ break;
+ case 'i':
+ is_init_mode = true;
+ break;
+ case 'I':
+ pg_free(initialize_steps);
+ initialize_steps = pg_strdup(optarg);
+ checkInitSteps(initialize_steps);
+ initialization_option_set = true;
+ break;
+ case 'j': /* jobs */
+ benchmarking_option_set = true;
+ if (!option_parse_int(optarg, "-j/--jobs", 1, INT_MAX,
+ &nthreads))
+ {
+ exit(1);
+ }
+#ifndef ENABLE_THREAD_SAFETY
+ if (nthreads != 1)
+ pg_fatal("threads are not supported on this platform; use -j1");
+#endif /* !ENABLE_THREAD_SAFETY */
+ break;
+ case 'l':
+ benchmarking_option_set = true;
+ use_log = true;
+ break;
+ case 'L':
+ {
+ double limit_ms = atof(optarg);
+
+ if (limit_ms <= 0.0)
+ pg_fatal("invalid latency limit: \"%s\"", optarg);
+ benchmarking_option_set = true;
+ latency_limit = (int64) (limit_ms * 1000);
+ }
+ break;
case 'M':
benchmarking_option_set = true;
for (querymode = 0; querymode < NUM_QUERYMODE; querymode++)
if (querymode >= NUM_QUERYMODE)
pg_fatal("invalid query mode (-M): \"%s\"", optarg);
break;
+ case 'n':
+ is_no_vacuum = true;
+ break;
+ case 'N':
+ process_builtin(findBuiltin("simple-update"), 1);
+ benchmarking_option_set = true;
+ internal_script_used = true;
+ break;
+ case 'p':
+ pgport = pg_strdup(optarg);
+ break;
case 'P':
benchmarking_option_set = true;
if (!option_parse_int(optarg, "-P/--progress", 1, INT_MAX,
&progress))
exit(1);
break;
+ case 'q':
+ initialization_option_set = true;
+ use_quiet = true;
+ break;
+ case 'r':
+ benchmarking_option_set = true;
+ report_per_command = true;
+ break;
case 'R':
{
/* get a double from the beginning of option value */
throttle_delay = 1000000.0 / throttle_value;
}
break;
- case 'L':
- {
- double limit_ms = atof(optarg);
-
- if (limit_ms <= 0.0)
- pg_fatal("invalid latency limit: \"%s\"", optarg);
- benchmarking_option_set = true;
- latency_limit = (int64) (limit_ms * 1000);
- }
+ case 's':
+ scale_given = true;
+ if (!option_parse_int(optarg, "-s/--scale", 1, INT_MAX,
+ &scale))
+ exit(1);
+ break;
+ case 'S':
+ process_builtin(findBuiltin("select-only"), 1);
+ benchmarking_option_set = true;
+ internal_script_used = true;
+ break;
+ case 't':
+ benchmarking_option_set = true;
+ if (!option_parse_int(optarg, "-t/--transactions", 1, INT_MAX,
+ &nxacts))
+ exit(1);
+ break;
+ case 'T':
+ benchmarking_option_set = true;
+ if (!option_parse_int(optarg, "-T/--time", 1, INT_MAX,
+ &duration))
+ exit(1);
+ break;
+ case 'U':
+ username = pg_strdup(optarg);
+ break;
+ case 'v':
+ benchmarking_option_set = true;
+ do_vacuum_accounts = true;
break;
case 1: /* unlogged-tables */
initialization_option_set = true;
handle_help_version_opts(argc, argv, "clusterdb", help);
- while ((c = getopt_long(argc, argv, "h:p:U:wWeqd:at:v", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "ad:eh:p:qt:U:vwW", long_options, &optindex)) != -1)
{
switch (c)
{
+ case 'a':
+ alldb = true;
+ break;
+ case 'd':
+ dbname = pg_strdup(optarg);
+ break;
+ case 'e':
+ echo = true;
+ break;
case 'h':
host = pg_strdup(optarg);
break;
case 'p':
port = pg_strdup(optarg);
break;
- case 'U':
- username = pg_strdup(optarg);
- break;
- case 'w':
- prompt_password = TRI_NO;
- break;
- case 'W':
- prompt_password = TRI_YES;
- break;
- case 'e':
- echo = true;
- break;
case 'q':
quiet = true;
break;
- case 'd':
- dbname = pg_strdup(optarg);
- break;
- case 'a':
- alldb = true;
- break;
case 't':
simple_string_list_append(&tables, optarg);
break;
+ case 'U':
+ username = pg_strdup(optarg);
+ break;
case 'v':
verbose = true;
break;
+ case 'w':
+ prompt_password = TRI_NO;
+ break;
+ case 'W':
+ prompt_password = TRI_YES;
+ break;
case 2:
maintenance_db = pg_strdup(optarg);
break;
handle_help_version_opts(argc, argv, "createdb", help);
- while ((c = getopt_long(argc, argv, "h:p:U:wWeO:D:T:E:l:S:", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "D:eE:h:l:O:p:S:T:U:wW", long_options, &optindex)) != -1)
{
switch (c)
{
+ case 'D':
+ tablespace = pg_strdup(optarg);
+ break;
+ case 'e':
+ echo = true;
+ break;
+ case 'E':
+ encoding = pg_strdup(optarg);
+ break;
case 'h':
host = pg_strdup(optarg);
break;
+ case 'l':
+ locale = pg_strdup(optarg);
+ break;
+ case 'O':
+ owner = pg_strdup(optarg);
+ break;
case 'p':
port = pg_strdup(optarg);
break;
+ case 'S':
+ strategy = pg_strdup(optarg);
+ break;
+ case 'T':
+ template = pg_strdup(optarg);
+ break;
case 'U':
username = pg_strdup(optarg);
break;
case 'W':
prompt_password = TRI_YES;
break;
- case 'e':
- echo = true;
- break;
- case 'O':
- owner = pg_strdup(optarg);
- break;
- case 'D':
- tablespace = pg_strdup(optarg);
- break;
- case 'T':
- template = pg_strdup(optarg);
- break;
- case 'E':
- encoding = pg_strdup(optarg);
- break;
- case 'S':
- strategy = pg_strdup(optarg);
- break;
case 1:
lc_collate = pg_strdup(optarg);
break;
case 2:
lc_ctype = pg_strdup(optarg);
break;
- case 'l':
- locale = pg_strdup(optarg);
- break;
case 3:
maintenance_db = pg_strdup(optarg);
break;
handle_help_version_opts(argc, argv, "dropdb", help);
- while ((c = getopt_long(argc, argv, "h:p:U:wWeif", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "efh:ip:U:wW", long_options, &optindex)) != -1)
{
switch (c)
{
+ case 'e':
+ echo = true;
+ break;
+ case 'f':
+ force = true;
+ break;
case 'h':
host = pg_strdup(optarg);
break;
+ case 'i':
+ interactive = true;
+ break;
case 'p':
port = pg_strdup(optarg);
break;
case 'W':
prompt_password = TRI_YES;
break;
- case 'e':
- echo = true;
- break;
- case 'i':
- interactive = true;
- break;
- case 'f':
- force = true;
- break;
case 0:
/* this covers the long options */
break;
handle_help_version_opts(argc, argv, "dropuser", help);
- while ((c = getopt_long(argc, argv, "h:p:U:wWei", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "eh:ip:U:wW", long_options, &optindex)) != -1)
{
switch (c)
{
+ case 'e':
+ echo = true;
+ break;
case 'h':
host = pg_strdup(optarg);
break;
+ case 'i':
+ interactive = true;
+ break;
case 'p':
port = pg_strdup(optarg);
break;
case 'W':
prompt_password = TRI_YES;
break;
- case 'e':
- echo = true;
- break;
- case 'i':
- interactive = true;
- break;
case 0:
/* this covers the long options */
break;
handle_help_version_opts(argc, argv, "reindexdb", help);
/* process command-line options */
- while ((c = getopt_long(argc, argv, "h:p:U:wWeqS:d:ast:i:j:v", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "ad:eh:i:j:qp:sS:t:U:vwW", long_options, &optindex)) != -1)
{
switch (c)
{
- case 'h':
- host = pg_strdup(optarg);
+ case 'a':
+ alldb = true;
break;
- case 'p':
- port = pg_strdup(optarg);
+ case 'd':
+ dbname = pg_strdup(optarg);
break;
- case 'U':
- username = pg_strdup(optarg);
+ case 'e':
+ echo = true;
break;
- case 'w':
- prompt_password = TRI_NO;
+ case 'h':
+ host = pg_strdup(optarg);
break;
- case 'W':
- prompt_password = TRI_YES;
+ case 'i':
+ simple_string_list_append(&indexes, optarg);
break;
- case 'e':
- echo = true;
+ case 'j':
+ if (!option_parse_int(optarg, "-j/--jobs", 1, INT_MAX,
+ &concurrentCons))
+ exit(1);
break;
case 'q':
quiet = true;
break;
- case 'S':
- simple_string_list_append(&schemas, optarg);
- break;
- case 'd':
- dbname = pg_strdup(optarg);
- break;
- case 'a':
- alldb = true;
+ case 'p':
+ port = pg_strdup(optarg);
break;
case 's':
syscatalog = true;
break;
+ case 'S':
+ simple_string_list_append(&schemas, optarg);
+ break;
case 't':
simple_string_list_append(&tables, optarg);
break;
- case 'i':
- simple_string_list_append(&indexes, optarg);
- break;
- case 'j':
- if (!option_parse_int(optarg, "-j/--jobs", 1, INT_MAX,
- &concurrentCons))
- exit(1);
+ case 'U':
+ username = pg_strdup(optarg);
break;
case 'v':
verbose = true;
break;
+ case 'w':
+ prompt_password = TRI_NO;
+ break;
+ case 'W':
+ prompt_password = TRI_YES;
+ break;
case 1:
concurrently = true;
break;
handle_help_version_opts(argc, argv, "vacuumdb", help);
- while ((c = getopt_long(argc, argv, "h:p:U:wWeqd:zZFat:fvj:P:n:N:", long_options, &optindex)) != -1)
+ while ((c = getopt_long(argc, argv, "ad:efFh:j:n:N:p:P:qt:U:vwWzZ", long_options, &optindex)) != -1)
{
switch (c)
{
- case 'h':
- host = pg_strdup(optarg);
- break;
- case 'p':
- port = pg_strdup(optarg);
- break;
- case 'U':
- username = pg_strdup(optarg);
- break;
- case 'w':
- prompt_password = TRI_NO;
- break;
- case 'W':
- prompt_password = TRI_YES;
- break;
- case 'e':
- echo = true;
- break;
- case 'q':
- quiet = true;
+ case 'a':
+ objfilter |= OBJFILTER_ALL_DBS;
break;
case 'd':
objfilter |= OBJFILTER_DATABASE;
dbname = pg_strdup(optarg);
break;
- case 'z':
- vacopts.and_analyze = true;
+ case 'e':
+ echo = true;
break;
- case 'Z':
- vacopts.analyze_only = true;
+ case 'f':
+ vacopts.full = true;
break;
case 'F':
vacopts.freeze = true;
break;
- case 'a':
- objfilter |= OBJFILTER_ALL_DBS;
- break;
- case 't':
- {
- objfilter |= OBJFILTER_TABLE;
- simple_string_list_append(&objects, optarg);
- tbl_count++;
- break;
- }
- case 'f':
- vacopts.full = true;
- break;
- case 'v':
- vacopts.verbose = true;
+ case 'h':
+ host = pg_strdup(optarg);
break;
case 'j':
if (!option_parse_int(optarg, "-j/--jobs", 1, INT_MAX,
&concurrentCons))
exit(1);
break;
+ case 'n':
+ objfilter |= OBJFILTER_SCHEMA;
+ simple_string_list_append(&objects, optarg);
+ break;
+ case 'N':
+ objfilter |= OBJFILTER_SCHEMA_EXCLUDE;
+ simple_string_list_append(&objects, optarg);
+ break;
+ case 'p':
+ port = pg_strdup(optarg);
+ break;
case 'P':
if (!option_parse_int(optarg, "-P/--parallel", 0, INT_MAX,
&vacopts.parallel_workers))
exit(1);
break;
- case 'n':
- {
- objfilter |= OBJFILTER_SCHEMA;
- simple_string_list_append(&objects, optarg);
- break;
- }
- case 'N':
- {
- objfilter |= OBJFILTER_SCHEMA_EXCLUDE;
- simple_string_list_append(&objects, optarg);
- break;
- }
+ case 'q':
+ quiet = true;
+ break;
+ case 't':
+ objfilter |= OBJFILTER_TABLE;
+ simple_string_list_append(&objects, optarg);
+ tbl_count++;
+ break;
+ case 'U':
+ username = pg_strdup(optarg);
+ break;
+ case 'v':
+ vacopts.verbose = true;
+ break;
+ case 'w':
+ prompt_password = TRI_NO;
+ break;
+ case 'W':
+ prompt_password = TRI_YES;
+ break;
+ case 'z':
+ vacopts.and_analyze = true;
+ break;
+ case 'Z':
+ vacopts.analyze_only = true;
+ break;
case 2:
maintenance_db = pg_strdup(optarg);
break;
}
output_filename = NULL;
- while ((c = getopt_long(argc, argv, "vcio:I:tD:dC:r:h", ecpg_options, NULL)) != -1)
+ while ((c = getopt_long(argc, argv, "cC:dD:hiI:o:r:tv", ecpg_options, NULL)) != -1)
{
switch (c)
{
- case ECPG_GETOPT_LONG_REGRESSION:
- regression_mode = true;
- break;
- case 'o':
- output_filename = mm_strdup(optarg);
- if (strcmp(output_filename, "-") == 0)
- base_yyout = stdout;
- else
- base_yyout = fopen(output_filename, PG_BINARY_W);
-
- if (base_yyout == NULL)
- {
- fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
- progname, output_filename, strerror(errno));
- output_filename = NULL;
- }
- else
- out_option = 1;
- break;
- case 'I':
- add_include_path(optarg);
- break;
- case 't':
- autocommit = true;
- break;
- case 'v':
- verbose = true;
- break;
- case 'h':
- header_mode = true;
- /* this must include "-c" to make sense, so fall through */
- /* FALLTHROUGH */
case 'c':
auto_create_c = true;
break;
- case 'i':
- system_includes = true;
- break;
case 'C':
if (pg_strcasecmp(optarg, "INFORMIX") == 0 || pg_strcasecmp(optarg, "INFORMIX_SE") == 0)
{
return ILLEGAL_OPTION;
}
break;
+ case 'd':
+#ifdef YYDEBUG
+ base_yydebug = 1;
+#else
+ fprintf(stderr, _("%s: parser debug support (-d) not available\n"),
+ progname);
+#endif
+ break;
+ case 'D':
+ add_preprocessor_define(optarg);
+ break;
+ case 'h':
+ header_mode = true;
+ /* this must include "-c" to make sense: */
+ auto_create_c = true;
+ break;
+ case 'i':
+ system_includes = true;
+ break;
+ case 'I':
+ add_include_path(optarg);
+ break;
+ case 'o':
+ output_filename = mm_strdup(optarg);
+ if (strcmp(output_filename, "-") == 0)
+ base_yyout = stdout;
+ else
+ base_yyout = fopen(output_filename, PG_BINARY_W);
+
+ if (base_yyout == NULL)
+ {
+ fprintf(stderr, _("%s: could not open file \"%s\": %s\n"),
+ progname, output_filename, strerror(errno));
+ output_filename = NULL;
+ }
+ else
+ out_option = 1;
+ break;
case 'r':
if (pg_strcasecmp(optarg, "no_indicator") == 0)
force_indicator = false;
return ILLEGAL_OPTION;
}
break;
- case 'D':
- add_preprocessor_define(optarg);
+ case 't':
+ autocommit = true;
break;
- case 'd':
-#ifdef YYDEBUG
- base_yydebug = 1;
-#else
- fprintf(stderr, _("%s: parser debug support (-d) not available\n"),
- progname);
-#endif
+ case 'v':
+ verbose = true;
+ break;
+ case ECPG_GETOPT_LONG_REGRESSION:
+ regression_mode = true;
break;
default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"), argv[0]);
PGresult *res;
int c;
- while ((c = getopt(argc, argv, "t:r:")) != -1)
+ while ((c = getopt(argc, argv, "r:t:")) != -1)
{
switch (c)
{
- case 't': /* trace file */
- tracefile = pg_strdup(optarg);
- break;
case 'r': /* numrows */
errno = 0;
numrows = strtol(optarg, NULL, 10);
exit(1);
}
break;
+ case 't': /* trace file */
+ tracefile = pg_strdup(optarg);
+ break;
}
}