summary refs log tree commit diff
path: root/src/arith_yacc.c (follow)
Commit message (Collapse)AuthorAge
* [ARITH] Avoid imaxdiv when only one of the results is wantedHarald van Dijk2011-08-17
| | | | | | | | | | | | dash rather pointlessly calls imaxdiv, only to discard one of its results. The call was already made conditional a while back because some systems don't have imaxdiv, but the generated code for the version with imaxdiv and the one with / and % is identical (with GCC 4.6.1 or ICC 12.0.2, with -O0, -O2 or -Os), so it could just as well go entirely to clean up the code a little bit. Signed-off-by: Harald van Dijk <harald@gigawatt.nl> 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>
* [ARITH] Fix logical or result valueJilles Tjoelker2010-03-10
| | | | | | | | | | | Another change I'm making to the arith code is making || return 0 or 1 only, matching C, POSIX and other shells. Apart from the compliance issue, it is also bad to expose implementation details like the exact meaning of 'noeval' to scripts such that they may come to depend on them. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [ARITH] Fix binary operator parsingHerbert Xu2010-03-09
| | | | | | | | | | | | | Jilles Tjoelker reported that binary operator parsing doesn't respect operator precedence correctly in the case where a lower- precedence operator is followed by a higher-precedence operator, and then by a lower-precedence operator. This patch fixes this by stopping when we encounter a binary oeprator with a precedence lower than one that we have already encountered. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [ARITH] If imaxdiv() isn't available, use / and % operatorsGerrit Pape2007-12-23
| | | | | | | | | | | Although in posix, imaxdiv() isn't implemented on Debian/alpha, causing dash to fail to build. So use / and % operators if imaxdiv() isn't available. http://bugs.debian.org/456398 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
* [BUILTIN] Use setvarint to set OPTINDHerbert Xu2007-10-11
| | | | | This patch adds a flag argument to setvarint and uses it to set the OPTIND variable.
* [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.