Received: by mail.netbsd.org (Postfix, from userid 605) id 126E2855B4; Wed, 7 Jun 2017 05:08:34 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id 93D27855B0 for ; Wed, 7 Jun 2017 05:08:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at netbsd.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.netbsd.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id xXp9Pj7FmZrZ for ; Wed, 7 Jun 2017 05:08:33 +0000 (UTC) Received: from cvs.NetBSD.org (ivanova.NetBSD.org [IPv6:2001:470:a085:999:28c:faff:fe03:5984]) by mail.netbsd.org (Postfix) with ESMTP id F1DF684D72 for ; Wed, 7 Jun 2017 05:08:32 +0000 (UTC) Received: by cvs.NetBSD.org (Postfix, from userid 500) id E4349FAB6; Wed, 7 Jun 2017 05:08:32 +0000 (UTC) Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" MIME-Version: 1.0 Date: Wed, 7 Jun 2017 05:08:32 +0000 From: "Robert Elz" Subject: CVS commit: src/bin/sh To: source-changes@NetBSD.org X-Mailer: log_accum Message-Id: <20170607050832.E4349FAB6@cvs.NetBSD.org> Sender: source-changes-owner@NetBSD.org List-Id: source-changes.NetBSD.org Precedence: bulk Reply-To: source-changes-d@NetBSD.org Mail-Reply-To: "Robert Elz" Mail-Followup-To: source-changes-d@NetBSD.org List-Unsubscribe: Module Name: src Committed By: kre Date: Wed Jun 7 05:08:32 UTC 2017 Modified Files: src/bin/sh: arith_token.c arith_tokens.h arithmetic.c arithmetic.h eval.c exec.c exec.h expand.c expand.h input.c jobs.c nodetypes option.list parser.c parser.h sh.1 show.c syntax.c syntax.h var.c var.h Log Message: A better LINENO implementation. This version deletes (well, #if 0's out) the LINENO hack, and uses the LINENO var for both ${LINENO} and $((LINENO)). (Code to invert the LINENO hack when required, like when de-compiling the execution tree to provide the "jobs" command strings, is still included, that can be deleted when the LINENO hack is completely removed - look for refs to VSLINENO throughout the code. The var funclinno in parser.c can also be removed, it is used only for the LINENO hack.) This version produces accurate results: $((LINENO)) was made as accurate as the LINENO hack made ${LINENO} which is very good. That's why the LINENO hack is not yet completely removed, so it can be easily re-enabled. If you can tell the difference when it is in use, or not in use, then something has broken (or I managed to miss a case somewhere.) The way that LINENO works is documented in its own (new) section in the man page, so nothing more about that, or the new options, etc, here. This version introduces the possibility of having a "reference" function associated with a variable, which gets called whenever the value of the variable is required (that's what implements LINENO). There is just one function pointer however, so any particular variable gets at most one of the set function (as used for PATH, etc) or the reference function. The VFUNCREF bit in the var flags indicates which func the variable in question uses (if any - the func ptr, as before, can be NULL). I would not call the results of this perfect yet, but it is close. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/bin/sh/arith_token.c cvs rdiff -u -r1.1 -r1.2 src/bin/sh/arith_tokens.h src/bin/sh/arithmetic.h cvs rdiff -u -r1.2 -r1.3 src/bin/sh/arithmetic.c src/bin/sh/option.list cvs rdiff -u -r1.142 -r1.143 src/bin/sh/eval.c cvs rdiff -u -r1.48 -r1.49 src/bin/sh/exec.c cvs rdiff -u -r1.25 -r1.26 src/bin/sh/exec.h cvs rdiff -u -r1.112 -r1.113 src/bin/sh/expand.c cvs rdiff -u -r1.22 -r1.23 src/bin/sh/expand.h cvs rdiff -u -r1.57 -r1.58 src/bin/sh/input.c cvs rdiff -u -r1.85 -r1.86 src/bin/sh/jobs.c cvs rdiff -u -r1.16 -r1.17 src/bin/sh/nodetypes cvs rdiff -u -r1.133 -r1.134 src/bin/sh/parser.c cvs rdiff -u -r1.21 -r1.22 src/bin/sh/parser.h cvs rdiff -u -r1.148 -r1.149 src/bin/sh/sh.1 cvs rdiff -u -r1.42 -r1.43 src/bin/sh/show.c cvs rdiff -u -r1.3 -r1.4 src/bin/sh/syntax.c cvs rdiff -u -r1.7 -r1.8 src/bin/sh/syntax.h cvs rdiff -u -r1.56 -r1.57 src/bin/sh/var.c cvs rdiff -u -r1.29 -r1.30 src/bin/sh/var.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.