OSDN Git Service

* histfile.c (read_history_range): Remove '\r' character from
[pf3gnuchains/pf3gnuchains3x.git] / readline / histfile.c
index 60a9125..c19630d 100644 (file)
@@ -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);