aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2004-10-08 11:24:19 +0000
committerNeil Conway <neilc@samurai.com>2004-10-08 11:24:19 +0000
commit9bf6effd8e78ed4cfed8f14d36d055e66943461e (patch)
treeb5b55e5fbd5c5912b2928c6b4b6672011ebf7af9
parent79a831e50a7020915c69defa360c206d669316bc (diff)
downloadpostgresql-9bf6effd8e78ed4cfed8f14d36d055e66943461e.tar.gz
postgresql-9bf6effd8e78ed4cfed8f14d36d055e66943461e.zip
Another minor tweak to psql startup: set the default values for the PROMPT1,
PROMPT2 and PROMPT3 variables before we read any of the settings specified via the user on the command-line or in psqlrc, so that the latter can override the former. Per original patch from Ingo van Lil, simpler fix suggested by Tom Lane.
-rw-r--r--src/bin/psql/startup.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index 01aba011b2e..3af3bc789d7 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.102 2004/10/06 08:20:58 neilc Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.103 2004/10/08 11:24:19 neilc Exp $
*/
#include "postgres_fe.h"
@@ -140,9 +140,13 @@ main(int argc, char *argv[])
SetVariable(pset.vars, "VERSION", PG_VERSION_STR);
- /* Default values for variables that are used in noninteractive cases */
+ /* Default values for variables */
SetVariableBool(pset.vars, "AUTOCOMMIT");
SetVariable(pset.vars, "VERBOSITY", "default");
+ SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1);
+ SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2);
+ SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3);
+
pset.verbosity = PQERRORS_DEFAULT;
pset.notty = (!isatty(fileno(stdin)) || !isatty(fileno(stdout)));
@@ -300,11 +304,6 @@ main(int argc, char *argv[])
#endif
}
- /* Default values for variables that are used in interactive case */
- SetVariable(pset.vars, "PROMPT1", DEFAULT_PROMPT1);
- SetVariable(pset.vars, "PROMPT2", DEFAULT_PROMPT2);
- SetVariable(pset.vars, "PROMPT3", DEFAULT_PROMPT3);
-
if (!pset.notty)
initializeInput(options.no_readline ? 0 : 1);
if (options.action_string) /* -f - was used */