summaryrefslogtreecommitdiff
path: root/man3/getline.3
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2006-05-18 22:24:03 +0000
committerMichael Kerrisk <mtk.manpages@gmail.com>2006-05-18 22:24:03 +0000
commit2df47dc8f198257294bf5f7f8e3bcab40ea31ab2 (patch)
treed9e42d5cf61f65d669a97e348788a855e6d6464c /man3/getline.3
parentaa52d7769ac83e178b30ee91d15b03df69bd6eaa (diff)
Various minor clarifications.
Diffstat (limited to 'man3/getline.3')
-rw-r--r--man3/getline.324
1 files changed, 10 insertions, 14 deletions
diff --git a/man3/getline.3 b/man3/getline.3
index 12fedd2b4..79ad7482f 100644
--- a/man3/getline.3
+++ b/man3/getline.3
@@ -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),