diff options
author | Jakob Kaivo <jkk@ung.org> | 2022-04-19 21:30:07 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2022-04-19 21:30:07 -0400 |
commit | 9e60415967b7cb074c26d204bdc908a1962b60d8 (patch) | |
tree | 92b7ce894ef2597fd61f57e1ce2b2f3d9372b2bc | |
parent | 0045947d477b3ebc1d35a6711cc0853683dfb46f (diff) |
attempt to open stderr for reading first to comply with POSIX
-rw-r--r-- | more.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -751,15 +751,16 @@ int main(int argc, char *argv[]) return ret; } - if (isatty(STDIN_FILENO)) { - initscr(); - } else { + if (newterm(NULL, stdout, stderr) == NULL) { FILE *tty = fopen("/dev/tty", "r"); if (tty == NULL) { perror("more: couldn't open terminal"); return 1; } - newterm(NULL, stdout, tty); + if (newterm(NULL, stdout, tty) == NULL) { + perror("more: couldn't open terminal"); + return 1; + } } cbreak(); |