From 861cf606cb1195b79daff1ae5a0202ea7b9679bd Mon Sep 17 00:00:00 2001 From: Frederic Riss Date: Wed, 11 Oct 2006 10:50:07 +0000 Subject: [PATCH] 2006-10-11 Denis Pilat * tui/tui-source.c (tui_set_source_content): handle source files that contain non unix end-of-line. --- gdb/ChangeLog | 5 +++++ gdb/tui/tui-source.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 10993b3fae7..ab1f1f94965 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2006-10-11 Denis Pilat + + * tui/tui-source.c (tui_set_source_content): handle source + files that contain non unix end-of-line. + 2006-10-10 Daniel Jacobowitz * ser-mingw.c (free_pipe_state, pipe_wait_handle): Update diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index c7bcea68483..34603244a8c 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -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' && -- 2.30.2