| Age | Commit message (Collapse) | Author |
|
|
|
Change the add/subtract overflow checks to use an unsigned to do the op
and then cast back into the signed var to check the signs.
Make multiply shortcut on either right or left being 0.
Make multiply's overflow test not fail on simple cases like 1 * -1
Make the multiple overflow test pass all the regress tests.
|
|
Make sure all precendence is spelled out correctly (comparison does not
have the same level as the arithmetic operators..)
Break the arithemtic operators into 2 classes (+- are lower than */%)
Restructure the arithmetic code into a function either class above can call.
Finally, add a whole suite of regression tests (checked in separately) which
the previous code failed on 3 of them.
|
|
|
|
|
|
it's ignored if it would cause syntax error, otherwise treated as common
string; this is so that both 'expr -- : .' and 'expr -- foo : .' works
This addresses standards/11230 by Ben Harris.
while here, make all global variables but main() static, use const more
|
|
|
|
|
|
arithmetic operations, compare, or :
This should fix bin/11318 by Love <lha@stacken.kth.se>
|
|
actually in intended form - use "%.*s" and not incorrect "%*s"
Bug found by Launey Thomas <ljt@alum.mit.edu> and reported in private e-mail.
|
|
from old expr.c. This fixes PR # 11060.
While here, convert the code to use asprintf() instead of strdup()
followed by truncating of new string and move definition of errstr
to block where it's used.
|
|
highlights:
* / is treated correctly depending upon context (addresses PR # 10995)
* use 64 bit arithmetic, so expr is able to process integer values from
-(2**63) to (2**63 - 1)
* checks for integer over- & underflows added
* error messages improved, more error checking added
add AUTHOR section to manpage
add BUGS section, and mention possible drawbacks with other expr implementations
XXX the old expr treated empty string in arithmetic expressions as if it was 0
XXX this behaviour has been retained
|
|
|
|
|
|
|
|
expr implementations.
|
|
weren't supported, they aren't standard, and they caused expr to dump
core.
|
|
If string does not match \( \) subexpression, return a null string.
|
|
collation sequence, so use strcoll instead of strcmp.
|
|
|
|
|
|
bad things: core dumps, etc. will happen if integer values make it
up the parse tree.
|
|
(Previous checkin was aborted by stray ^C)
|
|
|
|
|
|
|
|
|
|
|