summaryrefslogtreecommitdiff
path: root/src/bin/psql/input.c
diff options
context:
space:
mode:
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);