lookip: Use line buffering for stdout

Otherwise, the output is buffered when e.g. piping the output to another
command (or file).  And it avoids having to call fflush() in the
interactive mode.

Fixes #3404.
This commit is contained in:
Tobias Brunner
2020-05-07 15:05:55 +02:00
parent 7ae4ced06f
commit 3d92cff726
+2 -1
View File
@@ -203,7 +203,6 @@ static int interactive(int fd)
int res;
printf("> ");
fflush(stdout);
if (fgets(line, sizeof(line), stdin))
{
@@ -266,6 +265,8 @@ int main(int argc, char *argv[])
return 1;
}
setvbuf(stdout, NULL, _IOLBF, 0);
if (argc == 1)
{
res = interactive(fd);