[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-ed] ed EOF behavior

From: Antonio Diaz Diaz
Subject: Re: [Bug-ed] ed EOF behavior
Date: Wed, 30 Jan 2013 17:52:37 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.11) Gecko/20050905

Andrew Moore wrote:
Restoring GNU ed-1.7's  get_tty_line() function to its GNU ed 0.2
equivalent (patch below) exposes another bug, presumably in GNU
ed-1.7's append_lines().  So while Andrea's patch does indeed appear
to address the annoying behavior of EOF in GNU ed-1.7, without
looking deeper, I wonder whether it may not be masking more problems?
"Double EOF" is a bug.

OK, lets begin another round of bug hunting in ed. :-)

In a few days I'll release ed-1.8-rc1 with the "Double EOF" behavior removed. If this is masking any problems, we'll discover and fix them.

A comment should also be added at the top of  get_tty_line() that seems 
relevant to Andrea' s efforts:
  /* Read stdin one character at a time to avoid i/o contention
     with shell escapes invoked by nonterminal input, e.g.,
     ed - <<EOF
     hello, world
     EOF */

This is interesting, but not the only reason to read stdin one character at a time. Long lines and null characters are also reasons to read stdin this way.

Finally, equating the null character '\0' with (int) 0 is asking for trouble...


The C standard states clearly that:
1) An integer character constant has type int.
2) The value of the escape sequence '\0' is 0.

So they are equivalent.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]