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.307 by root, Sat Dec 17 23:17:33 2011 UTC vs.
Revision 1.311 by sf-exg, Thu Dec 22 14:34:59 2011 UTC

567 567
568/*----------------------------------------------------------------------*/ 568/*----------------------------------------------------------------------*/
569const char ** 569const char **
570rxvt_term::init_resources (int argc, const char *const *argv) 570rxvt_term::init_resources (int argc, const char *const *argv)
571{ 571{
572 int i, r_argc; 572 int i;
573 const char **cmd_argv; 573 const char **cmd_argv;
574
575 /*
576 * Look for -e option. Find => split and make cmd_argv[] of command args
577 */
578 for (r_argc = 0; r_argc < argc; r_argc++)
579 if (!strcmp (argv[r_argc], "-e"))
580 break;
581
582 if (r_argc == argc)
583 cmd_argv = NULL;
584 else if (!argv[r_argc + 1])
585 rxvt_fatal ("option '-e' requires an argument, aborting.\n");
586 else
587 cmd_argv = (const char **)argv + r_argc + 1;
588 574
589 rs[Rs_name] = rxvt_basename (argv[0]); 575 rs[Rs_name] = rxvt_basename (argv[0]);
590 576
591 /* 577 /*
592 * Open display, get options/resources and create the window 578 * Open display, get options/resources and create the window
593 */ 579 */
594 580
595 if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL) 581 if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL)
596 rs[Rs_display_name] = ":0"; 582 rs[Rs_display_name] = ":0";
597 583
598 get_options (r_argc, argv); 584 cmd_argv = get_options (argc, argv);
599 585
600 if (!(display = displays.get (rs[Rs_display_name]))) 586 if (!(display = displays.get (rs[Rs_display_name])))
601 rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); 587 rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]);
602 588
603 // using a local pointer decreases code size a lot 589 // using a local pointer decreases code size a lot
1621 if (pty->pty >= 0) 1607 if (pty->pty >= 0)
1622 { 1608 {
1623 if (getfd_hook) 1609 if (getfd_hook)
1624 pty->pty = (*getfd_hook) (pty->pty); 1610 pty->pty = (*getfd_hook) (pty->pty);
1625 1611
1626 if (pty->pty < 0 || fcntl (pty->pty, F_SETFL, O_NONBLOCK)) 1612 if (pty->pty < 0)
1627 rxvt_fatal ("unusable pty-fd filehandle, aborting.\n"); 1613 rxvt_fatal ("unusable pty-fd filehandle, aborting.\n");
1628 } 1614 }
1629 } 1615 }
1630 else 1616 else
1631#endif 1617#endif
1632 if (!pty->get ()) 1618 if (!pty->get ())
1633 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); 1619 rxvt_fatal ("can't initialize pseudo-tty, aborting.\n");
1620
1621 fcntl (pty->pty, F_SETFL, O_NONBLOCK);
1634 1622
1635 struct termios tio = def_tio; 1623 struct termios tio = def_tio;
1636 1624
1637#ifndef NO_BACKSPACE_KEY 1625#ifndef NO_BACKSPACE_KEY
1638 if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1]) 1626 if (rs[Rs_backspace_key][0] && !rs[Rs_backspace_key][1])
1688 1676
1689 _exit (EXIT_FAILURE); 1677 _exit (EXIT_FAILURE);
1690 1678
1691 default: 1679 default:
1692 if (!option (Opt_utmpInhibit)) 1680 if (!option (Opt_utmpInhibit))
1681 {
1682#ifdef LOG_ONLY_ON_LOGIN
1683 bool login_shell = option (Opt_loginShell);
1684#else
1685 bool login_shell = true;
1686#endif
1693 pty->login (cmd_pid, option (Opt_loginShell), rs[Rs_display_name]); 1687 pty->login (cmd_pid, login_shell, rs[Rs_display_name]);
1688 }
1694 1689
1695 pty->close_tty (); 1690 pty->close_tty ();
1696 1691
1697 child_ev.start (cmd_pid); 1692 child_ev.start (cmd_pid);
1698 1693
1723#elif defined (SRIOCSREDIR) 1718#elif defined (SRIOCSREDIR)
1724 int fd; 1719 int fd;
1725 1720
1726 fd = open (CONSOLE, O_WRONLY, 0); 1721 fd = open (CONSOLE, O_WRONLY, 0);
1727 if (fd >= 0) 1722 if (fd >= 0)
1723 {
1728 if (ioctl (fd, SRIOCSREDIR, NULL) < 0) 1724 ioctl (fd, SRIOCSREDIR, NULL);
1729 close (fd); 1725 close (fd);
1726 }
1730#endif /* SRIOCSREDIR */ 1727#endif /* SRIOCSREDIR */
1731 } 1728 }
1732 1729
1733 /* reset signals and spin off the command interpreter */ 1730 /* reset signals and spin off the command interpreter */
1734 signal (SIGINT, SIG_DFL); 1731 signal (SIGINT, SIG_DFL);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines