ed

simple ed
git clone git://git.2f30.org/ed
Log | Files | Refs | LICENSE

commit f7735113b25acaa45deff14ee7d5fb9340f5c05b
parent c93a476220887577076cf269cd31060f020e3458
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Thu,  3 Dec 2015 21:51:25 +0100

Move prompt printout to the main loop

This place is the best place where to print
the prompt, because it is impossible arrive
to the main loop from global commands.

Diffstat:
Med.c | 7+++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/ed.c b/ed.c @@ -929,10 +929,7 @@ readcmd(int isglobal) { int c; - if (!isglobal) { - if (optprompt) - fputs(prompt, stdout); - } else if ((c = getchar()) == '&') { + if (isglobal && (c = getchar()) == '&') { /* FIXME: this code can let garbage in the input stream */ if (getchar() != '\n') error("Unknown command"); @@ -1049,6 +1046,8 @@ main(int argc, char *argv[]) } for (;;) { + if (optprompt) + fputs(prompt, stdout); readcmd(0); getlst(); if (chkglobal())