OSDN Git Service

(split) LDP: Update original to LDP v3.65
[linuxjm/LDP_man-pages.git] / original / man3 / getline.3
index ae2b912..34100ea 100644 (file)
@@ -23,7 +23,7 @@
 .\" the source, must acknowledge the copyright and authors of this work.
 .\" %%%LICENSE_END
 .\"
-.TH GETLINE 3  2010-06-12 "GNU" "Linux Programmer's Manual"
+.TH GETLINE 3  2014-04-06 "GNU" "Linux Programmer's Manual"
 .SH NAME
 getline, getdelim \- delimited string input
 .SH SYNOPSIS
@@ -65,13 +65,15 @@ one was found.
 
 If
 .I "*lineptr"
-is NULL, then
-.BR getline ()
-will allocate a buffer for storing the line,
-which should be freed by the user program.
-(In this case, the value in
+is set to NULL and
 .I *n
-is ignored.)
+is set 0 before the call, then
+.BR getline ()
+will allocate a buffer for storing the line.
+This buffer should be freed by the user program
+even if
+.BR getline ()
+failed.
 
 Alternatively, before calling
 .BR getline (),
@@ -113,12 +115,15 @@ On success,
 and
 .BR getdelim ()
 return the number of characters read, including the delimiter character,
-but not including the terminating null byte.
+but not including the terminating null byte (\(aq\\0\(aq).
 This value can be used
 to handle embedded null bytes in the line read.
 
 Both functions return \-1 on failure to read a line (including end-of-file
 condition).
+In the event of an error,
+.I errno
+is set to indicate the cause.
 .SH ERRORS
 .TP
 .B EINVAL
@@ -170,5 +175,12 @@ main(void)
 .BR fgets (3),
 .BR fopen (3),
 .BR fread (3),
-.BR gets (3),
 .BR scanf (3)
+.SH COLOPHON
+This page is part of release 3.65 of the Linux
+.I man-pages
+project.
+A description of the project,
+and information about reporting bugs,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.