If newcmd is 0 then error() undo all the modifications
that happened since the last command, but this is  not
what POSIX mandates:

SIGINT  The ed utility shall interrupt its current activity, write the
        string "?\n" to standard output, and return to command mode
        (see the EXTENDED DESCRIPTION section).
---
 ed.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ed.c b/ed.c
index 0705beb..4cba483 100644
--- a/ed.c
+++ b/ed.c
@@ -740,6 +740,7 @@ chksignals(void)
 
        if (intr) {
                intr = 0;
+               newcmd = 1;
                clearerr(stdin);
                error("Interrupt");
        }
-- 
2.37.3


Reply via email to