ed

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

commit 58256e78b16e86845a977e76c42979e3b5e33fef
parent 4568edf5ad83f1c2301fbbfd37255ac5d0cd61e2
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu, 10 Dec 2015 23:29:47 +0100

Do not decrement size of command when EOF

EOF is not added to the array, so it is an error
decrement the size of the array when we ungetc
EOF.

Diffstat:
Med.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ed.c b/ed.c @@ -117,7 +117,8 @@ back(int c) --repidx; } else { ungetc(c, stdin); - --cmdsiz; + if (c != EOF) + --cmdsiz; } return c; } @@ -817,6 +818,8 @@ repeat: execsh(); break; case EOF: + if (cmdsiz == 0) + quit(); case '\n': num = gflag ? curln : curln+1; deflines(num, num);