Source-Changes-HG archive

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

[src/trunk]: src/bin/sh DEBUG mode only change. When pretty-printing a word...



details:   https://anonhg.NetBSD.org/src/rev/904afe02df26
branches:  trunk
changeset: 448937:904afe02df26
user:      kre <kre%NetBSD.org@localhost>
date:      Thu Feb 14 13:27:59 2019 +0000

description:
DEBUG mode only change.   When pretty-printing a word from a parse
tree, don't display a CTLESC which is there only to protect a CTL*
char (a data char that happens to have the same value).  No actual
CTL* chars are printed as data, so no escaping is needed to protect
data which just happens to look the same.  Dropping this avoids the
possibility of confusion/ambiguity in what the word actually contains.

NFC for any normal shell build (very little of this file gets compiled there)

diffstat:

 bin/sh/show.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 234956e73062 -r 904afe02df26 bin/sh/show.c
--- a/bin/sh/show.c     Thu Feb 14 12:49:28 2019 +0000
+++ b/bin/sh/show.c     Thu Feb 14 13:27:59 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: show.c,v 1.52 2019/01/22 13:48:28 kre Exp $    */
+/*     $NetBSD: show.c,v 1.53 2019/02/14 13:27:59 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.52 2019/01/22 13:48:28 kre Exp $");
+__RCSID("$NetBSD: show.c,v 1.53 2019/02/14 13:27:59 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -645,7 +645,8 @@
        for (p = arg->narg.text ; *p ; p++) {
                switch (*p) {
                case CTLESC:
-                       trace_putc('\\', fp);
+                       if (BASESYNTAX[p[1]] != CCTL)
+                               trace_putc('\\', fp);
                        trace_putc(*++p, fp);
                        break;
 



Home | Main Index | Thread Index | Old Index