diff options
author | bde <bde@FreeBSD.org> | 1996-03-27 17:43:38 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-03-27 17:43:38 +0000 |
commit | f1d0d6d615be41a8e1f0ddf2e5e88f92c0c1c9c9 (patch) | |
tree | d327096c88c1c303fc294efda4c1d4e30bd599da /lib/libc | |
parent | d3ae37ce3bac3518ad52ee02d045bb35a660a9de (diff) | |
download | FreeBSD-src-f1d0d6d615be41a8e1f0ddf2e5e88f92c0c1c9c9.zip FreeBSD-src-f1d0d6d615be41a8e1f0ddf2e5e88f92c0c1c9c9.tar.gz |
Say what happens to the buffer when fgets() returns NULL.
Fixed bogus cross references and a misordered line.
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdio/fgets.3 | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/libc/stdio/fgets.3 b/lib/libc/stdio/fgets.3 index 827de6b..e169382 100644 --- a/lib/libc/stdio/fgets.3 +++ b/lib/libc/stdio/fgets.3 @@ -53,7 +53,7 @@ The .Fn fgets function reads at most one less than the number of characters specified by -.Xr size +.Fa size from the given .Fa stream and stores them in the string @@ -61,7 +61,7 @@ and stores them in the string Reading stops when a newline character is found, at end-of-file or error. The newline, if any, is retained. -In any case a +If any characters are read and there is no error, a .Ql \e0 character is appended to end the string. .Pp @@ -71,7 +71,7 @@ function is equivalent to .Fn fgets with an infinite -.Xr size +.Fa size and a .Fa stream of @@ -87,14 +87,19 @@ and .Fn gets return a pointer to the string. -If end-of-file or an error occurs before any characters are read, +If end-of-file occurs before any characters are read, they return -.Dv NULL. +.Dv NULL +and the buffer contents is unchanged. +If an error occurs, +they return +.Dv NULL +and the buffer contents is indeterminate. The .Fn fgets and -functions .Fn gets +functions do not distinguish between end-of-file and error, and callers must use .Xr feof 3 and |