[net.bugs.4bsd] ungetc

roger (09/22/82)

The function ungetc in the stdio does not perform according to the
manual page entry ungetc(3S).  According to the manual ungetc should
return the character passed to it when it can successfully place the
character back on the input stream, otherwise it returns EOF.  In
practice ungetc returns zero when it works instead of the character
passed to it.  There are two solutions to this:

1) Change the documentation to indicate 0 is returned when ungetc is
   successful.

2) Change the last return statement in ungetc from:

	return(0);

   to:

	return(c);

This bug may be in other versons of Unix besides 4.1.


				Roger L. Ferrel
				John Fluke Mfg. Co., Inc.
				P.O. Box C9090
				Everett, WA 98206