[hackers] [PATCH 6/6] ed: Don't undo commands in sigint

From: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Thu, 28 Dec 2023 17:51:01 +0100

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
_AT_@ -740,6 +740,7 @@ chksignals(void)
 
 	if (intr) {
 		intr = 0;
+		newcmd = 1;
 		clearerr(stdin);
 		error("Interrupt");
 	}
-- 
2.37.3
Received on Thu Dec 28 2023 - 17:51:01 CET

This archive was generated by hypermail 2.3.0 : Thu Dec 28 2023 - 18:00:34 CET