summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fgets.3
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/fgets.3')
-rw-r--r--lib/libc/stdio/fgets.331
1 files changed, 27 insertions, 4 deletions
diff --git a/lib/libc/stdio/fgets.3 b/lib/libc/stdio/fgets.3
index 278e18c..764dd10 100644
--- a/lib/libc/stdio/fgets.3
+++ b/lib/libc/stdio/fgets.3
@@ -32,12 +32,13 @@
.\" @(#)fgets.3 8.1 (Berkeley) 6/4/93
.\" $FreeBSD$
.\"
-.Dd May 5, 2012
+.Dd April 3, 2018
.Dt FGETS 3
.Os
.Sh NAME
.Nm fgets ,
-.Nm gets
+.Nm gets ,
+.Nm gets_s
.Nd get a line from a stream
.Sh LIBRARY
.Lb libc
@@ -46,6 +47,8 @@
.Ft char *
.Fn fgets "char * restrict str" "int size" "FILE * restrict stream"
.Ft char *
+.Fn gets_s "char *str" "rsize_t size"
+.Ft char *
.Fn gets "char *str"
.Sh DESCRIPTION
The
@@ -65,6 +68,17 @@ If any characters are read and there is no error, a
character is appended to end the string.
.Pp
The
+.Fn gets_s
+function
+is equivalent to
+.Fn fgets
+with a
+.Fa stream
+of
+.Dv stdin ,
+except that the newline character (if any) is not stored in the string.
+.Pp
+The
.Fn gets
function
is equivalent to
@@ -80,7 +94,8 @@ It is the caller's responsibility to ensure that the input line,
if any, is sufficiently short to fit in the string.
.Sh RETURN VALUES
Upon successful completion,
-.Fn fgets
+.Fn fgets ,
+.Fn gets_s ,
and
.Fn gets
return
@@ -94,7 +109,8 @@ they return
.Dv NULL
and the buffer contents are indeterminate.
The
-.Fn fgets
+.Fn fgets ,
+.Fn gets_s ,
and
.Fn gets
functions
@@ -141,6 +157,13 @@ and
.Fn gets
conform to
.St -isoC-99 .
+.Fn gets_s
+conforms to
+.St -isoC-2011
+K.3.7.4.1.
+.Fn gets
+has been removed from
+.St -isoC-2011 .
.Sh SECURITY CONSIDERATIONS
The
.Fn gets
OpenPOWER on IntegriCloud