--- fputs.3.bsdnew 2009-11-11 13:33:07.000000000 -0800 +++ fputs.3 2009-11-11 13:33:08.000000000 -0800 @@ -44,14 +44,19 @@ .Sh SYNOPSIS .In stdio.h .Ft int -.Fn fputs "const char *str" "FILE *stream" +.Fo fputs +.Fa "const char *restrict s" +.Fa "FILE *restrict stream" +.Fc .Ft int -.Fn puts "const char *str" +.Fo puts +.Fa "const char *s" +.Fc .Sh DESCRIPTION The function .Fn fputs writes the string pointed to by -.Fa str +.Fa s to the stream pointed to by .Fa stream . .\" The terminating @@ -61,7 +66,7 @@ to the stream pointed to by The function .Fn puts writes the string -.Fa str , +.Fa s , and a terminating newline character, to the stream .Dv stdout . @@ -90,6 +95,14 @@ may also fail and set .Va errno for any of the errors specified for the routines .Xr write 2 . +.Sh COMPATIBILITY +.Fn fputs +now returns a non-negative number (as opposed to 0) +on successful completion. +As a result, many tests (e.g., "fputs() == 0", "fputs() != 0") +do not give the desired result. +Use "fputs() != EOF" or "fputs() == EOF" +to determine success or failure. .Sh SEE ALSO .Xr ferror 3 , .Xr fputws 3 , @@ -102,3 +115,13 @@ and .Fn puts conform to .St -isoC . +While not mentioned in the standard, both +.Fn fputs +and +.Fn puts +print +.Ql (null) +if +.Fa str +is +.Dv NULL .