commit a45474cfbb2de4a16592bf4fa7e19345cab03c5c
parent f6a1fbb9b1c6b5058371daeeb903a7e7a3643bbd
Author: Roberto E. Vargas Caballero <k0ga@shike2.net>
Date: Mon, 8 Dec 2025 18:03:44 +0100
ed: Accept no address in k command
Diffstat:
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/ed.c b/ed.c
@@ -1402,7 +1402,7 @@ repeat:
scroll(num);
break;
case 'k':
- if (nlines != 1)
+ if (nlines > 1)
goto bad_address;
if (!islower(c = input()))
error("invalid mark character");
diff --git a/tests/0009-ed.sh b/tests/0009-ed.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+ed -s /dev/null <<EOF | (read a && test $a == 1)
+a
+1
+2
+3
+4
+5
+6
+7
+8
+9
+.
+1s/^//
+ka
+9s/^//
+'a
+w
+EOF