commit 6a557314b97a256f21a9964a6fb47f7b08427455
Author: Roberto E. Vargas Caballero <[email protected]>
AuthorDate: Thu Dec 28 17:26:50 2023 +0100
Commit: Roberto E. Vargas Caballero <[email protected]>
CommitDate: Thu Dec 28 17:26:50 2023 +0100
ed: Don't undo commands in sigint
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).
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");
}