From: Eric S. Raymond Date: Tue, 13 Jun 2017 16:18:46 +0000 (-0400) Subject: Explain the prompting logic more fully. X-Git-Tag: 1.1~348 X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=commitdiff_plain;h=fa74e8054bfe6743c7cdfd3228ede2f174bf7aa1 Explain the prompting logic more fully. --- diff --git a/misc.c b/misc.c index b0ee4b6..71f1214 100644 --- a/misc.c +++ b/misc.c @@ -549,11 +549,21 @@ bool MAPLIN(FILE *fp) * several cases with different requirements and partly because * of a quirk in linenoise(). * - * The quirk shows up when you feed the program a test log on stdin. - * While fgets (as expected) consumes it a line at a time, linenoise() - * returns the first line and discards the rest. Thus, there needs to - * be an editline (-s) option to fall back to fgets while still - * prompting. + * The quirk shows up when you paste a test log from the clipboard + * to the program's command prompt. While fgets (as expected) + * consumes it a line at a time, linenoise() returns the first + * line and discards the rest. Thus, there needs to be an + * editline (-s) option to fall back to fgets while still + * prompting. Note that linenoise does behave properly when + * fed redirected stdin. + * + * The logging is a bit of a mess because there are two distinct cases + * in which you want to echo commands. One is when shipping them to + * a log under the -l option, in which case you want to suppress + * prompt generation (so test logs are unadorned command sequences). + * On the other hand, if you redireceted stdin and are feeding the program + * a logfile, you *do* want prompt generation - it makes checkfiles + * easier to read when the commands are maked by a preceding prompt. */ do { if (!editline) {