diff options
Diffstat (limited to 'man3/getline.3')
-rw-r--r-- | man3/getline.3 | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/man3/getline.3 b/man3/getline.3 index 3ad4c4392..2b9d74a2f 100644 --- a/man3/getline.3 +++ b/man3/getline.3 @@ -4,7 +4,7 @@ .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" -.TH getline 3 2023-02-05 "Linux man-pages 6.03" +.TH getline 3 2023-07-20 "Linux man-pages 6.05.01" .SH NAME getline, getdelim \- delimited string input .SH LIBRARY @@ -121,35 +121,30 @@ Allocation or reallocation of the line buffer failed. .SH ATTRIBUTES For an explanation of the terms used in this section, see .BR attributes (7). -.ad l -.nh .TS allbox; lbx lb lb l l l. Interface Attribute Value T{ +.na +.nh .BR getline (), .BR getdelim () T} Thread safety MT-Safe .TE -.hy -.ad .sp 1 .SH STANDARDS -Both -.BR getline () -and -.BR getdelim () -were originally GNU extensions. -They were standardized in POSIX.1-2008. +POSIX.1-2008. +.SH HISTORY +GNU, POSIX.1-2008. .SH EXAMPLES .\" SRC BEGIN (getline.c) .EX #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> - +\& int main(int argc, char *argv[]) { @@ -157,23 +152,23 @@ main(int argc, char *argv[]) char *line = NULL; size_t len = 0; ssize_t nread; - +\& if (argc != 2) { fprintf(stderr, "Usage: %s <file>\en", argv[0]); exit(EXIT_FAILURE); } - +\& stream = fopen(argv[1], "r"); if (stream == NULL) { perror("fopen"); exit(EXIT_FAILURE); } - +\& while ((nread = getline(&line, &len, stream)) != \-1) { printf("Retrieved line of length %zd:\en", nread); fwrite(line, nread, 1, stdout); } - +\& free(line); fclose(stream); exit(EXIT_SUCCESS); |