From: Daniel Jacobowitz Date: Tue, 21 Mar 2006 14:58:24 +0000 (+0000) Subject: * histfile.c (read_history_range): Remove '\r' character from X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a75b402ae4e4366cb70f319451c6e0e2026a0105;p=binutils-gdb.git * histfile.c (read_history_range): Remove '\r' character from history lines. --- 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 + + * histfile.c (read_history_range): Remove '\r' character from + history lines. + 2005-02-10 Denis Pilat * 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);