From fa74e8054bfe6743c7cdfd3228ede2f174bf7aa1 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Tue, 13 Jun 2017 12:18:46 -0400 Subject: [PATCH] Explain the prompting logic more fully. --- misc.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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) { -- 2.31.1