Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make: rename PrintOutput to PrintFilteredOutput...



details:   https://anonhg.NetBSD.org/src/rev/66171387f8e4
branches:  trunk
changeset: 1020554:66171387f8e4
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Apr 15 18:36:17 2021 +0000

description:
make: rename PrintOutput to PrintFilteredOutput to avoid confusion

In the default configuration, the function PrintOutput did nothing.
Only if the shell has defined an output filter, something happens at
all.

diffstat:

 usr.bin/make/job.c |  23 +++++++++++++----------
 1 files changed, 13 insertions(+), 10 deletions(-)

diffs (62 lines):

diff -r 0dbfd00ee3f6 -r 66171387f8e4 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Thu Apr 15 18:21:27 2021 +0000
+++ b/usr.bin/make/job.c        Thu Apr 15 18:36:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.425 2021/04/15 18:21:27 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.426 2021/04/15 18:36:17 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.425 2021/04/15 18:21:27 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.426 2021/04/15 18:36:17 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -1724,12 +1724,15 @@
 }
 
 /*
- * Print the output of the shell command, skipping the noPrint text of the
- * shell, if any.  The default shell does not have noPrint though, which means
- * that in all practical cases, handling the output is left to the caller.
+ * If the shell has an output filter (which only csh and ksh have by default),
+ * print the output of the child process, skipping the noPrint text of the
+ * shell.
+ *
+ * Return the part of the output that the calling function needs to output by
+ * itself.
  */
 static char *
-PrintOutput(char *cp, char *endp)      /* XXX: should all be const */
+PrintFilteredOutput(char *cp, char *endp)      /* XXX: should all be const */
 {
        char *ecp;              /* XXX: should be const */
 
@@ -1835,8 +1838,8 @@
                } else if (job->outBuf[i] == '\0') {
                        /*
                         * FIXME: The null characters are only replaced with
-                        * space in the last line.  Everywhere else they hide
-                        * the rest of the command output.
+                        * space _after_ the last '\n'.  Everywhere else they
+                        * hide the rest of the command output.
                         */
                        job->outBuf[i] = ' ';
                }
@@ -1874,10 +1877,10 @@
                         * do anything in the default shell, this bug has gone
                         * unnoticed until now.
                         */
-                       cp = PrintOutput(job->outBuf, &job->outBuf[i]);
+                       cp = PrintFilteredOutput(job->outBuf, &job->outBuf[i]);
 
                        /*
-                        * There's still more in that thar buffer. This time,
+                        * There's still more in the output buffer. This time,
                         * though, we know there's no newline at the end, so
                         * we add one of our own free will.
                         */



Home | Main Index | Thread Index | Old Index