while ((k = getopt(argc, argv, "dnst:")) != -1) {
switch (k) {
#if HAVE_USE_DEFAULT_COLORS
while ((k = getopt(argc, argv, "dnst:")) != -1) {
switch (k) {
#if HAVE_USE_DEFAULT_COLORS
- if (redirected) {
- char *name = getenv("TERM");
- if (name == 0
- || newterm(name, ofp, ifp) == 0) {
- fprintf(stderr, "cannot open terminal\n");
- ExitProgram(EXIT_FAILURE);
+ InitAndCatch({
+ if (redirected) {
+ char *name = getenv("TERM");
+ if (name == 0
+ || newterm(name, ofp, ifp) == 0) {
+ fprintf(stderr, "cannot open terminal\n");
+ ExitProgram(EXIT_FAILURE);
+ }
+ } else {
+ initscr();