summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--more.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/more.c b/more.c
index 8dcea05..800f0da 100644
--- a/more.c
+++ b/more.c
@@ -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();