ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/init.C
(Generate patch)

Comparing rxvt-unicode/src/init.C (file contents):
Revision 1.273 by sf-exg, Mon Jul 26 22:07:38 2010 UTC vs.
Revision 1.274 by sf-exg, Wed Jul 28 17:56:16 2010 UTC

1504 1504
1505 pointer_unblank (); 1505 pointer_unblank ();
1506 scr_recolour (); 1506 scr_recolour ();
1507} 1507}
1508 1508
1509/* ------------------------------------------------------------------------- *
1510 * GET TTY CURRENT STATE *
1511 * ------------------------------------------------------------------------- */
1512static void
1513rxvt_get_ttymode (struct termios *tio)
1514{
1515 /*
1516 * standard System V termios interface
1517 */
1518 // does not work as stdin is not a tty
1519 // if (tcgetattr (STDIN_FILENO, tio) < 0)
1520 if (1)
1521 {
1522 // return error - use system defaults,
1523 // where possible, and zero elsewhere
1524 memset (tio, 0, sizeof (struct termios));
1525 if (VDISABLE)
1526 for (int i = 0; i < NCCS; i++)
1527 tio->c_cc[i] = VDISABLE;
1528
1529 tio->c_cc[VINTR] = CINTR;
1530 tio->c_cc[VQUIT] = CQUIT;
1531 tio->c_cc[VERASE] = CERASE;
1532#ifdef VERASE2
1533 tio->c_cc[VERASE2] = CERASE2;
1534#endif
1535 tio->c_cc[VKILL] = CKILL;
1536 tio->c_cc[VSTART] = CSTART;
1537 tio->c_cc[VSTOP] = CSTOP;
1538 tio->c_cc[VSUSP] = CSUSP;
1539# ifdef VDSUSP
1540 tio->c_cc[VDSUSP] = CDSUSP;
1541# endif
1542# ifdef VREPRINT
1543 tio->c_cc[VREPRINT] = CRPRNT;
1544# endif
1545# ifdef VDISCRD
1546 tio->c_cc[VDISCRD] = CFLUSH;
1547# endif
1548# ifdef VWERSE
1549 tio->c_cc[VWERSE] = CWERASE;
1550# endif
1551# ifdef VLNEXT
1552 tio->c_cc[VLNEXT] = CLNEXT;
1553# endif
1554 }
1555
1556 tio->c_cc[VEOF] = CEOF;
1557# if VMIN != VEOF
1558 tio->c_cc[VMIN] = 1;
1559# endif
1560# if VTIME != VEOL
1561 tio->c_cc[VTIME] = 0;
1562# endif
1563
1564 /* input modes */
1565 tio->c_iflag = (BRKINT | IGNPAR | ICRNL
1566# ifdef IMAXBEL
1567 | IMAXBEL
1568# endif
1569 | IXON);
1570
1571 /* output modes */
1572 tio->c_oflag = (OPOST | ONLCR);
1573
1574 /* control modes */
1575 tio->c_cflag = (CS8 | CREAD);
1576
1577 /* line discipline modes */
1578 tio->c_lflag = (ISIG | ICANON | IEXTEN | ECHO
1579# if defined (ECHOCTL) && defined (ECHOKE)
1580 | ECHOCTL | ECHOKE
1581# endif
1582 | ECHOE | ECHOK);
1583
1584 /*
1585 * Debugging
1586 */
1587#ifdef DEBUG_TTYMODE
1588 /* c_iflag bits */
1589 fprintf (stderr, "Input flags\n");
1590
1591 /* cpp token stringize doesn't work on all machines <sigh> */
1592# define FOO(flag,name) \
1593 if ((tio->c_iflag) & flag) \
1594 fprintf (stderr, "%s ", name)
1595
1596 /* c_iflag bits */
1597 FOO (IGNBRK, "IGNBRK");
1598 FOO (BRKINT, "BRKINT");
1599 FOO (IGNPAR, "IGNPAR");
1600 FOO (PARMRK, "PARMRK");
1601 FOO (INPCK, "INPCK");
1602 FOO (ISTRIP, "ISTRIP");
1603 FOO (INLCR, "INLCR");
1604 FOO (IGNCR, "IGNCR");
1605 FOO (ICRNL, "ICRNL");
1606 FOO (IXON, "IXON");
1607 FOO (IXOFF, "IXOFF");
1608# ifdef IUCLC
1609 FOO (IUCLC, "IUCLC");
1610# endif
1611# ifdef IXANY
1612 FOO (IXANY, "IXANY");
1613# endif
1614# ifdef IMAXBEL
1615 FOO (IMAXBEL, "IMAXBEL");
1616# endif
1617
1618 fprintf (stderr, "\n");
1619
1620# undef FOO
1621# define FOO(entry, name) \
1622 fprintf (stderr, "%-8s = %#04o\n", name, tio->c_cc [entry])
1623
1624 FOO (VINTR, "VINTR");
1625 FOO (VQUIT, "VQUIT");
1626 FOO (VERASE, "VERASE");
1627 FOO (VKILL, "VKILL");
1628 FOO (VEOF, "VEOF");
1629 FOO (VEOL, "VEOL");
1630# ifdef VEOL2
1631 FOO (VEOL2, "VEOL2");
1632# endif
1633# ifdef VSWTC
1634 FOO (VSWTC, "VSWTC");
1635# endif
1636# ifdef VSWTCH
1637 FOO (VSWTCH, "VSWTCH");
1638# endif
1639 FOO (VSTART, "VSTART");
1640 FOO (VSTOP, "VSTOP");
1641 FOO (VSUSP, "VSUSP");
1642# ifdef VDSUSP
1643 FOO (VDSUSP, "VDSUSP");
1644# endif
1645# ifdef VREPRINT
1646 FOO (VREPRINT, "VREPRINT");
1647# endif
1648# ifdef VDISCRD
1649 FOO (VDISCRD, "VDISCRD");
1650# endif
1651# ifdef VWERSE
1652 FOO (VWERSE, "VWERSE");
1653# endif
1654# ifdef VLNEXT
1655 FOO (VLNEXT, "VLNEXT");
1656# endif
1657
1658 fprintf (stderr, "\n");
1659# undef FOO
1660#endif /* DEBUG_TTYMODE */
1661}
1662
1663/*----------------------------------------------------------------------*/ 1509/*----------------------------------------------------------------------*/
1664/* 1510/*
1665 * Run the command in a subprocess and return a file descriptor for the 1511 * Run the command in a subprocess and return a file descriptor for the
1666 * master end of the pseudo-teletype pair with the command talking to 1512 * master end of the pseudo-teletype pair with the command talking to
1667 * the slave. 1513 * the slave.
1686 else 1532 else
1687#endif 1533#endif
1688 if (!pty->get ()) 1534 if (!pty->get ())
1689 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); 1535 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n");
1690 1536
1691 rxvt_get_ttymode (&tio); 1537 struct termios tio = def_tio;
1692 1538
1693#ifndef NO_BACKSPACE_KEY 1539#ifndef NO_BACKSPACE_KEY
1694 if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1]) 1540 if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1])
1695 tio.c_cc[VERASE] = rs[Rs_backspace_key][0]; 1541 tio.c_cc[VERASE] = rs[Rs_backspace_key][0];
1696 else if (strcmp (rs[Rs_backspace_key], "DEC") == 0) 1542 else if (strcmp (rs[Rs_backspace_key], "DEC") == 0)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines