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:
parent
7ae4ced06f
commit
3d92cff726
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue