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
     !cat
     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...

Why?

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.


Regards,
Antonio.

_______________________________________________
bug-ed mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-ed

Reply via email to