aboutsummaryrefslogtreecommitdiffstats
path: root/noice.c
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2015-11-26 15:54:54 +0000
committersin <sin@2f30.org>2015-11-26 15:56:08 +0000
commit013bcdee35b54fd7be928e8b57e9c659d325fff3 (patch)
tree3980011d1d59fea96a7687c6c15d8b040b645712 /noice.c
parent4abc9f0b4601b530cf3d5aaefa1f745eb958680c (diff)
downloadnoice-013bcdee35b54fd7be928e8b57e9c659d325fff3.tar.gz
Don't use printerr() before curses has been initialized
Diffstat (limited to 'noice.c')
-rw-r--r--noice.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/noice.c b/noice.c
index 60423e7..38604dc 100644
--- a/noice.c
+++ b/noice.c
@@ -885,8 +885,10 @@ main(int argc, char *argv[])
char *ifilter;
/* Confirm we are in a terminal */
- if (!isatty(STDIN_FILENO))
- printerr(1, "isatty");
+ if (!isatty(0) || !isatty(1)) {
+ fprintf(stderr, "stdin or stdout is not a tty\n");
+ exit(1);
+ }
if (getuid() == 0)
ifilter = ".";
@@ -904,8 +906,10 @@ main(int argc, char *argv[])
signal(SIGINT, SIG_IGN);
/* Test initial path */
- if (canopendir(ipath) == 0)
- printerr(1, ipath);
+ if (canopendir(ipath) == 0) {
+ fprintf(stderr, "%s: %s\n", ipath, strerror(errno));
+ exit(1);
+ }
/* Set locale before curses setup */
setlocale(LC_ALL, "");
@@ -916,5 +920,5 @@ main(int argc, char *argv[])
exitcurses();
- return 0;
+ exit(0);
}
Un proyecto texto-plano.xyz