summaryrefslogtreecommitdiff
path: root/readline/histfile.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2006-03-21 14:58:24 +0000
committerDaniel Jacobowitz <dan@debian.org>2006-03-21 14:58:24 +0000
commita7d7a275a15ea4f16a9638e62967d121a7e39f0a (patch)
tree0e197836ff7f386ff192c979bff77f720c05af8e /readline/histfile.c
parentdc33be2ad3aabdda110aa6ce83d821b743889023 (diff)
downloadgdb-a7d7a275a15ea4f16a9638e62967d121a7e39f0a.tar.gz
* histfile.c (read_history_range): Remove '\r' character from
history lines.
Diffstat (limited to 'readline/histfile.c')
-rw-r--r--readline/histfile.c5
1 files changed, 4 insertions, 1 deletions
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);