--- rxvt-unicode/src/init.C 2010/06/14 15:40:03 1.266 +++ rxvt-unicode/src/init.C 2010/07/26 22:07:38 1.273 @@ -560,24 +560,6 @@ set_option (Opt_buffered); } -static void -init_secondary () -{ - int i; - - if ((i = open ("/dev/null", O_RDONLY)) < 0) - { - dup2 (STDERR_FILENO, STDIN_FILENO); - } - else if (i != STDIN_FILENO) - { - dup2 (i, STDIN_FILENO); - close (i); - } - - dup2 (STDERR_FILENO, STDOUT_FILENO); -} - /*----------------------------------------------------------------------*/ const char ** rxvt_term::init_resources (int argc, const char *const *argv) @@ -792,8 +774,6 @@ init_vars (); - init_secondary (); - const char **cmd_argv = init_resources (argc, argv); #ifdef KEYSYM_RESOURCE @@ -1529,8 +1509,8 @@ /* ------------------------------------------------------------------------- * * GET TTY CURRENT STATE * * ------------------------------------------------------------------------- */ -void -rxvt_get_ttymode (struct termios *tio, int erase) +static void +rxvt_get_ttymode (struct termios *tio) { /* * standard System V termios interface @@ -1542,6 +1522,9 @@ // return error - use system defaults, // where possible, and zero elsewhere memset (tio, 0, sizeof (struct termios)); + if (VDISABLE) + for (int i = 0; i < NCCS; i++) + tio->c_cc[i] = VDISABLE; tio->c_cc[VINTR] = CINTR; tio->c_cc[VQUIT] = CQUIT; @@ -1571,16 +1554,6 @@ } tio->c_cc[VEOF] = CEOF; - tio->c_cc[VEOL] = VDISABLE; -# ifdef VEOL2 - tio->c_cc[VEOL2] = VDISABLE; -# endif -# ifdef VSWTC - tio->c_cc[VSWTC] = VDISABLE; -# endif -# ifdef VSWTCH - tio->c_cc[VSWTCH] = VDISABLE; -# endif # if VMIN != VEOF tio->c_cc[VMIN] = 1; # endif @@ -1588,9 +1561,6 @@ tio->c_cc[VTIME] = 0; # endif - if (erase != -1) - tio->c_cc[VERASE] = (char)erase; - /* input modes */ tio->c_iflag = (BRKINT | IGNPAR | ICRNL # ifdef IMAXBEL @@ -1621,7 +1591,7 @@ /* cpp token stringize doesn't work on all machines */ # define FOO(flag,name) \ if ((tio->c_iflag) & flag) \ - fprintf (stderr, "%s ", name) + fprintf (stderr, "%s ", name) /* c_iflag bits */ FOO (IGNBRK, "IGNBRK"); @@ -1718,18 +1688,15 @@ if (!pty->get ()) rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); - int er; + rxvt_get_ttymode (&tio); #ifndef NO_BACKSPACE_KEY if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1]) - er = rs[Rs_backspace_key][0]; + tio.c_cc[VERASE] = rs[Rs_backspace_key][0]; else if (strcmp (rs[Rs_backspace_key], "DEC") == 0) - er = '\177'; /* the initial state anyway */ - else + tio.c_cc[VERASE] = '\177'; /* the initial state anyway */ #endif - er = -1; - rxvt_get_ttymode (&tio, er); /* init terminal attributes */ cfsetospeed (&tio, BAUDRATE); cfsetispeed (&tio, BAUDRATE); @@ -1826,7 +1793,7 @@ signal (SIGHUP, SIG_DFL); signal (SIGPIPE, SIG_DFL); /* - * mimick login's behavior by disabling the job control signals + * mimic login's behavior by disabling the job control signals * a shell that wants them can turn them back on */ #ifdef SIGTSTP