This is the mail archive of the
newlib@sourceware.cygnus.com
mailing list for the newlib project.
putw() should return 0 on success
- To: newlib at sourceware dot cygnus dot com
- Subject: putw() should return 0 on success
- From: Alexandre Oliva <oliva at lsd dot ic dot unicamp dot br>
- Date: 10 Mar 2000 14:50:28 -0300
I'm checking this in, approved by J. Johnston.
Index: newlib/ChangeLog
from Alexandre Oliva <oliva@lsd.ic.unicamp.br>
* libc/stdio/putw.c (putw): Return 0 on success, to be compliant
with XSH5, not SVID.
Index: newlib/libc/stdio/putw.c
===================================================================
RCS file: /cvs/cvsfiles/devo/newlib/libc/stdio/putw.c,v
retrieving revision 1.1
diff -u -r1.1 putw.c
--- newlib/libc/stdio/putw.c 2000/03/08 03:29:50 1.1
+++ newlib/libc/stdio/putw.c 2000/03/10 03:03:05
@@ -37,10 +37,7 @@
to write a word to the file or stream identified by <[fp]>. As a side
effect, <<putw>> advances the file's current position indicator.
-RETURNS The written word, unless the host system reports a write
-error, in which case <<putw>> returns <<EOF>>. Since <<EOF>> is a
-valid <<int>>, you must use <<ferror>> or <<feof>> to distinguish
-these situations when writing the integer equal to <<EOF>>.
+RETURNS Zero on success, <<EOF>> on failure.
PORTABILITY
<<putw>> is a remnant of K&R C, it is not part of any ISO C Standard.
@@ -62,5 +59,5 @@
{
if (fwrite((const char*)&w, sizeof(w), 1, fp) != 1)
return EOF;
- return w;
+ return 0;
}
--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/ Enjoy Guaranį
Cygnus Solutions, a Red Hat company aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org} Write to mailing lists, not to me