diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-12-24 19:14:28 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-12-24 19:14:28 +0000 |
commit | 506a9893b7c078ad8dc739ea6872f9f6cc7bd59e (patch) | |
tree | de2f5cba6da1b7d3e48e8306ddadcb1914b408ee /src | |
parent | 57f1630cf096d5e173e5de80f50ad1bf66e15587 (diff) | |
download | postgresql-506a9893b7c078ad8dc739ea6872f9f6cc7bd59e.tar.gz postgresql-506a9893b7c078ad8dc739ea6872f9f6cc7bd59e.zip |
Make HISTCONTROL=ignoredups work again (broken by misordering of
operations during recent code refactoring). Per bug #2840 from Ned Crigler.
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/input.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c index befee863571..9d2b8c9d962 100644 --- a/src/bin/psql/input.c +++ b/src/bin/psql/input.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2006, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.60 2006/10/04 00:30:06 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.61 2006/12/24 19:14:28 tgl Exp $ */ #include "postgres_fe.h" @@ -111,6 +111,12 @@ pg_send_history(PQExpBuffer history_buf) static char *prev_hist = NULL; char *s = history_buf->data; + int i; + + /* Trim any trailing \n's (OK to scribble on history_buf) */ + for (i = strlen(s) - 1; i >= 0 && s[i] == '\n'; i--) + ; + s[i + 1] = '\0'; if (useHistory && s[0]) { @@ -123,12 +129,6 @@ pg_send_history(PQExpBuffer history_buf) } else { - int i; - - /* Trim any trailing \n's (OK to scribble on history_buf) */ - for (i = strlen(s) - 1; i >= 0 && s[i] == '\n'; i--) - ; - s[i + 1] = '\0'; /* Save each previous line for ignoredups processing */ if (prev_hist) free(prev_hist); |