NetBSD/bin
martin ab7b1b8402 Pull up following revision(s) (requested by kre in ticket #1779):
bin/sh/miscbltin.c: revision 1.51
	bin/sh/miscbltin.c: revision 1.52

PR bin/56972  Fix escape ('\') handling in sh read builtin.

In 1.35 (March 2005) (the big read fixup), most escape handling and IFS
processing in the read builtin was corrected.  However 2 cases were missed,
one is a word (something to be assigned to any variable but the last) in
which every character is escaped (the code was relying on a non-escaped char
to set the "in a word" status), and second trailing IFS whitespace at
the end of the line was being deleted, even if the chars had been escaped
(the escape chars are no longer present).

See the PR for more details (including the case that detected the problem).

After fixing this, I looked at the FreeBSD code (normally might do it
before, but these fixes were trivial) to check their implementation.

Their code does similar things to ours now does, but in a completely
different way, their read builtin is more complex than ours needs to
be (they handle more options).   For anyone tempted to simply incorporate
their code, note that it relies upon infrastructure changes elsewhere
in the shell, so would not be a simple cut and drop in exercise.

This needs pullups to -3 -4 -5 -6 -7 -8 and -9 (fortunately this is
happening before -10 is branched, so will never be broken this way there).

 -

Don't output the error for bad usage (no var name given)
after already writing the prompt (set with the -p option).

That results in nonsense like:
	$ read -p foo
	fooread: arg count

While here, improve the error message so it means something.

Now we will get:
$ read -p foo
read: variable name required
Usage: read [-r] [-p prompt] var...

[Detected by code reading while doing the work for the previous fix]
2022-10-27 16:16:50 +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 Pull up following revision(s) (requested by sevan in ticket #992): 2018-08-28 13:21:42 +00:00
domainname Use __dead 2011-08-29 14:51:17 +00:00
echo Drop main() prototype. 2016-09-05 01:00:07 +00:00
ed Pull up following revision(s) (requested by christos in ticket #887): 2018-06-22 10:08:22 +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 Pull up following revision(s) (requested by kre in ticket #103): 2017-07-23 14:58:13 +00:00
ksh Pull up following revision(s) (requested by christos in ticket #1658): 2021-02-23 18:56:12 +00:00
ln Pull up following revision(s) (requested by sevan in ticket #992): 2018-08-28 13:21:42 +00:00
ls white space 2017-02-06 21:06:04 +00:00
mkdir Pull up following revision(s) (requested by kre in ticket #1697): 2021-09-23 10:04:53 +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 Pull up following revision(s) (requested by mrg in ticket #1678): 2021-05-07 17:40:31 +00:00
ps Pull up following revision(s) (requested by simonb in ticket #1669): 2021-04-06 18:09:52 +00:00
pwd Document the version pwd first appeared. 2016-08-12 02:03:26 +00:00
rcmd Sort options in SYNOPSIS, sort option descriptions, remove some extra 2011-05-31 11:31:10 +00:00
rcp Pull up following revision(s) (requested by aymeric in ticket #1546): 2020-05-07 17:02:33 +00:00
rm Document the version rm first appeared. 2016-08-12 02:26:42 +00:00
rmdir Pull up following revision(s) (requested by ginsbach in ticket #208): 2017-08-14 23:54:30 +00:00
sh Pull up following revision(s) (requested by kre in ticket #1779): 2022-10-27 16:16:50 +00:00
sleep Pull up following revision(s) (requested by kre in ticket #1169): 2019-03-07 16:56:51 +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