]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - lib/readline/histfile.c
Imported from ../bash-3.2.tar.gz.
[thirdparty/bash.git] / lib / readline / histfile.c
index 717bbee6fd73ed22f95c44906df70bf4872c954a..2f051a325631f6755ee54a7d36fa5e0a85fec230 100644 (file)
@@ -256,7 +256,11 @@ read_history_range (filename, from, to)
   for (line_end = line_start; line_end < bufend; line_end++)
     if (*line_end == '\n')
       {
-       *line_end = '\0';
+       /* Change to allow Windows-like \r\n end of line delimiter. */
+       if (line_end > line_start && line_end[-1] == '\r')
+         line_end[-1] = '\0';
+       else
+         *line_end = '\0';
 
        if (*line_start)
          {