diff --git a/conio.h b/conio.h index 983efc8..fef3a9e 100644 --- a/conio.h +++ b/conio.h @@ -19,6 +19,7 @@ #define CONIO_H_ #include +#include /* Attributes */ #define RESETATTR 0 @@ -94,6 +95,12 @@ static inline void initscr(int *row, int *col) struct termios tc, saved; struct pollfd fd = { STDIN_FILENO, POLLIN, 0 }; + if (!isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO)) { + *row = 24; + *col = 80; + return; + } + /* Disable echo to terminal while probing */ tcgetattr(STDERR_FILENO, &tc); saved = tc;