commit 80c2cda614620d10054464447dc8c4b4399a27d8
parent b887c9efd18179da5b6f5296afac9edec3b7bf24
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 3 Dec 2015 09:05:46 +0100
Fix global commands with user input
When a global command with user input (G or V) reads a line
with & it means that the last command must be repeated,
and the code was wrong because in this case a new command
was read.
Diffstat:
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/ed.c b/ed.c
@@ -919,9 +919,11 @@ readcmd(int isglobal)
int c;
if (isglobal && (c = getchar()) == '&') {
+ /* FIXME: this code can let garbage in the input stream */
if (getchar() != '\n')
- error(""); /* TODO: what error? */
+ error("Unknown command");
cmdp = buf;
+ return;
}
for (s = buf;; *s++ = c) {