… | |
… | |
1527 | } |
1527 | } |
1528 | |
1528 | |
1529 | /* ------------------------------------------------------------------------- * |
1529 | /* ------------------------------------------------------------------------- * |
1530 | * GET TTY CURRENT STATE * |
1530 | * GET TTY CURRENT STATE * |
1531 | * ------------------------------------------------------------------------- */ |
1531 | * ------------------------------------------------------------------------- */ |
1532 | void |
1532 | static void |
1533 | rxvt_get_ttymode (struct termios *tio, int erase) |
1533 | rxvt_get_ttymode (struct termios *tio) |
1534 | { |
1534 | { |
1535 | /* |
1535 | /* |
1536 | * standard System V termios interface |
1536 | * standard System V termios interface |
1537 | */ |
1537 | */ |
1538 | // does not work as stdin is not a tty |
1538 | // does not work as stdin is not a tty |
… | |
… | |
1579 | # endif |
1579 | # endif |
1580 | # if VTIME != VEOL |
1580 | # if VTIME != VEOL |
1581 | tio->c_cc[VTIME] = 0; |
1581 | tio->c_cc[VTIME] = 0; |
1582 | # endif |
1582 | # endif |
1583 | |
1583 | |
1584 | if (erase != -1) |
|
|
1585 | tio->c_cc[VERASE] = (char)erase; |
|
|
1586 | |
|
|
1587 | /* input modes */ |
1584 | /* input modes */ |
1588 | tio->c_iflag = (BRKINT | IGNPAR | ICRNL |
1585 | tio->c_iflag = (BRKINT | IGNPAR | ICRNL |
1589 | # ifdef IMAXBEL |
1586 | # ifdef IMAXBEL |
1590 | | IMAXBEL |
1587 | | IMAXBEL |
1591 | # endif |
1588 | # endif |
… | |
… | |
1612 | fprintf (stderr, "Input flags\n"); |
1609 | fprintf (stderr, "Input flags\n"); |
1613 | |
1610 | |
1614 | /* cpp token stringize doesn't work on all machines <sigh> */ |
1611 | /* cpp token stringize doesn't work on all machines <sigh> */ |
1615 | # define FOO(flag,name) \ |
1612 | # define FOO(flag,name) \ |
1616 | if ((tio->c_iflag) & flag) \ |
1613 | if ((tio->c_iflag) & flag) \ |
1617 | fprintf (stderr, "%s ", name) |
1614 | fprintf (stderr, "%s ", name) |
1618 | |
1615 | |
1619 | /* c_iflag bits */ |
1616 | /* c_iflag bits */ |
1620 | FOO (IGNBRK, "IGNBRK"); |
1617 | FOO (IGNBRK, "IGNBRK"); |
1621 | FOO (BRKINT, "BRKINT"); |
1618 | FOO (BRKINT, "BRKINT"); |
1622 | FOO (IGNPAR, "IGNPAR"); |
1619 | FOO (IGNPAR, "IGNPAR"); |
… | |
… | |
1709 | else |
1706 | else |
1710 | #endif |
1707 | #endif |
1711 | if (!pty->get ()) |
1708 | if (!pty->get ()) |
1712 | rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); |
1709 | rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); |
1713 | |
1710 | |
1714 | int er; |
1711 | rxvt_get_ttymode (&tio); |
1715 | |
1712 | |
1716 | #ifndef NO_BACKSPACE_KEY |
1713 | #ifndef NO_BACKSPACE_KEY |
1717 | if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1]) |
1714 | if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1]) |
1718 | er = rs[Rs_backspace_key][0]; |
1715 | tio.c_cc[VERASE] = rs[Rs_backspace_key][0]; |
1719 | else if (strcmp (rs[Rs_backspace_key], "DEC") == 0) |
1716 | else if (strcmp (rs[Rs_backspace_key], "DEC") == 0) |
1720 | er = '\177'; /* the initial state anyway */ |
1717 | tio.c_cc[VERASE] = '\177'; /* the initial state anyway */ |
1721 | else |
|
|
1722 | #endif |
1718 | #endif |
1723 | er = -1; |
|
|
1724 | |
1719 | |
1725 | rxvt_get_ttymode (&tio, er); |
|
|
1726 | /* init terminal attributes */ |
1720 | /* init terminal attributes */ |
1727 | cfsetospeed (&tio, BAUDRATE); |
1721 | cfsetospeed (&tio, BAUDRATE); |
1728 | cfsetispeed (&tio, BAUDRATE); |
1722 | cfsetispeed (&tio, BAUDRATE); |
1729 | tcsetattr (pty->tty, TCSANOW, &tio); |
1723 | tcsetattr (pty->tty, TCSANOW, &tio); |
1730 | pty->set_utf8_mode (enc_utf8); |
1724 | pty->set_utf8_mode (enc_utf8); |
… | |
… | |
1817 | signal (SIGQUIT, SIG_DFL); |
1811 | signal (SIGQUIT, SIG_DFL); |
1818 | signal (SIGCHLD, SIG_DFL); |
1812 | signal (SIGCHLD, SIG_DFL); |
1819 | signal (SIGHUP, SIG_DFL); |
1813 | signal (SIGHUP, SIG_DFL); |
1820 | signal (SIGPIPE, SIG_DFL); |
1814 | signal (SIGPIPE, SIG_DFL); |
1821 | /* |
1815 | /* |
1822 | * mimick login's behavior by disabling the job control signals |
1816 | * mimic login's behavior by disabling the job control signals |
1823 | * a shell that wants them can turn them back on |
1817 | * a shell that wants them can turn them back on |
1824 | */ |
1818 | */ |
1825 | #ifdef SIGTSTP |
1819 | #ifdef SIGTSTP |
1826 | signal (SIGTSTP, SIG_IGN); |
1820 | signal (SIGTSTP, SIG_IGN); |
1827 | signal (SIGTTIN, SIG_IGN); |
1821 | signal (SIGTTIN, SIG_IGN); |