--- linux.cpp.old 2007-01-15 14:49:10.000000000 +0100 +++ linux.cpp 2008-05-15 17:16:36.000000000 +0200 @@ -455,6 +455,19 @@ //--------------------------------------------------------------------------- static void term_out(const char *buf, size_t len) { + // HACK + char *pBackGround; + int noOUT=0; + + if( (pBackGround = getenv("TVOUT")) != NULL) { + if(!strcasecmp(pBackGround, "noOUT")) + noOUT=1; + } + + if( noOUT ) + return; + // + size_t sz; int svm = -1; @@ -1590,6 +1603,20 @@ //--------------------------------------------------------------------------- static void attach_tty(void) { + // HACK + char *pBackGround; + int noOUT=0; + + if( (pBackGround = getenv("TVOUT")) != NULL) { + if(!strcasecmp(pBackGround, "noOUT")) + noOUT=1; + } + + if( noOUT ) { + return; + } + // + if(work.tty_owned) return; work.tty_owned = 1; @@ -2658,12 +2685,26 @@ //--------------------------------------------------------------------------- static void set_all_signals(sighandler_t handler) { + // HACK + char *pBackGround; + int noOUT=0; + signal(SIGWINCH, handler); signal(SIGTERM, handler); signal(SIGSTOP, handler); signal(SIGHUP, handler); signal(SIGUSR1, handler); signal(SIGUSR2, handler); + + // HACK + if( (pBackGround = getenv("TVOUT")) != NULL) { + if(!strcasecmp(pBackGround, "noOUT")) + noOUT=1; + } + + if( noOUT ) + signal(SIGTTOU, SIG_IGN); + // } //--------------------------------------------------------------------------- @@ -2694,23 +2735,37 @@ static uchar loaded; char *p, *ps; + + // HACK + char *pBackGround; + int noOUT=0; + signed char no_x11, noansi, no_gpm, ign_meta8; if(loaded) error("Multiple TV instances"); ++loaded; - if( !isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO) - || (tty_mode = fcntl(STDIN_FILENO, F_GETFL, 0)) == -1 - || (tty_mode & O_ACCMODE) != O_RDWR - || tcgetattr(STDIN_FILENO, &old_tios)) - error("Can not work with redirected stdin/stdout"); - - my_tios = old_tios; - my_tios.c_iflag |= (IGNBRK | BRKINT); // Ignore breaks - my_tios.c_iflag &= ~(IXOFF | IXON); // Disable Xon/off - my_tios.c_lflag &= ~(ICANON | ECHO | ISIG); // Character oriented, no echo, no signals - my_tios.c_oflag |= OPOST; // apply special output sequence - my_tios.c_cc[VMIN] = 1; + // HACK + if( (pBackGround = getenv("TVOUT")) != NULL) { + if(!strcasecmp(pBackGround, "noOUT")) + noOUT=1; + } + + + if( !noOUT ) { + if( !isatty(STDIN_FILENO) || !isatty(STDOUT_FILENO) + || (tty_mode = fcntl(STDIN_FILENO, F_GETFL, 0)) == -1 + || (tty_mode & O_ACCMODE) != O_RDWR + || tcgetattr(STDIN_FILENO, &old_tios)) + error("Can not work with redirected stdin/stdout"); + + my_tios = old_tios; + my_tios.c_iflag |= (IGNBRK | BRKINT); // Ignore breaks + my_tios.c_iflag &= ~(IXOFF | IXON); // Disable Xon/off + my_tios.c_lflag &= ~(ICANON | ECHO | ISIG); // Character oriented, no echo, no signals + my_tios.c_oflag |= OPOST; // apply special output sequence + my_tios.c_cc[VMIN] = 1; + } if((p = getenv("TVLOG")) != NULL && *p) { FILE *f;