Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Denis PILAT <denis.pilat@st.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [TUI] correctly display windows source files
Date: Wed, 11 Oct 2006 08:02:00 -0000	[thread overview]
Message-ID: <452CA4EC.9060700@st.com> (raw)
In-Reply-To: <ufydvkgoa.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]

>
>
>That could be so, but I'd prefer that our code didn't do anything that
>could fail, even theoretically.  We shouldn't call functions with
>arguments that invoke undefined or uncertain behavior.
>
>It should be a simple matter of adding a test for EOF.
>
You're right, I can not do testing on all hosts and libc.
Attached a new proposal.

In the case of "'\r'EOF" we keep EOF in "c" variable and we exit the 
while just below anyway.

Denis

[-- Attachment #2: tui-source.c.patch --]
[-- Type: text/plain, Size: 789 bytes --]

2006-10-09  Denis Pilat  <denis.pilat@st.com>

	* tui-source.c (tui_set_source_content): handle source files that 
	contain non unix end-of-line.

Index: tui/tui-source.c
===================================================================
--- tui/tui-source.c	(revision 529)
+++ tui/tui-source.c	(working copy)
@@ -194,6 +194,14 @@ tui_set_source_content (struct symtab *s
                                            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' &&

  reply	other threads:[~2006-10-11  8:02 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-09 15:25 Denis PILAT
2006-10-09 18:01 ` Mark Kettenis
2006-10-09 19:28 ` Eli Zaretskii
2006-10-10 13:23   ` Denis PILAT
2006-10-10 15:08     ` '\r' only end-of-line Denis PILAT
2006-10-10 21:34       ` Eli Zaretskii
2006-10-11 10:08         ` Denis PILAT
2006-10-11 13:33           ` Daniel Jacobowitz
2006-10-11 13:57             ` Andrew STUBBS
2006-10-11 14:01               ` Daniel Jacobowitz
2006-10-11 14:44                 ` Andrew STUBBS
2006-10-11 15:05                   ` Daniel Jacobowitz
2006-10-11 17:47             ` Eli Zaretskii
2006-10-11 17:36           ` Eli Zaretskii
2006-10-16  8:51             ` Denis PILAT
2006-10-10 21:24     ` [TUI] correctly display windows source files Eli Zaretskii
2006-10-11  8:02       ` Denis PILAT [this message]
2006-10-11  8:39         ` Eli Zaretskii
2006-10-11 11:23           ` Frederic RISS

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=452CA4EC.9060700@st.com \
    --to=denis.pilat@st.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox