diff options
author | Chad Loder <cloder@cvs.openbsd.org> | 2006-10-14 18:50:33 +0000 |
---|---|---|
committer | Chad Loder <cloder@cvs.openbsd.org> | 2006-10-14 18:50:33 +0000 |
commit | 9e08e617b113b5d19753bd6e22672f0f233aaf03 (patch) | |
tree | a430937869379a96ebebe9556ecd747598f0b3cb | |
parent | 47eb62f3095629449924a994de71e4e36b184558 (diff) |
Make fgets description much clearer with respect to its exact behavior.
OK and input from deraadt, jmc, millert.
-rw-r--r-- | lib/libc/stdio/fgets.3 | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/libc/stdio/fgets.3 b/lib/libc/stdio/fgets.3 index 3ba2aacbbab..62f6fb8e7b4 100644 --- a/lib/libc/stdio/fgets.3 +++ b/lib/libc/stdio/fgets.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fgets.3,v 1.21 2005/07/26 03:30:25 jaredy Exp $ +.\" $OpenBSD: fgets.3,v 1.22 2006/10/14 18:50:32 cloder Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -47,18 +47,20 @@ .Sh DESCRIPTION The .Fn fgets -function reads at most one less than the number of characters specified by -.Ar size -from the given +function reads at most +.Ar size Ns \-1 +characters from the given .Fa stream and stores them in the string .Fa str . Reading stops when a newline character is found, at end-of-file, or on error. The newline, if any, is retained. -In any case, a -.Ql \e0 -character is appended to end the string. +The string will be NUL-terminated if +.Fn fgets +suceeds; otherwise the contents of +.Fa str +are undefined. .Pp The .Fn gets |