NetBSD/bin
kre fd38bbe2e4 An initial attempt at implementing LINENO to meet the specs.
Aside from one problem (not too hard to fix if it was ever needed) this version
does about as well as most other shell implementations when expanding
$((LINENO)) and better for ${LINENO} as it retains the "LINENO hack" for the
latter, and that is very accurate.

Unfortunately that means that ${LINENO} and $((LINENO)) do not always produce
the same value when used on the same line (a defect that other shells do not
share - aside from the FreeBSD sh as it is today, where only the LINENO hack
exists and so (like for us before this commit) $((LINENO)) is always either
0, or at least whatever value was last set, perhaps by
	LINENO=${LINENO}
which does actually work ... for that one line...)

This could be corrected by simply removing the LINENO hack (look for the string
LINENO in parser.c) in which case ${LINENO} and $((LINENO)) would give the
same (not perfectly accurate) values, as do most other shells.

POSIX requires that LINENO be set before each command, and this implementation
does that fairly literally - except that we only bother before the commands
which actually expand words (for, case and simple commands).   Unfortunately
this forgot that expansions also occur in redirects, and the other compound
commands can also have redirects, so if a redirect on one of the other compound
commands wants to use the value of $((LINENO)) as a part of a generated file
name, then it will get an incorrect value.  This is the "one problem" above.
(Because the LINENO hack is still enabled, using ${LINENO} works.)

This could be fixed, but as this version of the LINENO implementation is just
for reference purposes (it will be superseded within minutes by a better one)
I won't bother.  However should anyone else decide that this is a better choice
(it is probably a smaller implementation, in terms of code & data space then
the replacement, but also I would expect, slower, and definitely less accurate)
this defect is something to bear in mind, and fix.

This version retains the *BSD historical practice that line numbers in functions
(all functions) count from 1 from the start of the function, and elsewhere,
start from 1 from where the shell started reading the input file/stream in
question.  In an "eval" expression the line number starts at the line of the
"eval" (and then increases if the input is a multi-line string).

Note: this version is not documented (beyond as much as LINENO was before)
hence this slightly longer than usual commit message.
2017-06-07 04:44:17 +00:00
..
cat When invoked with -se, print a '$' on blank lines 2016-06-16 00:52:37 +00:00
chio Move the description of CHANGER variable to ENVIRONMENT section 2016-08-25 18:16:10 +00:00
chmod Document the version chmod first appeared. 2016-08-11 00:10:42 +00:00
cp Document the version cp first appeared. 2016-08-11 00:17:23 +00:00
csh switch to a backtracking instead of a recursive pattern matcher. 2017-04-27 18:50:34 +00:00
date The range of the SS field is [0,60] 2017-01-03 16:01:05 +00:00
dd Drop main() prototype. 2016-09-05 01:00:07 +00:00
df Bump date 2016-08-10 23:48:14 +00:00
domainname
echo Drop main() prototype. 2016-09-05 01:00:07 +00:00
ed Remove MKCRYPTO option. 2017-05-21 15:28:36 +00:00
expr Drop main() prototype. 2016-09-05 01:00:07 +00:00
hostname Remove options added in 1.18, commitid: UhxHPgtT2Pzeg4Yw due to some 2014-02-13 12:00:29 +00:00
kill Clarify 0 2017-04-22 23:01:36 +00:00
ksh PR/52210: David H. Gutteridge: revert var pattern handling. 2017-05-03 00:41:34 +00:00
ln When called as "link" (not currently installed that way) always simply 2017-04-22 12:22:31 +00:00
ls white space 2017-02-06 21:06:04 +00:00
mkdir Grammar 2016-08-10 18:42:00 +00:00
mt Adjust for mandoc output. 2012-03-19 10:48:20 +00:00
mv Forgot to bump date with previous commit 2016-08-10 18:08:14 +00:00
pax Document the version pax first appeared. 2016-08-12 01:52:22 +00:00
ps simplify logic; there must be no CPU usage when p_swtime is zero 2016-12-26 20:52:39 +00:00
pwd Document the version pwd first appeared. 2016-08-12 02:03:26 +00:00
rcmd
rcp allocate a separate buffer in each call to sink(). 2012-05-07 15:22:54 +00:00
rm Document the version rm first appeared. 2016-08-12 02:26:42 +00:00
rmdir Document the version rmdir first appeared. 2016-08-12 02:30:37 +00:00
sh An initial attempt at implementing LINENO to meet the specs. 2017-06-07 04:44:17 +00:00
sleep Document the version sleep first appeared. 2016-08-12 02:36:38 +00:00
stty need <time.h> for time(3) 2017-01-10 20:44:05 +00:00
sync Drop main() prototype. 2016-09-05 01:00:07 +00:00
test Drop main() prototype. 2016-09-05 01:00:07 +00:00
Makefile
Makefile.inc Default to WARNS=5 2012-03-21 05:47:53 +00:00