summaryrefslogtreecommitdiff
path: root/readline
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2006-03-21 14:58:24 +0000
committerDaniel Jacobowitz <drow@false.org>2006-03-21 14:58:24 +0000
commita75b402ae4e4366cb70f319451c6e0e2026a0105 (patch)
tree972c7611a02f659badeca90002a3bee975cdeffc /readline
parent3e94bf1a01d6aebb1c4c9468c79c05cdbc5f7b38 (diff)
downloadbinutils-gdb-a75b402ae4e4366cb70f319451c6e0e2026a0105.tar.gz
* histfile.c (read_history_range): Remove '\r' character from
history lines.
Diffstat (limited to 'readline')
-rw-r--r--readline/ChangeLog.gdb5
-rw-r--r--readline/histfile.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/readline/ChangeLog.gdb b/readline/ChangeLog.gdb
index 28cb1f2ff35..863beca4441 100644
--- a/readline/ChangeLog.gdb
+++ b/readline/ChangeLog.gdb
@@ -1,3 +1,8 @@
+2006-03-21 Denis Pilat <denis.pilat@st.com>
+
+ * histfile.c (read_history_range): Remove '\r' character from
+ history lines.
+
2005-02-10 Denis Pilat <denis.pilat@st.com>
* readline/terminal.c (_rl_get_screen_size): Get console size from
diff --git a/readline/histfile.c b/readline/histfile.c
index 60a91251b7a..c19630dc8f3 100644
--- a/readline/histfile.c
+++ b/readline/histfile.c
@@ -228,7 +228,10 @@ read_history_range (filename, from, to)
for (line_end = line_start; line_end < bufend; line_end++)
if (*line_end == '\n')
{
- *line_end = '\0';
+ if (line_end - 1 >= line_start && *(line_end - 1) == '\r')
+ *(line_end - 1) = '\0';
+ else
+ *line_end = '\0';
if (*line_start)
add_history (line_start);