summary refs log tree commit diff
path: root/src/miscbltin.c (follow)
Commit message (Collapse)AuthorAge
* [BUILTIN] Fix off-by-one recordregion in readcmdHerbert Xu2009-11-26
| | | | | | | | | | | | | | | | | | | | | | | Alexey Gladkov <gladkov.alexey@gmail.com> wrote: > > I found another example: > > $ tr -d '[:print:]' < /etc/passwd |tr -d '\t\n' |wc -c > 0 > > $ dash -c 'while read o p; do printf "[%s] [%s]\n" "$o" "$p"; done < > /etc/passwd' |tr -d '[:print:]' |tr -d '[:space:]' |wc -c > 61 > > bug is not fixed yet :( This bug is caused by an off-by-one error in the recordregion call in readcmd. It included the terminating NUL in the region which causes ifsbreakup to include the string after it for scanning. Setting the correct length fixes the problem. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILTIN] Avoid compiler warnings on isdigitEric Blake2009-08-31
| | | | | | | Pass correct type to ctype macro. Signed-off-by: Eric Blake <ebb9@byu.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILTIN] Fix NUL termination in readcmdHerbert Xu2009-08-31
| | | | | | | | | | | | Commit 55c46b7286f5d9f2d8291158203e2b61d2494420 ([BUILTIN] Honor tab as IFS whitespace when splitting fields in readcmd) introduced a bug where sometimes garbage would follow the last field preceding the end-of-line. This was caused by an off-by-one error in the string length calculation. This patch fixes the bug. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILTIN] Honor tab as IFS whitespace when splitting fields in readcmdStefan Potyra2009-08-11
| | | | | | | | | | | | | | | | | | | When I try to split fields by tabs, dash doesn't honour multiple tabs between fields as whitespace (at least that's how I interpret [1], please correct me if I'm wrong). #!/bin/sh # "1\t2\t\t3" TESTSTRING="1 2 3" # only "\t" IFS=" " echo "$TESTSTRING" | while read p1 p2 p3; do echo "p1=${p1}, p2=${p2}, p3=${p3}" done Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILTIN] Disable ulimit if there is no getrlimitHerbert Xu2005-10-29
| | | | | | | | | | For systems without getrlimit (e.g., klibc) we will disable ulimit. In order to achieve this, builtins.def is now produced by cpp which allows us to use macros such as HAVE_GETRLIMIT in it. Thie also means that we can get rid of the cflags parsing code in mkbuiltins.
* Copyright/licence updates and remove all traces of sys/cdefs.hHerbert Xu2005-10-29
| | | | | | | | | | | This change updates the BSD licence to the three-clause version since NetBSD has already done so. This makes dash GPL-compatible. It also adds Christos Zoulas (NetBSD ash maintainer) to the COPYING file. I've added "copyright by Herbert Xu" to most files. Finally all CVS IDs and inclusion of sys/cdefs.h have been removed. The latter is needed for support of klibc.
* Renamed error to sh_error.herbert2005-09-26
|
* Initial import.Herbert Xu2005-09-26