check return value of fgets and exit main loop if EOF is received

This commit is contained in:
Bill Kolokithas 2014-02-04 22:28:01 +02:00
parent 7ecc02bc80
commit 4e1d114f4e

4
bar.c
View File

@ -568,7 +568,9 @@ main (int argc, char **argv)
else break; /* ...bail out */
}
if (pollin[0].revents & POLLIN) { /* New input, process it */
fgets (input, sizeof(input), stdin);
if (fgets (input, sizeof(input), stdin) == NULL)
break; /* EOF received */
parse (input);
redraw = 1;
}