Subject: Re: standards/32981: man page is wrong on return values of printf/fprintf/sprintf/etc.
To: None <standards-manager@netbsd.org, gnats-admin@netbsd.org,>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 03/03/2006 22:15:04
The following reply was made to PR standards/32981; it has been noted by GNATS.

From: christos@zoulas.com (Christos Zoulas)
To: gnats-bugs@netbsd.org, standards-manager@netbsd.org,
	gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: standards/32981: man page is wrong on return values of printf/fprintf/sprintf/etc.
Date: Fri, 3 Mar 2006 17:11:03 -0500

 On Mar 3, 10:05pm, veenhuizen@users.sourceforge.net (Johan Veenhuizen) wrote:
 -- Subject: standards/32981: man page is wrong on return values of printf/fpr
 
 | 	I have no copies of the C90/C99 standards in front of me,
 | 	but "The C Programming Language, 2nd Ed.", POSIX and SUS
 | 	document different return values for fprintf/sprintf/etc
 | 	than the NetBSD manual page.
 | 
 | 	I have no clue about asprintf and vasprintf.  Maybe their
 | 	return values should be changed as well, but they are not
 | 	standardised yet as far as I know.
 | 
 | >How-To-Repeat:
 | 
 | 	$ man 3 printf
 | 
 | >Fix:
 | 
 | Index: printf.3
 | ===================================================================
 | RCS file: /cvsroot/src/lib/libc/stdio/printf.3,v
 | retrieving revision 1.40
 | diff -u -r1.40 printf.3
 | --- printf.3	20 Jul 2005 13:31:15 -0000	1.40
 | +++ printf.3	3 Mar 2006 21:38:40 -0000
 | @@ -667,7 +667,7 @@
 |  and
 |  .Fn vfprintf
 |  return the number of characters printed.
 | -Otherwise \-1 is returned and
 | +Otherwise a negative value is returned and
 |  .Dv errno
 |  is set to indicate the error.
 |  .Pp
 
 ...
 
 Well -1 is negative (so we fulfill the requirement) and our implementation
 only returns -1, so our documentation is correct. Perhaps a note saying that
 conforming implementations are not required to return -1 and portable code
 should not depend on these functions returning -1, is appropriate instead.
 
 christos