diff --git a/regress/lib/libc/stdio/Makefile b/regress/lib/libc/stdio/Makefile index 8e575edebecf..8d1510db20af 100644 --- a/regress/lib/libc/stdio/Makefile +++ b/regress/lib/libc/stdio/Makefile @@ -1,5 +1,5 @@ -# $NetBSD: Makefile,v 1.1 2003/05/30 12:46:05 simonb Exp $ +# $NetBSD: Makefile,v 1.2 2006/02/28 19:30:45 kleink Exp $ -SUBDIR+= scanf +SUBDIR+= printf scanf .include diff --git a/regress/lib/libc/stdio/printf/Makefile b/regress/lib/libc/stdio/printf/Makefile new file mode 100644 index 000000000000..cae5a4e5f3ac --- /dev/null +++ b/regress/lib/libc/stdio/printf/Makefile @@ -0,0 +1,11 @@ +# $NetBSD: Makefile,v 1.1 2006/02/28 19:30:45 kleink Exp $ + +NOMAN= # defined + +PROG= printf +WARNS?= 4 + +regress: ${PROG} + ./${PROG} + +.include diff --git a/regress/lib/libc/stdio/printf/printf.c b/regress/lib/libc/stdio/printf/printf.c new file mode 100644 index 000000000000..54f421542b34 --- /dev/null +++ b/regress/lib/libc/stdio/printf/printf.c @@ -0,0 +1,22 @@ +/* $NetBSD: printf.c,v 1.1 2006/02/28 19:30:45 kleink Exp $ */ + +/* + * Written by Klaus Klein , February 28, 2006. + * Public domain. + */ + +#include +#include + +int +main(int argc, char *argv[]) +{ + char s[2]; + + /* PR lib/32951: %.0f formats (0.0,0.5] to "0." */ + assert(snprintf(s, sizeof(s), "%.0f", 0.1) == 1); + assert(s[0] == '0'); + /* assert(s[1] == '\0'); */ + + return 0; +}