Source-Changes-HG archive

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

[src/trunk]: src/bin/sh When -x is set, show assignments to the loop variable...



details:   https://anonhg.NetBSD.org/src/rev/926c1b4da38a
branches:  trunk
changeset: 823423:926c1b4da38a
user:      kre <kre%NetBSD.org@localhost>
date:      Sat Apr 22 15:53:17 2017 +0000

description:
When -x is set, show assignments to the loop variable in a for loop.

diffstat:

 bin/sh/eval.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r e82838e13be0 -r 926c1b4da38a bin/sh/eval.c
--- a/bin/sh/eval.c     Sat Apr 22 15:12:59 2017 +0000
+++ b/bin/sh/eval.c     Sat Apr 22 15:53:17 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: eval.c,v 1.130 2017/02/02 19:26:37 christos Exp $      */
+/*     $NetBSD: eval.c,v 1.131 2017/04/22 15:53:17 kre Exp $   */
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c     8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.130 2017/02/02 19:26:37 christos Exp $");
+__RCSID("$NetBSD: eval.c,v 1.131 2017/04/22 15:53:17 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -419,6 +419,16 @@
                if (sp->next)
                        f |= EV_MORE;
 
+               if (xflag) {
+                       out2str(ps4val());
+                       out2str("for ");
+                       out2str(n->nfor.var);
+                       out2c('=');
+                       out2shstr(sp->text);
+                       out2c('\n');
+                       flushout(&errout);
+               }
+
                setvar(n->nfor.var, sp->text, 0);
                evaltree(n->nfor.body, f);
                status = exitstatus;



Home | Main Index | Thread Index | Old Index