mirror of https://github.com/mkerrisk/man-pages
getline.3: Consistency fix: use "stream" as name for "FILE *" argument
Inspired by Carlos O'Donell's recent patches. Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
d41abf5dc6
commit
363b9dceab
|
@ -150,22 +150,22 @@ They were standardized in POSIX.1-2008.
|
|||
int
|
||||
main(void)
|
||||
{
|
||||
FILE *fp;
|
||||
FILE *stream;
|
||||
char *line = NULL;
|
||||
size_t len = 0;
|
||||
ssize_t read;
|
||||
|
||||
fp = fopen("/etc/motd", "r");
|
||||
if (fp == NULL)
|
||||
stream = fopen("/etc/motd", "r");
|
||||
if (stream == NULL)
|
||||
exit(EXIT_FAILURE);
|
||||
|
||||
while ((read = getline(&line, &len, fp)) != \-1) {
|
||||
while ((read = getline(&line, &len, stream)) != \-1) {
|
||||
printf("Retrieved line of length %zu :\en", read);
|
||||
printf("%s", line);
|
||||
}
|
||||
|
||||
free(line);
|
||||
fclose(fp);
|
||||
fclose(stream);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
.fi
|
||||
|
|
Loading…
Reference in New Issue