summary refs log tree commit diff
path: root/src/mystring.c (follow)
Commit message (Collapse)AuthorAge
* mystring: fix "Illegal number" on FreeBSD & macOS for x=; echo $((x))Martijn Dekker2018-03-10
| | | | | | | | | | | | | | | | | | | | | Op 07-03-18 om 06:26 schreef Herbert Xu: > Martijn Dekker <martijn@inlv.org> wrote: >> >>> Since base is always a constant 0 or a constant 10, never a >>> user-provided value, the only error that strtoimax will ever report on >>> glibc systems is ERANGE. Checking only ERANGE therefore preserves the >>> glibc behaviour, and allows the exact same set of errors to be detected >>> on non-glibc systems. >> >> That makes sense, thanks. > > Could you resend your patch with this change please? OK, see below. - M. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [SHELL] Port to SolarisBrian Koropoff2011-03-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Solaris lacks paths.h and the various _PATH_* #defines. Check for them in configure.ac and fall back on the usual suspects when they are missing. - Older Solaris lacks isblank(), and versions that have it use a macro. Check for the declaration in configure.ac and fall back on a naive version when missing. - Older Solaris does not support %jd (intmax_t) in format strings, but it does support the PRIdMAX macro from inttypes.h. Do a configure check for PRIdMAX and use it in the code. If it doesn't exist, define it to "lld" when sizeof(long long) equals sizeof(intmax_t) as this is more likely to work on older systems. Otherwise, use "jd" and hope for the best. - Older Solaris lacks stdint.h, but inttypes.h provides the same types and works on all platforms I've tried dash on, so just use it instead. - Older Solaris doesn't like it when vsnprintf() is passed a NULL buffer (in violation of the POSIX spec, of course). Pass a 1-byte dummy buffer instead. - Solaris lacks tempfile and mktemp programs. Fall back on a "good-enough" custom function in mkbuiltins. Signed-off-by: Brian Koropoff <bkoropoff@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILTIN] Fix backslash handling in read(1)Herbert Xu2011-03-11
| | | | | | | | | | | | The new read(1) implementation incorrectly assumes that ifsbreakup ignores characters escaped by CTLESC. As such it fails to handle backslashes except for escaping newlines. This patch makes it use recordregion for every part that isn't escaped by a backslash. Reported-by: Jilles Tjoelker <jilles@stack.nl> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [SHELL] Replace shared illnum message by badnum function.Herbert Xu2007-10-17
| | | | | | This patch adds the badnum function and uses it to mostly replace the use of illnum except in miscbltin where the current code turns out to be smaller because of the twin sh_error calls.
* [BUILTIN] Disallow completely blank strings in non-arithmetic context.Oleg Verych2007-10-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * NULL as a number argument: olecom@deen:/mnt/debian/src/dash-0.5.3$ time src/dash tst-01.sh test: 20: `': bad number `' eq 0: 2 must be >1, Not A Number test: 20: `': bad number `' ne 0: 2 must be >1, Not A Number test: 20: `': bad number `' gt 0: 2 must be >1, Not A Number test: 20: `': bad number `' ge 0: 2 must be >1, Not A Number test: 20: `': bad number `' lt 0: 2 must be >1, Not A Number test: 20: `': bad number `' le 0: 2 must be >1, Not A Number /usr/bin/test: invalid integer `' `' eq 0: 2 must be >1, Not A Number /usr/bin/test: invalid integer `' `' ne 0: 2 must be >1, Not A Number /usr/bin/test: invalid integer `' `' gt 0: 2 must be >1, Not A Number /usr/bin/test: invalid integer `' `' ge 0: 2 must be >1, Not A Number /usr/bin/test: invalid integer `' `' lt 0: 2 must be >1, Not A Number /usr/bin/test: invalid integer `' `' le 0: 2 must be >1, Not A Number #!/usr/bin/printf This not executable script%c\n test_arithm() { for aop in eq ne gt ge lt le do "$1" 0 -$aop "$NOTHING" echo "\`' $aop 0:" $? " must be >1, Not A Number" done } # opengroup.org/onlinepubs/000095399/utilites/test.html (nothing about long): test_arithm test test_arithm /usr/bin/test # shend
* [ARITH] Add assignment and intmax_t supportHerbert Xu2007-10-11
| | | | | This patch adds assignment operator support in arithmetic expansions. It also changes the type used to intmax_t.
* [BUILTIN] Use intmax_t arithmetic in testHerbert Xu2007-10-06
| | | | | This patch adds the function atomax10 and uses it in test(1) so that we support intmax_t comparisons.
* [EXPAND] Move parse-time quote flag detection to run-timeHerbert Xu2007-09-25
| | | | | | | | | | | | | | | | | | | | Because the parser does not recursively parse parameter expansion with respect to quotes, we can't accurately determine quote status at parse time. This patch works around this by moving the quote detection to run-time where we do interpret it recursively. Test case: foo=\\ echo "<${foo#[\\]}>" Old result: <\> New result: <>
* 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