1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-31 10:30:33 +03:00

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.
This commit is contained in:
Andrew Dunstan
2012-03-03 16:39:26 -05:00
parent b59ca98209
commit 34c978442c
3 changed files with 48 additions and 1 deletions

View File

@@ -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))