summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2017-07-04 15:33:04 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2017-07-04 15:33:04 +0000
commit7aedc061bd91b70974ddc6164ae7f2a5155c99ae (patch)
tree44368dd3dd130120f68c12f4e0258708b679e786 /lib
parent02a35bf9d9a4d1f7b2b9a8541d3b87e28ae23532 (diff)
1. mild deprecation notice
2. point to getline (suggested by nicm@) 3. cross reference fgetc(3) rather than putc(3) 4. add missing error handling to the example code OK nicm@
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/stdio/fgetln.314
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/libc/stdio/fgetln.3 b/lib/libc/stdio/fgetln.3
index a6f4af0392a..6cd9c5c9a11 100644
--- a/lib/libc/stdio/fgetln.3
+++ b/lib/libc/stdio/fgetln.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: fgetln.3,v 1.17 2015/01/13 14:02:30 schwarze Exp $
+.\" $OpenBSD: fgetln.3,v 1.18 2017/07/04 15:33:03 schwarze Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: January 13 2015 $
+.Dd $Mdocdate: July 4 2017 $
.Dt FGETLN 3
.Os
.Sh NAME
@@ -38,6 +38,11 @@
.Ft char *
.Fn fgetln "FILE *stream" "size_t *len"
.Sh DESCRIPTION
+Using this function is error-prone in multiple ways;
+consider using the safer and more portable function
+.Xr getline 3
+instead.
+.Pp
The
.Fn fgetln
function returns a pointer to the next line from the stream referenced by
@@ -103,10 +108,11 @@ or
.Xr realloc 3 .
.Sh SEE ALSO
.Xr ferror 3 ,
+.Xr fgetc 3 ,
.Xr fgets 3 ,
.Xr fopen 3 ,
.Xr fparseln 3 ,
-.Xr putc 3
+.Xr getline 3
.Sh HISTORY
The
.Fn fgetln
@@ -139,4 +145,6 @@ temporary buffer:
printf("%s\en", buf);
}
free(lbuf);
+ if (ferror(fp))
+ err(1, "fgetln");
.Ed