2006-10-11 Denis Pilat <denis.pilat@st.com>
authorFrederic Riss <frederic.riss@st.com>
Wed, 11 Oct 2006 10:50:07 +0000 (10:50 +0000)
committerFrederic Riss <frederic.riss@st.com>
Wed, 11 Oct 2006 10:50:07 +0000 (10:50 +0000)
* tui/tui-source.c (tui_set_source_content): handle source
files that contain non unix end-of-line.

gdb/ChangeLog
gdb/tui/tui-source.c

index 10993b3fae741439c748e0802b2f321eadaee06a..ab1f1f94965f21416a99a689b48b0d1af6c187f7 100644 (file)
@@ -1,3 +1,8 @@
+2006-10-11  Denis Pilat  <denis.pilat@st.com>
+
+       * tui/tui-source.c (tui_set_source_content): handle source 
+       files that contain non unix end-of-line.
+       
 2006-10-10  Daniel Jacobowitz  <dan@codesourcery.com>
 
        * ser-mingw.c (free_pipe_state, pipe_wait_handle): Update
index c7bcea684830a86cba9e66eaabd0160f5257744d..34603244a8c4e4f4dff0932e81f9583e653cee5d 100644 (file)
@@ -194,6 +194,14 @@ tui_set_source_content (struct symtab *s, int line_no, int noerror)
                                            chars until we do  */
                                  while (c != EOF && c != '\n' && c != '\r')
                                    c = fgetc (stream);
+                                 /* Handle non-'\n' end-of-line.  */
+                                 if (c == '\r' &&
+                                    (c = fgetc (stream)) != '\n' && c != EOF)
+                                   {
+                                      ungetc (c, stream);
+                                      c = '\r';
+                                   }
+                                 
                                }
                            }
                          while (c != EOF && c != '\n' && c != '\r' &&