ash: implement -d DELIM option for read
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 8 Aug 2017 14:46:39 +0000 (16:46 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 9 Aug 2017 11:52:17 +0000 (13:52 +0200)
commit3bef5d89b0c667e9fb7d1d9b44ba9b30d4d084e4
tree5f31bceb5e2b239d88f6465cc76f313a4d5ddc98
parent5856dc74be79fa288f481e1f19077518ae6d8303
ash: implement -d DELIM option for read

The POSIX standard only requires the read builtin to handle -r:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/read.html

However, Bash introduced the option -d <DELIM> to override IFS for
just one invocation, and it is quite useful.

It is also super easy to implement in BusyBox' ash, so let's do that.

The motivation: This option is used by Git's test suite.

function                                             old     new   delta
.rodata                                           163505  163587     +82
shell_builtin_read                                  1244    1289     +45
readcmd                                              233     259     +26
builtin_read                                         258     263      +5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/0 up/down: 158/0)             Total: 158 bytes

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c
shell/shell_common.c
shell/shell_common.h