Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/sh Improve the (new) LINENO section, markup changes (wit...
details: https://anonhg.NetBSD.org/src/rev/07438bf765a3
branches: trunk
changeset: 354216:07438bf765a3
user: kre <kre%NetBSD.org@localhost>
date: Thu Jun 08 02:23:51 2017 +0000
description:
Improve the (new) LINENO section, markup changes (with thanks to wiz@ for
assistace) and some better wording in a few placed.
diffstat:
bin/sh/Makefile | 6 ++++--
bin/sh/eval.c | 7 ++++---
bin/sh/sh.1 | 29 ++++++++++++++++++-----------
3 files changed, 26 insertions(+), 16 deletions(-)
diffs (130 lines):
diff -r f91050f015f0 -r 07438bf765a3 bin/sh/Makefile
--- a/bin/sh/Makefile Thu Jun 08 01:23:01 2017 +0000
+++ b/bin/sh/Makefile Thu Jun 08 02:23:51 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.110 2017/05/29 14:03:23 kre Exp $
+# $NetBSD: Makefile,v 1.111 2017/06/08 02:23:51 kre Exp $
# @(#)Makefile 8.4 (Berkeley) 5/5/95
.include <bsd.own.mk>
@@ -26,9 +26,11 @@
CPPFLAGS+=-DSHELL -I. -I${.CURDIR}
#XXX: For testing only.
#CPPFLAGS+=-DDEBUG=3
-#COPTS+=-g
+CPPFLAGS+=-DDEBUG=1
+COPTS+=-g
#CFLAGS+=-funsigned-char
#TARGET_CHARFLAG?= -DTARGET_CHAR="unsigned char" -funsigned-char
+CFLAGS+=-Wall
# Reproducible build parameters ... export into sh for NETBSD_SHELL setting
.if ${MKREPRO_TIMESTAMP:Uno} != "no"
diff -r f91050f015f0 -r 07438bf765a3 bin/sh/eval.c
--- a/bin/sh/eval.c Thu Jun 08 01:23:01 2017 +0000
+++ b/bin/sh/eval.c Thu Jun 08 02:23:51 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: eval.c,v 1.143 2017/06/07 05:08:32 kre Exp $ */
+/* $NetBSD: eval.c,v 1.144 2017/06/08 02:23:51 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.143 2017/06/07 05:08:32 kre Exp $");
+__RCSID("$NetBSD: eval.c,v 1.144 2017/06/08 02:23:51 kre Exp $");
#endif
#endif /* not lint */
@@ -776,7 +776,8 @@
vforked = 0;
/* First expand the arguments. */
- TRACE(("evalcommand(%p, %d) called\n", cmd, flags));
+ CTRACE(DBG_EVAL, ("evalcommand(%p, %d) called (%d)\n", cmd, flags,
+ (cmd ? cmd->ncmd.lineno : -1)));
setstackmark(&smark);
back_exitstatus = 0;
diff -r f91050f015f0 -r 07438bf765a3 bin/sh/sh.1
--- a/bin/sh/sh.1 Thu Jun 08 01:23:01 2017 +0000
+++ b/bin/sh/sh.1 Thu Jun 08 02:23:51 2017 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: sh.1,v 1.150 2017/06/07 13:49:48 wiz Exp $
+.\" $NetBSD: sh.1,v 1.151 2017/06/08 02:23:51 kre Exp $
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
@@ -2868,12 +2868,15 @@
All of those act as they would with any other variable.
However,
.Ev LINENO
-should normally not ever be set, in this
-shell doing so reverses the effect of an earlier unset,
+should normally not ever be set or unset.
+In this shell setting
+.Ev LINENO
+reverses the effect of an earlier
+.Ic unset ,
but does not otherwise affect the value obtained.
If unset,
.Ev LINENO
-should not be set again.
+should not normally be set again, doing so is not portable.
If
.Ev LINENO
is set or unset, different shells act differently.
@@ -2896,9 +2899,11 @@
reads from any particular file.
For this shell, standard input, including in an interactive shell,
the user's terminal, is just another file and lines are counted
-there as well, however note that not all shells count interactive
-lines this way, it is wise to rely upon LINENO only having a useful
-value in a script, or a function.
+there as well.
+However note that not all shells count interactive
+lines this way, it is not wise to rely upon
+.Ev LINENO
+having a useful value, except in a script, or a function.
.Pp
The role of
.Ev LINENO
@@ -2917,7 +2922,9 @@
.Fl L
flag (the
.Ic lineno_fn_relative
-option) is set, when the function is defined, then the function
+option, see
+.Sx Argument List Processing )
+is set, when the function is defined, then the function
defaults to counting lines with one being the first line of the
function.
When the
@@ -2936,7 +2943,7 @@
If
.Ev LINENO
is made local and inherited, and not given a value, as in
-.Dl local -I LINENO
+.Dl local Fl I Ev LINENO
then from that point in the function,
.Ev LINENO
will give the line number as if lines are counted in sequence
@@ -2944,14 +2951,14 @@
If
.Ev LINENO
is made local, and in that same command, given a value, as
-.Dl local Oo Fl I Ns Cm \&| Ns Fl N Ns Oc LINENO=value
+.Dl local Oo Fl I Ns | Ns Fl N Oc Ev LINENO Ns = Ns Ar value
then
.Ev LINENO
will give the line number as if lines are counted from one
from the beginning of the function.
The value nominally assigned in this case is irrelevant, and ignored.
For completeness, if lineno is made local and unset, as in
-.Dl local -N LINENO
+.Dl local Fl N Ev LINENO
then
.Ev LINENO
is simply unset inside the function, and gives no value at all.
Home |
Main Index |
Thread Index |
Old Index