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.308 by sf-exg, Sun Dec 18 02:14:59 2011 UTC vs.
Revision 1.318 by sf-exg, Fri Jan 13 13:04:59 2012 UTC

852 852
853#if ENABLE_PERL 853#if ENABLE_PERL
854 rootwin_ev.start (display, display->root); 854 rootwin_ev.start (display, display->root);
855#endif 855#endif
856 856
857 set_colorfgbg (); 857 init_done = 1;
858 858
859 init_command (cmd_argv); 859 init_command (cmd_argv);
860 860
861 if (pty->pty >= 0) 861 if (pty->pty >= 0)
862 pty_ev.start (pty->pty, ev::READ); 862 pty_ev.start (pty->pty, ev::READ);
906/*----------------------------------------------------------------------*/ 906/*----------------------------------------------------------------------*/
907void 907void
908rxvt_term::init_env () 908rxvt_term::init_env ()
909{ 909{
910 char *val; 910 char *val;
911 char *env_display;
912 char *env_windowid;
913 char *env_colorfgbg;
914 char *env_term;
911 915
912#ifdef DISPLAY_IS_IP 916#ifdef DISPLAY_IS_IP
913 /* Fixup display_name for export over pty to any interested terminal 917 /* Fixup display_name for export over pty to any interested terminal
914 * clients via "ESC[7n" (e.g. shells). Note we use the pure IP number 918 * clients via "ESC[7n" (e.g. shells). Note we use the pure IP number
915 * (for the first non-loopback interface) that we get from 919 * (for the first non-loopback interface) that we get from
932 936
933 env_display = (char *)rxvt_malloc (strlen (val) + 9); 937 env_display = (char *)rxvt_malloc (strlen (val) + 9);
934 938
935 sprintf (env_display, "DISPLAY=%s", val); 939 sprintf (env_display, "DISPLAY=%s", val);
936 940
941 env_windowid = (char *)rxvt_malloc (21);
937 sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent); 942 sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent);
938 943
939 /* add entries to the environment: 944 /* add entries to the environment:
940 * @ DISPLAY: in case we started with -display 945 * @ DISPLAY: in case we started with -display
941 * @ WINDOWID: X window id number of the window 946 * @ WINDOWID: X window id number of the window
945 * @ COLORFGBG: fg;bg color codes 950 * @ COLORFGBG: fg;bg color codes
946 */ 951 */
947 putenv (env_display); 952 putenv (env_display);
948 putenv (env_windowid); 953 putenv (env_windowid);
949 954
950 if (env_colorfgbg) 955 env_colorfgbg = get_colorfgbg ();
951 putenv (env_colorfgbg); 956 putenv (env_colorfgbg);
952 957
953#ifdef RXVT_TERMINFO 958#ifdef RXVT_TERMINFO
954 putenv ("TERMINFO=" RXVT_TERMINFO); 959 putenv ("TERMINFO=" RXVT_TERMINFO);
955#endif 960#endif
956 961
1188/*----------------------------------------------------------------------*/ 1193/*----------------------------------------------------------------------*/
1189/* color aliases, fg/bg bright-bold */ 1194/* color aliases, fg/bg bright-bold */
1190void 1195void
1191rxvt_term::color_aliases (int idx) 1196rxvt_term::color_aliases (int idx)
1192{ 1197{
1193 if (rs[Rs_color + idx] && isdigit (* (rs[Rs_color + idx]))) 1198 if (rs[Rs_color + idx] && isdigit (*rs[Rs_color + idx]))
1194 { 1199 {
1195 int i = atoi (rs[Rs_color + idx]); 1200 int i = atoi (rs[Rs_color + idx]);
1196 1201
1197 if (i >= 8 && i <= 15) 1202 if (i >= 8 && i <= 15)
1198 /* bright colors */ 1203 /* bright colors */
1474 CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect, 1479 CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect,
1475 &attributes); 1480 &attributes);
1476 1481
1477 this->parent = top; 1482 this->parent = top;
1478 1483
1479 old_width = szHint.width;
1480 old_height = szHint.height;
1481
1482 set_title (rs [Rs_title]); 1484 set_title (rs [Rs_title]);
1483 set_icon_name (rs [Rs_iconName]); 1485 set_icon_name (rs [Rs_iconName]);
1484 1486
1485 classHint.res_name = (char *)rs[Rs_name]; 1487 classHint.res_name = (char *)rs[Rs_name];
1486 classHint.res_class = (char *)RESCLASS; 1488 classHint.res_class = (char *)RESCLASS;
1548 TermWin_cursor = XCreateFontCursor (dpy, XC_xterm); 1550 TermWin_cursor = XCreateFontCursor (dpy, XC_xterm);
1549 1551
1550 /* the vt window */ 1552 /* the vt window */
1551 vt = XCreateSimpleWindow (dpy, top, 1553 vt = XCreateSimpleWindow (dpy, top,
1552 window_vt_x, window_vt_y, 1554 window_vt_x, window_vt_y,
1553 width, height, 1555 vt_width, vt_height,
1554 0, 1556 0,
1555 pix_colors_focused[Color_fg], 1557 pix_colors_focused[Color_fg],
1556 pix_colors_focused[Color_bg]); 1558 pix_colors_focused[Color_bg]);
1557 1559
1558 attributes.bit_gravity = NorthWestGravity; 1560 attributes.bit_gravity = NorthWestGravity;
1607 if (pty->pty >= 0) 1609 if (pty->pty >= 0)
1608 { 1610 {
1609 if (getfd_hook) 1611 if (getfd_hook)
1610 pty->pty = (*getfd_hook) (pty->pty); 1612 pty->pty = (*getfd_hook) (pty->pty);
1611 1613
1612 if (pty->pty < 0 || fcntl (pty->pty, F_SETFL, O_NONBLOCK)) 1614 if (pty->pty < 0)
1613 rxvt_fatal ("unusable pty-fd filehandle, aborting.\n"); 1615 rxvt_fatal ("unusable pty-fd filehandle, aborting.\n");
1614 } 1616 }
1615 } 1617 }
1616 else 1618 else
1617#endif 1619#endif
1618 if (!pty->get ()) 1620 if (!pty->get ())
1619 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); 1621 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n");
1622
1623 fcntl (pty->pty, F_SETFL, O_NONBLOCK);
1620 1624
1621 struct termios tio = def_tio; 1625 struct termios tio = def_tio;
1622 1626
1623#ifndef NO_BACKSPACE_KEY 1627#ifndef NO_BACKSPACE_KEY
1624 if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1]) 1628 if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1])
1674 1678
1675 _exit (EXIT_FAILURE); 1679 _exit (EXIT_FAILURE);
1676 1680
1677 default: 1681 default:
1678 if (!option (Opt_utmpInhibit)) 1682 if (!option (Opt_utmpInhibit))
1683 {
1684#ifdef LOG_ONLY_ON_LOGIN
1685 bool login_shell = option (Opt_loginShell);
1686#else
1687 bool login_shell = true;
1688#endif
1679 pty->login (cmd_pid, option (Opt_loginShell), rs[Rs_display_name]); 1689 pty->login (cmd_pid, login_shell, rs[Rs_display_name]);
1690 }
1680 1691
1681 pty->close_tty (); 1692 pty->close_tty ();
1682 1693
1683 child_ev.start (cmd_pid); 1694 child_ev.start (cmd_pid);
1684 1695
1709#elif defined (SRIOCSREDIR) 1720#elif defined (SRIOCSREDIR)
1710 int fd; 1721 int fd;
1711 1722
1712 fd = open (CONSOLE, O_WRONLY, 0); 1723 fd = open (CONSOLE, O_WRONLY, 0);
1713 if (fd >= 0) 1724 if (fd >= 0)
1714 if (ioctl (fd, SRIOCSREDIR, NULL) < 0) 1725 {
1726 ioctl (fd, SRIOCSREDIR, STDIN_FILENO);
1715 close (fd); 1727 close (fd);
1728 }
1716#endif /* SRIOCSREDIR */ 1729#endif /* SRIOCSREDIR */
1717 } 1730 }
1718 1731
1719 /* reset signals and spin off the command interpreter */ 1732 /* reset signals and spin off the command interpreter */
1720 signal (SIGINT, SIG_DFL); 1733 signal (SIGINT, SIG_DFL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines