ed

simple ed
git clone git://git.2f30.org/ed.git
Log | Files | Refs

commit 9998c75785e816148cc95f3b0032d14b53946d07
parent 2f36543e57275fe1736838e421b9cd248e20b706
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu Dec 10 11:46:00 +0100

Fix getlst() bug

The ungetc after the loop is noly needed when the loop
breaks in 'if ((c = getchar()) != ',' && c != ';')',
but the loop also can finish due to the maintain condition.

Diffstat:
ed.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/ed.c b/ed.c @@ -408,14 +408,15 @@ getlst() line1 = line2; line2 = ln; ++nlines; - skipblank(); - if ((c = getchar()) != ',' && c != ';') + skipblank(); + if ((c = getchar()) != ',' && c != ';') { + ungetc(c, stdin); break; + } if (c == ';') curln = line2; } - ungetc(c, stdin); if (nlines > 2) nlines = 2; else if (nlines <= 1)