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.143 by root, Mon Jan 16 15:00:20 2006 UTC vs.
Revision 1.144 by root, Tue Jan 17 11:02:10 2006 UTC

1409#if ENABLE_FRILLS 1409#if ENABLE_FRILLS
1410 if (rs[Rs_pty_fd]) 1410 if (rs[Rs_pty_fd])
1411 return; 1411 return;
1412#endif 1412#endif
1413 1413
1414#ifndef __QNX__
1415 /* spin off the command interpreter */ 1414 /* spin off the command interpreter */
1416 switch (cmd_pid = fork ()) 1415 switch (cmd_pid = fork ())
1417 { 1416 {
1418 case -1: 1417 case -1:
1419 { 1418 {
1466 } 1465 }
1467 1466
1468 pty.close_tty (); /* keep STDERR_FILENO, pty.pty, display->fd () open */ 1467 pty.close_tty (); /* keep STDERR_FILENO, pty.pty, display->fd () open */
1469 break; 1468 break;
1470 } 1469 }
1471#else /* __QNX__ uses qnxspawn () */
1472 fchmod (pty.tty, 0622);
1473 fcntl (pty.tty, F_SETFD, FD_CLOEXEC);
1474 fcntl (pty.pty, F_SETFD, FD_CLOEXEC);
1475
1476 if (run_child (argv) == -1)
1477 exit (EXIT_FAILURE);
1478#endif
1479} 1470}
1480 1471
1481/* ------------------------------------------------------------------------- * 1472/* ------------------------------------------------------------------------- *
1482 * CHILD PROCESS OPERATIONS * 1473 * CHILD PROCESS OPERATIONS *
1483 * ------------------------------------------------------------------------- */ 1474 * ------------------------------------------------------------------------- */
1527 // unblock signals (signals are blocked by iom.C 1518 // unblock signals (signals are blocked by iom.C
1528 sigset_t ss; 1519 sigset_t ss;
1529 sigemptyset (&ss); 1520 sigemptyset (&ss);
1530 sigprocmask (SIG_SETMASK, &ss, 0); 1521 sigprocmask (SIG_SETMASK, &ss, 0);
1531 1522
1532#ifndef __QNX__
1533 /* command interpreter path */ 1523 /* command interpreter path */
1534 if (argv != NULL) 1524 if (argv != NULL)
1535 { 1525 {
1536# ifdef DEBUG_CMD 1526# ifdef DEBUG_CMD
1537 int i; 1527 int i;
1563 1553
1564 execlp (shell, argv0, NULL); 1554 execlp (shell, argv0, NULL);
1565 /* no error message: STDERR is closed! */ 1555 /* no error message: STDERR is closed! */
1566 } 1556 }
1567 1557
1568#else /* __QNX__ uses qnxspawn () */
1569
1570 char iov_a[10] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
1571 char *command = NULL, fullcommand[_MAX_PATH];
1572 char **arg_v, *arg_a[2] = { NULL, NULL };
1573
1574 if (argv != NULL)
1575 {
1576 if (access (argv[0], X_OK) == -1)
1577 {
1578 if (strchr (argv[0], '/') == NULL)
1579 {
1580 searchenv (argv[0], "PATH", fullcommand);
1581
1582 if (fullcommand[0] != '\0')
1583 command = fullcommand;
1584 }
1585
1586 if (access (command, X_OK) == -1)
1587 return -1;
1588 }
1589 else
1590 command = argv[0];
1591
1592 arg_v = argv;
1593 }
1594 else
1595 {
1596 if ((command = getenv ("SHELL")) == NULL || *command == '\0')
1597 command = "/bin/sh";
1598
1599 arg_a[0] = my_basename (command);
1600
1601 if (OPTION (Opt_loginShell))
1602 {
1603 login = rxvt_malloc ((strlen (arg_a[0]) + 2) * sizeof (char));
1604
1605 login[0] = '-';
1606 strcpy (&login[1], arg_a[0]);
1607 arg_a[0] = login;
1608 }
1609
1610 arg_v = arg_a;
1611 }
1612
1613 iov_a[0] = iov_a[1] = iov_a[2] = pty.tty;
1614 cmd_pid = qnx_spawn (0, 0, 0, -1, -1,
1615 _SPAWN_SETSID | _SPAWN_TCSETPGRP,
1616 command, arg_v, environ, iov_a, 0);
1617 if (login)
1618 free (login);
1619
1620 pty.close_tty ();
1621 return pty.pty;
1622#endif
1623
1624 return -1; 1558 return -1;
1625} 1559}
1626 1560
1627/*----------------------- end-of-file (C source) -----------------------*/ 1561/*----------------------- end-of-file (C source) -----------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines