mirror of https://github.com/mkerrisk/man-pages
getline.3: Use better variable name in example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
4c3cfc369c
commit
809b6c47cc
|
@ -170,14 +170,14 @@ main(void)
|
|||
FILE *stream;
|
||||
char *line = NULL;
|
||||
size_t len = 0;
|
||||
ssize_t read;
|
||||
ssize_t nread;
|
||||
|
||||
stream = fopen("/etc/motd", "r");
|
||||
if (stream == NULL)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
while ((read = getline(&line, &len, stream)) != \-1) {
|
||||
printf("Retrieved line of length %zu :\en", read);
|
||||
while ((nread = getline(&line, &len, stream)) != \-1) {
|
||||
printf("Retrieved line of length %zu :\en", nread);
|
||||
printf("%s", line);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue