summaryrefslogtreecommitdiff
path: root/src/bin/psql/input.c
diff options
context:
space:
mode:
authorTom Lane2005-01-06 18:29:11 +0000
committerTom Lane2005-01-06 18:29:11 +0000
commita3f98d579534721d8c2aa890c8dda678f14098d8 (patch)
treecbfa68b06f0e751f49d8ed2b0120b5f8203c991f /src/bin/psql/input.c
parentb8139ea397e353f3539246b393f2283b4120d1e3 (diff)
Adjust lookup of client-side profile files (.pgpass and so on) as per
discussion on pgsql-hackers-win32 list. Documentation still needs to be tweaked --- I'm not sure how to refer to the APPDATA folder in user documentation.
Diffstat (limited to 'src/bin/psql/input.c')
-rw-r--r--src/bin/psql/input.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
index b216e98843f..e75c86f7f8c 100644
--- a/src/bin/psql/input.c
+++ b/src/bin/psql/input.c
@@ -3,18 +3,22 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.42 2005/01/01 05:43:08 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.43 2005/01/06 18:29:09 tgl Exp $
*/
#include "postgres_fe.h"
-#include "input.h"
-
-#include <errno.h>
+#include "input.h"
#include "pqexpbuffer.h"
#include "settings.h"
#include "tab-complete.h"
#include "common.h"
+#ifndef WIN32
+#define PSQLHISTORY ".psql_history"
+#else
+#define PSQLHISTORY "psql_history"
+#endif
+
/* Runtime options for turning off readline and history */
/* (of course there is no runtime command for doing that :) */
#ifdef USE_READLINE
@@ -32,14 +36,11 @@ enum histcontrol
#ifdef HAVE_ATEXIT
static void finishInput(void);
-
#else
/* designed for use with on_exit() */
static void finishInput(int, void *);
#endif
-#define PSQLHISTORY ".psql_history"
-
#ifdef USE_READLINE
static enum histcontrol
@@ -235,14 +236,12 @@ finishInput(int exitstatus, void *arg)
char *psql_history;
int hist_size;
- psql_history = pg_malloc(strlen(home) + 1 +
- strlen(PSQLHISTORY) + 1);
-
hist_size = GetVariableNum(pset.vars, "HISTSIZE", -1, -1, true);
-
if (hist_size >= 0)
stifle_history(hist_size);
+ psql_history = pg_malloc(strlen(home) + 1 +
+ strlen(PSQLHISTORY) + 1);
sprintf(psql_history, "%s/%s", home, PSQLHISTORY);
write_history(psql_history);
free(psql_history);