diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2019-01-09 09:36:54 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2019-01-09 09:36:54 +0000 |
commit | a96301b673fe50799111210ad539351c7f9bdbf9 (patch) | |
tree | dee7d71613bf42d18a80207a413a55e249042586 /bin/sh | |
parent | 10731c54b6dbef8894a184800e861f19a63f1fa0 (diff) | |
download | src-test2-a96301b673fe50799111210ad539351c7f9bdbf9.tar.gz src-test2-a96301b673fe50799111210ad539351c7f9bdbf9.zip |
Notes
Diffstat (limited to 'bin/sh')
-rw-r--r-- | bin/sh/shell.h | 3 | ||||
-rw-r--r-- | bin/sh/tests/expansion/Makefile | 1 | ||||
-rw-r--r-- | bin/sh/tests/expansion/arith15.0 | 20 |
3 files changed, 22 insertions, 2 deletions
diff --git a/bin/sh/shell.h b/bin/sh/shell.h index 0b25587c59f5..9e2f9ab6e735 100644 --- a/bin/sh/shell.h +++ b/bin/sh/shell.h @@ -59,8 +59,7 @@ */ typedef intmax_t arith_t; #define ARITH_FORMAT_STR "%" PRIdMAX -#define atoarith_t(arg) strtoimax(arg, NULL, 0) -#define strtoarith_t(nptr, endptr, base) strtoimax(nptr, endptr, base) +#define strtoarith_t(nptr, endptr, base) (intmax_t)strtoumax(nptr, endptr, base) #define ARITH_MIN INTMAX_MIN #define ARITH_MAX INTMAX_MAX diff --git a/bin/sh/tests/expansion/Makefile b/bin/sh/tests/expansion/Makefile index 4f344c4a5161..25cf218f40a2 100644 --- a/bin/sh/tests/expansion/Makefile +++ b/bin/sh/tests/expansion/Makefile @@ -21,6 +21,7 @@ ${PACKAGE}FILES+= arith11.0 ${PACKAGE}FILES+= arith12.0 ${PACKAGE}FILES+= arith13.0 ${PACKAGE}FILES+= arith14.0 +${PACKAGE}FILES+= arith15.0 ${PACKAGE}FILES+= assign1.0 ${PACKAGE}FILES+= cmdsubst1.0 ${PACKAGE}FILES+= cmdsubst2.0 diff --git a/bin/sh/tests/expansion/arith15.0 b/bin/sh/tests/expansion/arith15.0 new file mode 100644 index 000000000000..748d14754873 --- /dev/null +++ b/bin/sh/tests/expansion/arith15.0 @@ -0,0 +1,20 @@ +# $FreeBSD$ + +failures=0 + +check() { + if [ $(($1)) != $2 ]; then + failures=$((failures+1)) + echo "For $1, expected $2 actual $(($1))" + fi +} + +XXX=-9223372036854775808 +check "XXX" -9223372036854775808 +check "XXX - 1" 9223372036854775807 +check $(($XXX - 1)) 9223372036854775807 +check $(($XXX - 2)) 9223372036854775806 +check $((0x8000000000000000 == 0x7fffffffffffffff)) \ + 0 + +exit $((failures != 0)) |