Source-Changes-HG archive

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

[src/trunk]: src/bin/sh NFC - DEBUG mode only change - complete a change made...



details:   https://anonhg.NetBSD.org/src/rev/061a57cfc9c6
branches:  trunk
changeset: 824762:061a57cfc9c6
user:      kre <kre%NetBSD.org@localhost>
date:      Sat Jun 17 12:16:16 2017 +0000

description:
NFC - DEBUG mode only change - complete a change made earlier (marking
the line number when included in the trace line tag to show whether it
comes from the parser, or the elsewhere as they tend to be quite different).
Initially only one case was changed, while I pondered whether I liked it
or not.  Now it is all done...   Also when there is a line tag at all,
always include the root/sub-shell indicator character, not only when the
pid is included.

diffstat:

 bin/sh/show.c |  22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diffs (59 lines):

diff -r 458b176ec55f -r 061a57cfc9c6 bin/sh/show.c
--- a/bin/sh/show.c     Sat Jun 17 12:12:50 2017 +0000
+++ b/bin/sh/show.c     Sat Jun 17 12:16:16 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: show.c,v 1.45 2017/06/17 04:16:33 kre Exp $    */
+/*     $NetBSD: show.c,v 1.46 2017/06/17 12:16:16 kre Exp $    */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)show.c     8.3 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: show.c,v 1.45 2017/06/17 04:16:33 kre Exp $");
+__RCSID("$NetBSD: show.c,v 1.46 2017/06/17 12:16:16 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -933,6 +933,7 @@
        char indent[16];
        char *p;
        int lno;
+       char c;
 
        if (DFlags & DBG_NEST) {
                if ((unsigned)ShNest >= sizeof indent - 1) {
@@ -961,23 +962,24 @@
        else
                lno = line_number;
 
+       c = ((i = getpid()) == tf->pid) ? ':' : '=';
+
        if (DFlags & DBG_PID) {
-               i = getpid();
                if (DFlags & DBG_LINE)
-                       (void) asprintf(&p, "%5d%c%s\t%4d%c@\t", i,
-                           i == tf->pid ? ':' : '=', indent, lno, parsing?'-':'+');
+                       (void) asprintf(&p, "%5d%c%s\t%4d%c@\t", i, c,
+                           indent, lno, parsing?'-':'+');
                else
-                       (void) asprintf(&p, "%5d%c%s\t", i,
-                           i == tf->pid ? ':' : '=', indent);
+                       (void) asprintf(&p, "%5d%c%s\t", i, c, indent);
                return p;
        } else if (DFlags & DBG_NEST) {
                if (DFlags & DBG_LINE)
-                       (void) asprintf(&p, "%s\t%4d @\t", indent, lno);
+                       (void) asprintf(&p, "%c%s\t%4d%c@\t", c, indent, lno,
+                           parsing?'-':'+');
                else
-                       (void) asprintf(&p, "%s\t", indent);
+                       (void) asprintf(&p, "%c%s\t", c, indent);
                return p;
        } else if (DFlags & DBG_LINE) {
-               (void) asprintf(&p, "%4d @\t", lno);
+               (void) asprintf(&p, "%c%4d%c@\t", c, lno, parsing?'-':'+');
                return p;
        }
        return NULL;



Home | Main Index | Thread Index | Old Index