diff options
author | zoulasc <zoulasc@users.noreply.github.com> | 2019-12-11 02:17:34 -0500 |
---|---|---|
committer | Arnold Robbins <arnold@skeeve.com> | 2019-12-11 09:17:34 +0200 |
commit | a96aebbbd601a619318312e835b76c3cd7816518 (patch) | |
tree | b5e09ed1065249750d4208910dc59e8c20b6c47b /testdir/T.expr | |
parent | af86dacfad85857b2ea9fa95150ddd8c671695ed (diff) | |
download | one-true-awk-a96aebbbd601a619318312e835b76c3cd7816518.tar.gz |
Fix printf format conversions. (#59)
Further simplify printf % parsing by eating the length specifiers
during the copy phase, and substitute 'j' when finalizing the format.
Add some more tests for this.
Diffstat (limited to 'testdir/T.expr')
-rwxr-xr-x | testdir/T.expr | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/testdir/T.expr b/testdir/T.expr index 7390e8b..304b3d0 100755 --- a/testdir/T.expr +++ b/testdir/T.expr @@ -167,15 +167,15 @@ try { printf("a%-*.*sb\n", $1, $2, "hello") } 2 1 ah b 3 1 ah b -try { printf("%d %ld\n", $1, $1) } -1 1 1 -10 10 10 -10000 10000 10000 - -try { printf("%x %lx\n", $1, $1) } -1 1 1 -10 a a -10000 2710 2710 +try { printf("%d %ld %lld %zd %jd %hd %hhd\n", $1, $1, $1, $1, $1, $1, $1) } +1 1 1 1 1 1 1 1 +10 10 10 10 10 10 10 10 +10000 10000 10000 10000 10000 10000 10000 10000 + +try { printf("%x %lx %llx %zx %jx %hx %hhx\n", $1, $1, $1, $1, $1, $1, $1) } +1 1 1 1 1 1 1 1 +10 a a a a a a a +10000 2710 2710 2710 2710 2710 2710 2710 try { if ($1 ~ $2) print 1; else print 0 } a \141 1 |