… | |
… | |
1528 | |
1528 | |
1529 | /* ------------------------------------------------------------------------- * |
1529 | /* ------------------------------------------------------------------------- * |
1530 | * GET TTY CURRENT STATE * |
1530 | * GET TTY CURRENT STATE * |
1531 | * ------------------------------------------------------------------------- */ |
1531 | * ------------------------------------------------------------------------- */ |
1532 | void |
1532 | 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 |
… | |
… | |
1578 | tio->c_cc[VMIN] = 1; |
1578 | tio->c_cc[VMIN] = 1; |
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 | |
|
|
1584 | if (erase != -1) |
|
|
1585 | tio->c_cc[VERASE] = erase; |
|
|
1586 | |
1583 | |
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 |
… | |
… | |
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); |