From 34c978442c55dd13a3a8c6b90fd4380dad02f3da Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Sat, 3 Mar 2012 16:39:26 -0500 Subject: Provide environment overrides for psql file locations. PSQL_HISTORY provides an alternative for the command history file, and PSQLRC provides an alternative location for the .psqlrc file. --- src/bin/psql/input.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/bin/psql/input.c') diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c index d77a731c2e..880e7e6511 100644 --- a/src/bin/psql/input.c +++ b/src/bin/psql/input.c @@ -285,6 +285,15 @@ initializeInput(int flags) history_lines_added = 0; histfile = GetVariable(pset.vars, "HISTFILE"); + + if (histfile == NULL) + { + char * envhist; + envhist = getenv("PSQL_HISTORY"); + if (envhist != NULL && strlen(envhist) > 0) + histfile = envhist; + } + if (histfile == NULL) { if (get_home_path(home)) -- cgit v1.2.1