mirror of https://github.com/mkerrisk/man-pages
Various minor clarifications.
This commit is contained in:
parent
aa52d7769a
commit
2df47dc8f1
|
@ -21,7 +21,7 @@
|
|||
.\" Formatted or processed versions of this manual, if unaccompanied by
|
||||
.\" the source, must acknowledge the copyright and authors of this work.
|
||||
.\" License.
|
||||
.TH GETLINE 3 2001-10-07 "GNU" "Linux Programmer's Manual"
|
||||
.TH GETLINE 3 2006-05-17 "GNU" "Linux Programmer's Manual"
|
||||
.SH NAME
|
||||
getline, getdelim \- delimited string input
|
||||
.SH SYNOPSIS
|
||||
|
@ -34,19 +34,19 @@ getline, getdelim \- delimited string input
|
|||
.BI "ssize_t getdelim(char **" lineptr ", size_t *" n ", int " delim ", FILE *" stream );
|
||||
.SH DESCRIPTION
|
||||
.BR getline ()
|
||||
reads an entire line, storing the address of the buffer containing
|
||||
the text into
|
||||
reads an entire line from \fIstream\fP,
|
||||
storing the address of the buffer containing the text into
|
||||
.IR "*lineptr" .
|
||||
The buffer is null-terminated and includes the newline character, if a
|
||||
newline delimiter was found.
|
||||
The buffer is null-terminated and includes the newline character, if
|
||||
one was found.
|
||||
|
||||
.\" FIXME what happens if *lineptr is NULL but *n isn't zero ?
|
||||
.\" Answer: *n is ignored and a new buffer is allocated
|
||||
If
|
||||
.IR "*lineptr"
|
||||
is NULL, then the
|
||||
is NULL, then
|
||||
.BR getline ()
|
||||
routine will allocate a buffer for containing the line, which must be freed
|
||||
will allocate a buffer for storing the line, which should be freed
|
||||
by the user program.
|
||||
Alternatively, before calling
|
||||
.BR getline (),
|
||||
|
@ -55,9 +55,9 @@ can contain a pointer to a
|
|||
.BR malloc ()\-allocated
|
||||
buffer
|
||||
.IR "*n"
|
||||
bytes in size. If the buffer is not large enough to hold the line read in,
|
||||
bytes in size. If the buffer is not large enough to hold the line,
|
||||
.BR getline ()
|
||||
resizes the buffer to fit with
|
||||
resizes it with
|
||||
.BR realloc (),
|
||||
updating
|
||||
.IR "*lineptr"
|
||||
|
@ -67,7 +67,7 @@ as necessary. In either case, on a successful call,
|
|||
.IR "*lineptr"
|
||||
and
|
||||
.IR "*n"
|
||||
will be updated to reflect the buffer address and size respectively.
|
||||
will be updated to reflect the buffer address and allocated size respectively.
|
||||
|
||||
.BR getdelim ()
|
||||
works like
|
||||
|
@ -78,7 +78,6 @@ argument. As with
|
|||
.BR getline (),
|
||||
a delimiter character is not added if one was not present
|
||||
in the input before end of file was reached.
|
||||
|
||||
.SH "RETURN VALUE"
|
||||
On success,
|
||||
.BR getline ()
|
||||
|
@ -90,7 +89,6 @@ to handle embedded null bytes in the line read.
|
|||
|
||||
Both functions return \-1 on failure to read a line (including end of file
|
||||
condition).
|
||||
|
||||
.SH ERRORS
|
||||
.TP
|
||||
.B EINVAL
|
||||
|
@ -101,7 +99,6 @@ or
|
|||
is NULL, or
|
||||
.I stream
|
||||
is not valid).
|
||||
|
||||
.SH "EXAMPLE"
|
||||
.nf
|
||||
#define _GNU_SOURCE
|
||||
|
@ -133,7 +130,6 @@ and
|
|||
.BR getdelim ()
|
||||
are GNU extensions.
|
||||
They are available since libc 4.6.27.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
.BR read (2),
|
||||
.BR fgets (3),
|
||||
|
|
Loading…
Reference in New Issue