getline.3: Use better variable name in example program

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2017-01-23 15:29:23 +13:00
parent 4c3cfc369c
commit 809b6c47cc
1 changed files with 3 additions and 3 deletions

View File

@ -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);
}