git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f7d9874)
Use 0x01 for newlines in saved history. It was determined to be not
2006年2月12日 05:24:38 +0000 (05:24 +0000)
2006年2月12日 05:24:38 +0000 (05:24 +0000)
used by multi-byte sequences, but futher invesetigation might prove this
to be false.


diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c
index 1b6e48cff3c24b1f9711d3b4abaeb7c860c512cb..6b1f78af0a43d9c8dafe6082e62e2357e629975f 100644 (file)
--- a/src/bin/psql/input.c
+++ b/src/bin/psql/input.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.47 2006年02月11日 21:55:35 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.48 2006年02月12日 05:24:38 momjian Exp $
*/
#include "postgres_fe.h"
@@ -26,6 +26,15 @@ static bool useReadline;
static bool useHistory;
char *psql_history;
+/*
+ * Preserve newlines in saved queries by mapping '\n' to NL_IN_HISTORY
+ *
+ * It is assumed NL_IN_HISTORY will never be entered by the user
+ * nor appear inside a multi-byte string. 0x00 is not properly
+ * handled by the readline routines so it can not be used
+ * for this purpose.
+ */
+#define NL_IN_HISTORY 0x01
enum histcontrol
{
@@ -213,7 +222,7 @@ static void encode_history()
cur_hist; cur_hist = next_history())
for (cur_ptr = cur_hist->line; *cur_ptr; cur_ptr++)
if (*cur_ptr == '\n')
- *cur_ptr = '0円';
+ *cur_ptr = NL_IN_HISTORY;
}
static void decode_history()
@@ -224,7 +233,7 @@ static void decode_history()
for (history_set_pos(0), cur_hist = current_history();
cur_hist; cur_hist = next_history())
for (cur_ptr = cur_hist->line; *cur_ptr; cur_ptr++)
- if (*cur_ptr == '0円')
+ if (*cur_ptr == NL_IN_HISTORY)
*cur_ptr = '\n';
}
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /