From: Jim Meyering Date: Thu, 8 Jul 2004 14:03:20 +0000 (+0000) Subject: printf cleanup, to avoid undefined behavior, to add support for X-Git-Tag: v5.3.0~1131 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=405c640f5b337b05d53c03432039c3417cbd14a4;p=thirdparty%2Fcoreutils.git printf cleanup, to avoid undefined behavior, to add support for formats that Bash supports, and to support wide integers like Bash does. Add tests for the above. --- diff --git a/tests/misc/printf b/tests/misc/printf index 431e685da5..64d16f336e 100755 --- a/tests/misc/printf +++ b/tests/misc/printf @@ -63,6 +63,20 @@ $prog '7 \2y \02y \002y \0002y\n' |tr '\0\2' '*=' >> out $prog '8 %b %b %b %b\n' '\1y' '\01y' '\001y' '\0001y'|tr '\1' = >> out +$prog '9 %*dx\n' -2 0 >>out || fail=1 + +$prog '10 %.*dx\n' -2147483648 0 >>out || fail=1 + +$prog '11 %*c\n' 2 x >>out || fail=1 + +$prog '%#d\n' 0 >>out 2> /dev/null && fail=1 + +$prog '%0s\n' 0 >>out 2> /dev/null && fail=1 + +$prog '%.9c\n' 0 >>out 2> /dev/null && fail=1 + +$prog '%'\''s\n' 0 >>out 2> /dev/null && fail=1 + cat <<\EOF > exp 1 x y 2 failed, as expected @@ -72,6 +86,9 @@ cat <<\EOF > exp 6 ! 7 =y =y =y *2y 8 =y =y =y =y +9 0 x +10 0x +11 x EOF cmp out exp || fail=1