commit 03b9f92b5de90422f33b29c45629a3932e31a7b0
parent e78813a41db558f6b42175d73378439b326f78e2
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 10 Dec 2015 18:52:05 +0100
Remove parameter of docmd()
This parameter was creating problems in global commands,
because was not clear what to pass to it. In this case
it is better let to docmd() to read the command.
Diffstat:
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/ed.c b/ed.c
@@ -747,13 +747,14 @@ execsh(void)
}
static void
-docmd(char cmd)
+docmd(void)
{
- char *s;
+ char *s, cmd;
int rep = 0, c, line3, num, trunc;
repeat:
skipblank();
+ cmd = input();
trunc = pflag = 0;
switch (cmd) {
case '&':
@@ -764,7 +765,6 @@ repeat:
rep = 1;
repidx = 0;
getlst();
- cmd = input();
goto repeat;
case '!':
execsh();
@@ -936,6 +936,8 @@ print:
doprint();
save_last_cmd:
+ if (!uflag)
+ repidx = 0;
if (rep)
return;
free(ocmdline);
@@ -984,6 +986,7 @@ doglobal(void)
char *s, c;
skipblank();
+ cmdsiz = 0;
if (uflag)
chkprint(0);
@@ -998,7 +1001,7 @@ doglobal(void)
pflag = 0;
doprint();
}
- docmd('&');
+ docmd();
}
}
@@ -1082,7 +1085,7 @@ main(int argc, char *argv[])
if (optprompt)
fputs(prompt, stdout);
getlst();
- chkglobal() ? doglobal() : docmd(input());
+ chkglobal() ? doglobal() : docmd();
}
/* not reached */