Christian Eggers
39925026f6
shell: Fix "read -d ''" behavior
...
With bash's read builtin it is possible to read from a file (e.g.
device-tree) until the first '\0' character:
IFS= read -r -d '' VARIABLE < file
In busybox ash the -d extension is also implemented, but checking the
read character for '\0' has to be performed after comparing with the
delimiter.
Signed-off-by: Christian Eggers <ceggers@arri.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-07-31 18:42:30 +02:00
Denys Vlasenko
44257ad5d0
hush: fix IFS handling in read
...
$ echo "X:Y:" | (IFS=": " read x y; echo "|$x|$y|")
|X|Y|
$ echo "X:Y : " | (IFS=": " read x y; echo "|$x|$y|")
|X|Y|
function old new delta
shell_builtin_read 1320 1426 +106
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-11 17:18:34 +02:00
Denys Vlasenko
eae12688c9
shell: optional support for read -t N.NNN, closes 10101
...
function old new delta
shell_builtin_read 1097 1277 +180
dump_procs 353 359 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-20 16:09:31 +02:00
Denys Vlasenko
f547041940
ash,hush: fix SIGCHLD interrupting read builtin
...
function old new delta
readcmd 169 217 +48
shell_builtin_read 1087 1097 +10
localcmd 366 364 -2
builtin_read 197 193 -4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 58/-6) Total: 52 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-05-22 19:34:45 +02:00
Denys Vlasenko
5d6b8729ed
hush testsuite: add many tests from ash testsuite
...
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-02 17:39:31 +02:00
Denys Vlasenko
03dad22f8a
hush: use ash's read builtin
...
function old new delta
shell_builtin_read - 1000 +1000
set_local_var_from_halves - 24 +24
setvar2 - 7 +7
...
popstring 140 134 -6
ash_main 1375 1368 -7
setvar 184 174 -10
arith_set_local_var 36 - -36
builtin_read 1096 185 -911
------------------------------------------------------------------------------
(add/remove: 3/1 grow/shrink: 5/23 up/down: 1038/-1007) Total: 31 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-12 23:29:57 +01:00