svn commit: r246277 - in stable/9: tools/regression/usr.bin/printf usr.bin/printf
Eitan Adler
eadler at FreeBSD.org
Sun Feb 3 01:22:29 UTC 2013
Author: eadler
Date: Sun Feb 3 01:22:28 2013
New Revision: 246277
URL: http://svnweb.freebsd.org/changeset/base/246277
Log:
MFC r244407,r244409:
POSIX requires that non-existent or null arguments be treated as if a
zero argument were supplied.
Add regression tests to catch this case as well.
PR: bin/174521
Approved by: cperciva (mentor, implicit)
Added:
stable/9/tools/regression/usr.bin/printf/regress.zero.out
- copied unchanged from r244407, head/tools/regression/usr.bin/printf/regress.zero.out
Modified:
stable/9/tools/regression/usr.bin/printf/regress.sh
stable/9/usr.bin/printf/printf.c
Directory Properties:
stable/9/tools/regression/ (props changed)
stable/9/usr.bin/printf/ (props changed)
Modified: stable/9/tools/regression/usr.bin/printf/regress.sh
==============================================================================
--- stable/9/tools/regression/usr.bin/printf/regress.sh Sun Feb 3 01:08:01 2013 (r246276)
+++ stable/9/tools/regression/usr.bin/printf/regress.sh Sun Feb 3 01:22:28 2013 (r246277)
@@ -2,7 +2,7 @@
REGRESSION_START($1)
-echo '1..11'
+echo '1..12'
REGRESSION_TEST(`b', `printf "abc%b%b" "def\n" "\cghi"')
REGRESSION_TEST(`d', `printf "%d,%5d,%.5d,%0*d,%.*d\n" 123 123 123 5 123 5 123')
@@ -15,5 +15,9 @@ REGRESSION_TEST(`m3', `printf "%%%s\n" a
REGRESSION_TEST(`m4', `printf "%d,%f,%c,%s\n"')
REGRESSION_TEST(`m5', `printf -- "-d\n"')
REGRESSION_TEST(`s', `printf "%.3s,%-5s\n" abcd abc')
+REGRESSION_TEST('zero', `printf "%u%u\n" 15')
+REGRESSION_TEST('zero', `printf "%d%d\n" 15')
+REGRESSION_TEST('zero', `printf "%d%u\n" 15')
+REGRESSION_TEST('zero', `printf "%u%d\n" 15')
REGRESSION_END()
Copied: stable/9/tools/regression/usr.bin/printf/regress.zero.out (from r244407, head/tools/regression/usr.bin/printf/regress.zero.out)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/9/tools/regression/usr.bin/printf/regress.zero.out Sun Feb 3 01:22:28 2013 (r246277, copy of r244407, head/tools/regression/usr.bin/printf/regress.zero.out)
@@ -0,0 +1 @@
+150
Modified: stable/9/usr.bin/printf/printf.c
==============================================================================
--- stable/9/usr.bin/printf/printf.c Sun Feb 3 01:08:01 2013 (r246276)
+++ stable/9/usr.bin/printf/printf.c Sun Feb 3 01:22:28 2013 (r246277)
@@ -467,7 +467,7 @@ getnum(intmax_t *ip, uintmax_t *uip, int
int rval;
if (!*gargv) {
- *ip = 0;
+ *ip = *uip = 0;
return (0);
}
if (**gargv == '"' || **gargv == '\'') {
More information about the svn-src-stable-9
mailing list