summaryrefslogtreecommitdiff
path: root/src/bin/psql/startup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/startup.c')
-rw-r--r--src/bin/psql/startup.c28
1 files changed, 8 insertions, 20 deletions
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index d08b15886aa..ddff9039158 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -217,10 +217,7 @@ main(int argc, char *argv[])
/* Bail out if -1 was specified but will be ignored. */
if (options.single_txn && options.actions.head == NULL)
- {
- pg_log_fatal("-1 can only be used in non-interactive mode");
- exit(EXIT_FAILURE);
- }
+ pg_fatal("-1 can only be used in non-interactive mode");
if (!pset.popt.topt.fieldSep.separator &&
!pset.popt.topt.fieldSep.separator_zero)
@@ -343,11 +340,8 @@ main(int argc, char *argv[])
{
pset.logfile = fopen(options.logfilename, "a");
if (!pset.logfile)
- {
- pg_log_fatal("could not open log file \"%s\": %m",
- options.logfilename);
- exit(EXIT_FAILURE);
- }
+ pg_fatal("could not open log file \"%s\": %m",
+ options.logfilename);
}
if (!options.no_psqlrc)
@@ -608,10 +602,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts *options)
}
if (!result)
- {
- pg_log_fatal("could not set printing parameter \"%s\"", value);
- exit(EXIT_FAILURE);
- }
+ pg_fatal("could not set printing parameter \"%s\"", value);
free(value);
break;
@@ -717,10 +708,10 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts *options)
break;
default:
unknown_option:
- fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
- pset.progname);
+ /* getopt_long already emitted a complaint */
+ pg_log_error_hint("Try \"%s --help\" for more information.",
+ pset.progname);
exit(EXIT_FAILURE);
- break;
}
}
@@ -782,10 +773,7 @@ process_psqlrc(char *argv0)
char *envrc = getenv("PSQLRC");
if (find_my_exec(argv0, my_exec_path) < 0)
- {
- pg_log_fatal("could not find own program executable");
- exit(EXIT_FAILURE);
- }
+ pg_fatal("could not find own program executable");
get_etc_path(my_exec_path, etc_path);