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.268 by root, Mon Jun 14 15:50:08 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
1579# endif 1559# endif
1580# if VTIME != VEOL 1560# if VTIME != VEOL
1581 tio->c_cc[VTIME] = 0; 1561 tio->c_cc[VTIME] = 0;
1582# endif 1562# endif
1583 1563
1584 if (erase != -1)
1585 tio->c_cc[VERASE] = (char)erase;
1586
1587 /* input modes */ 1564 /* input modes */
1588 tio->c_iflag = (BRKINT | IGNPAR | ICRNL 1565 tio->c_iflag = (BRKINT | IGNPAR | ICRNL
1589# ifdef IMAXBEL 1566# ifdef IMAXBEL
1590 | IMAXBEL 1567 | IMAXBEL
1591# endif 1568# endif
1612 fprintf (stderr, "Input flags\n"); 1589 fprintf (stderr, "Input flags\n");
1613 1590
1614 /* cpp token stringize doesn't work on all machines <sigh> */ 1591 /* cpp token stringize doesn't work on all machines <sigh> */
1615# define FOO(flag,name) \ 1592# define FOO(flag,name) \
1616 if ((tio->c_iflag) & flag) \ 1593 if ((tio->c_iflag) & flag) \
1617 fprintf (stderr, "%s ", name) 1594 fprintf (stderr, "%s ", name)
1618 1595
1619 /* c_iflag bits */ 1596 /* c_iflag bits */
1620 FOO (IGNBRK, "IGNBRK"); 1597 FOO (IGNBRK, "IGNBRK");
1621 FOO (BRKINT, "BRKINT"); 1598 FOO (BRKINT, "BRKINT");
1622 FOO (IGNPAR, "IGNPAR"); 1599 FOO (IGNPAR, "IGNPAR");
1709 else 1686 else
1710#endif 1687#endif
1711 if (!pty->get ()) 1688 if (!pty->get ())
1712 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); 1689 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n");
1713 1690
1714 int er; 1691 rxvt_get_ttymode (&tio);
1715 1692
1716#ifndef NO_BACKSPACE_KEY 1693#ifndef NO_BACKSPACE_KEY
1717 if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1]) 1694 if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1])
1718 er = rs[Rs_backspace_key][0]; 1695 tio.c_cc[VERASE] = rs[Rs_backspace_key][0];
1719 else if (strcmp (rs[Rs_backspace_key], "DEC") == 0) 1696 else if (strcmp (rs[Rs_backspace_key], "DEC") == 0)
1720 er = '\177'; /* the initial state anyway */ 1697 tio.c_cc[VERASE] = '\177'; /* the initial state anyway */
1721 else
1722#endif 1698#endif
1723 er = -1;
1724 1699
1725 rxvt_get_ttymode (&tio, er);
1726 /* init terminal attributes */ 1700 /* init terminal attributes */
1727 cfsetospeed (&tio, BAUDRATE); 1701 cfsetospeed (&tio, BAUDRATE);
1728 cfsetispeed (&tio, BAUDRATE); 1702 cfsetispeed (&tio, BAUDRATE);
1729 tcsetattr (pty->tty, TCSANOW, &tio); 1703 tcsetattr (pty->tty, TCSANOW, &tio);
1730 pty->set_utf8_mode (enc_utf8); 1704 pty->set_utf8_mode (enc_utf8);
1817 signal (SIGQUIT, SIG_DFL); 1791 signal (SIGQUIT, SIG_DFL);
1818 signal (SIGCHLD, SIG_DFL); 1792 signal (SIGCHLD, SIG_DFL);
1819 signal (SIGHUP, SIG_DFL); 1793 signal (SIGHUP, SIG_DFL);
1820 signal (SIGPIPE, SIG_DFL); 1794 signal (SIGPIPE, SIG_DFL);
1821 /* 1795 /*
1822 * mimick login's behavior by disabling the job control signals 1796 * mimic login's behavior by disabling the job control signals
1823 * a shell that wants them can turn them back on 1797 * a shell that wants them can turn them back on
1824 */ 1798 */
1825#ifdef SIGTSTP 1799#ifdef SIGTSTP
1826 signal (SIGTSTP, SIG_IGN); 1800 signal (SIGTSTP, SIG_IGN);
1827 signal (SIGTTIN, SIG_IGN); 1801 signal (SIGTTIN, SIG_IGN);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines