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.266 by sf-exg, Mon Jun 14 15:40:03 2010 UTC vs.
Revision 1.273 by sf-exg, Mon Jul 26 22:07:38 2010 UTC

558 set_option (Opt_iso14755); 558 set_option (Opt_iso14755);
559 set_option (Opt_iso14755_52); 559 set_option (Opt_iso14755_52);
560 set_option (Opt_buffered); 560 set_option (Opt_buffered);
561} 561}
562 562
563static void
564init_secondary ()
565{
566 int i;
567
568 if ((i = open ("/dev/null", O_RDONLY)) < 0)
569 {
570 dup2 (STDERR_FILENO, STDIN_FILENO);
571 }
572 else if (i != STDIN_FILENO)
573 {
574 dup2 (i, STDIN_FILENO);
575 close (i);
576 }
577
578 dup2 (STDERR_FILENO, STDOUT_FILENO);
579}
580
581/*----------------------------------------------------------------------*/ 563/*----------------------------------------------------------------------*/
582const char ** 564const char **
583rxvt_term::init_resources (int argc, const char *const *argv) 565rxvt_term::init_resources (int argc, const char *const *argv)
584{ 566{
585 int i, r_argc; 567 int i, r_argc;
790 set_locale (""); 772 set_locale ("");
791 set_environ (envv); // a few things in X do not call setlocale :( 773 set_environ (envv); // a few things in X do not call setlocale :(
792 774
793 init_vars (); 775 init_vars ();
794 776
795 init_secondary ();
796
797 const char **cmd_argv = init_resources (argc, argv); 777 const char **cmd_argv = init_resources (argc, argv);
798 778
799#ifdef KEYSYM_RESOURCE 779#ifdef KEYSYM_RESOURCE
800 keyboard->register_done (); 780 keyboard->register_done ();
801#endif 781#endif
1527} 1507}
1528 1508
1529/* ------------------------------------------------------------------------- * 1509/* ------------------------------------------------------------------------- *
1530 * GET TTY CURRENT STATE * 1510 * GET TTY CURRENT STATE *
1531 * ------------------------------------------------------------------------- */ 1511 * ------------------------------------------------------------------------- */
1532void 1512static void
1533rxvt_get_ttymode (struct termios *tio, int erase) 1513rxvt_get_ttymode (struct termios *tio)
1534{ 1514{
1535 /* 1515 /*
1536 * standard System V termios interface 1516 * standard System V termios interface
1537 */ 1517 */
1538 // does not work as stdin is not a tty 1518 // does not work as stdin is not a tty
1540 if (1) 1520 if (1)
1541 { 1521 {
1542 // return error - use system defaults, 1522 // return error - use system defaults,
1543 // where possible, and zero elsewhere 1523 // where possible, and zero elsewhere
1544 memset (tio, 0, sizeof (struct termios)); 1524 memset (tio, 0, sizeof (struct termios));
1525 if (VDISABLE)
1526 for (int i = 0; i < NCCS; i++)
1527 tio->c_cc[i] = VDISABLE;
1545 1528
1546 tio->c_cc[VINTR] = CINTR; 1529 tio->c_cc[VINTR] = CINTR;
1547 tio->c_cc[VQUIT] = CQUIT; 1530 tio->c_cc[VQUIT] = CQUIT;
1548 tio->c_cc[VERASE] = CERASE; 1531 tio->c_cc[VERASE] = CERASE;
1549#ifdef VERASE2 1532#ifdef VERASE2
1569 tio->c_cc[VLNEXT] = CLNEXT; 1552 tio->c_cc[VLNEXT] = CLNEXT;
1570# endif 1553# endif
1571 } 1554 }
1572 1555
1573 tio->c_cc[VEOF] = CEOF; 1556 tio->c_cc[VEOF] = CEOF;
1574 tio->c_cc[VEOL] = VDISABLE;
1575# ifdef VEOL2
1576 tio->c_cc[VEOL2] = VDISABLE;
1577# endif
1578# ifdef VSWTC
1579 tio->c_cc[VSWTC] = VDISABLE;
1580# endif
1581# ifdef VSWTCH
1582 tio->c_cc[VSWTCH] = VDISABLE;
1583# endif
1584# if VMIN != VEOF 1557# if VMIN != VEOF
1585 tio->c_cc[VMIN] = 1; 1558 tio->c_cc[VMIN] = 1;
1586# endif 1559# endif
1587# if VTIME != VEOL 1560# if VTIME != VEOL
1588 tio->c_cc[VTIME] = 0; 1561 tio->c_cc[VTIME] = 0;
1589# endif 1562# endif
1590
1591 if (erase != -1)
1592 tio->c_cc[VERASE] = (char)erase;
1593 1563
1594 /* input modes */ 1564 /* input modes */
1595 tio->c_iflag = (BRKINT | IGNPAR | ICRNL 1565 tio->c_iflag = (BRKINT | IGNPAR | ICRNL
1596# ifdef IMAXBEL 1566# ifdef IMAXBEL
1597 | IMAXBEL 1567 | IMAXBEL
1619 fprintf (stderr, "Input flags\n"); 1589 fprintf (stderr, "Input flags\n");
1620 1590
1621 /* cpp token stringize doesn't work on all machines <sigh> */ 1591 /* cpp token stringize doesn't work on all machines <sigh> */
1622# define FOO(flag,name) \ 1592# define FOO(flag,name) \
1623 if ((tio->c_iflag) & flag) \ 1593 if ((tio->c_iflag) & flag) \
1624 fprintf (stderr, "%s ", name) 1594 fprintf (stderr, "%s ", name)
1625 1595
1626 /* c_iflag bits */ 1596 /* c_iflag bits */
1627 FOO (IGNBRK, "IGNBRK"); 1597 FOO (IGNBRK, "IGNBRK");
1628 FOO (BRKINT, "BRKINT"); 1598 FOO (BRKINT, "BRKINT");
1629 FOO (IGNPAR, "IGNPAR"); 1599 FOO (IGNPAR, "IGNPAR");
1716 else 1686 else
1717#endif 1687#endif
1718 if (!pty->get ()) 1688 if (!pty->get ())
1719 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); 1689 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n");
1720 1690
1721 int er; 1691 rxvt_get_ttymode (&tio);
1722 1692
1723#ifndef NO_BACKSPACE_KEY 1693#ifndef NO_BACKSPACE_KEY
1724 if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1]) 1694 if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1])
1725 er = rs[Rs_backspace_key][0]; 1695 tio.c_cc[VERASE] = rs[Rs_backspace_key][0];
1726 else if (strcmp (rs[Rs_backspace_key], "DEC") == 0) 1696 else if (strcmp (rs[Rs_backspace_key], "DEC") == 0)
1727 er = '\177'; /* the initial state anyway */ 1697 tio.c_cc[VERASE] = '\177'; /* the initial state anyway */
1728 else
1729#endif 1698#endif
1730 er = -1;
1731 1699
1732 rxvt_get_ttymode (&tio, er);
1733 /* init terminal attributes */ 1700 /* init terminal attributes */
1734 cfsetospeed (&tio, BAUDRATE); 1701 cfsetospeed (&tio, BAUDRATE);
1735 cfsetispeed (&tio, BAUDRATE); 1702 cfsetispeed (&tio, BAUDRATE);
1736 tcsetattr (pty->tty, TCSANOW, &tio); 1703 tcsetattr (pty->tty, TCSANOW, &tio);
1737 pty->set_utf8_mode (enc_utf8); 1704 pty->set_utf8_mode (enc_utf8);
1824 signal (SIGQUIT, SIG_DFL); 1791 signal (SIGQUIT, SIG_DFL);
1825 signal (SIGCHLD, SIG_DFL); 1792 signal (SIGCHLD, SIG_DFL);
1826 signal (SIGHUP, SIG_DFL); 1793 signal (SIGHUP, SIG_DFL);
1827 signal (SIGPIPE, SIG_DFL); 1794 signal (SIGPIPE, SIG_DFL);
1828 /* 1795 /*
1829 * mimick login's behavior by disabling the job control signals 1796 * mimic login's behavior by disabling the job control signals
1830 * a shell that wants them can turn them back on 1797 * a shell that wants them can turn them back on
1831 */ 1798 */
1832#ifdef SIGTSTP 1799#ifdef SIGTSTP
1833 signal (SIGTSTP, SIG_IGN); 1800 signal (SIGTSTP, SIG_IGN);
1834 signal (SIGTTIN, SIG_IGN); 1801 signal (SIGTTIN, SIG_IGN);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines