--- rxvt-unicode/src/init.C 2006/01/11 02:24:12 1.138 +++ rxvt-unicode/src/init.C 2006/01/25 21:03:04 1.156 @@ -176,56 +176,14 @@ #endif }; -const char *const xa_names[] = - { - "TEXT", - "COMPOUND_TEXT", - "UTF8_STRING", - "MULTIPLE", - "TARGETS", - "TIMESTAMP", - "VT_SELECTION", - "INCR", - "WM_PROTOCOLS", - "WM_DELETE_WINDOW", - "CLIPBOARD", -#if ENABLE_FRILLS - "_MOTIF_WM_HINTS", -#endif -#if ENABLE_EWMH - "_NET_WM_PID", - "_NET_WM_NAME", - "_NET_WM_ICON_NAME", - "_NET_WM_PING", -#endif -#if USE_XIM - "WM_LOCALE_NAME", -#endif -#ifdef TRANSPARENT - "_XROOTPMAP_ID", - "ESETROOT_PMAP_ID", -#endif -#ifdef OFFIX_DND - "DndProtocol", - "DndSelection", -#endif -#if ENABLE_XEMBED - "_XEMBED", - "_XEMBED_INFO", -#endif - }; - bool rxvt_term::init_vars () { - pix_colors_focused = new rxvt_color [TOTAL_COLORS]; + pix_colors = // + pix_colors_focused = new rxvt_color [TOTAL_COLORS]; #ifdef OFF_FOCUS_FADING pix_colors_unfocused = new rxvt_color [TOTAL_COLORS]; #endif - pix_colors = pix_colors_focused; - - if (pix_colors == NULL) - return false; #if defined(XPM_BACKGROUND) || defined(TRANSPARENT) pixmap = None; @@ -236,7 +194,6 @@ options = DEFAULT_OPTIONS; want_refresh = 1; priv_modes = SavedModes = PrivMode_Default; - focus = 0; ncol = 80; nrow = 24; int_bwidth = INTERNALBORDERWIDTH; @@ -247,7 +204,6 @@ refresh_limit = 1; refresh_type = SLOW_REFRESH; - prev_nrow = prev_ncol = 0; oldcursor.row = oldcursor.col = -1; #ifdef XPM_BACKGROUND @@ -258,13 +214,6 @@ last_bot = last_state = -1; -#ifdef MENUBAR - menu_readonly = 1; -# if ! (MENUBAR_MAX > 1) - CurrentBar = &BarList; -# endif /* (MENUBAR_MAX > 1) */ -#endif - return true; } @@ -341,21 +290,41 @@ /* * Open display, get options/resources and create the window */ - { - TEMP_ENV; - if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL) - rs[Rs_display_name] = ":0"; + if ((rs[Rs_display_name] = getenv ("DISPLAY")) == NULL) + rs[Rs_display_name] = ":0"; - get_options (r_argc, r_argv); + get_options (r_argc, r_argv); - if (!(display = displays.get (rs[Rs_display_name]))) - rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); - } + if (!(display = displays.get (rs[Rs_display_name]))) + rxvt_fatal ("can't open display %s, aborting.\n", rs[Rs_display_name]); extract_resources (); + free (r_argv); +#if ENABLE_PERL + if (!rs[Rs_perl_ext_1]) + rs[Rs_perl_ext_1] = "default"; + + if ((rs[Rs_perl_ext_1] && *rs[Rs_perl_ext_1]) + || (rs[Rs_perl_ext_2] && *rs[Rs_perl_ext_2]) + || (rs[Rs_perl_eval] && *rs[Rs_perl_eval])) + { + rxvt_perl.init (this); + HOOK_INVOKE ((this, HOOK_INIT, DT_END)); + } +#endif + + xa = display->xa; + +#if ENABLE_FRILLS + if (rs[Rs_depth]) + set (display, strtol (rs[Rs_depth], 0, 0)); + else +#endif + set (display); + /* * set any defaults not already set */ @@ -525,15 +494,7 @@ sprintf (env_display, "DISPLAY=%s", val); - /* avoiding the math library: - * i = (int) (ceil (log10 ((unsigned int)parent[0]))) */ - for (i = 0, u = (unsigned int)parent[0]; u; u /= 10, i++) - ; - max_it (i, 1); - env_windowid = (char *)rxvt_malloc ((i + 10) * sizeof (char)); - - sprintf (env_windowid, "WINDOWID=%u", - (unsigned int)parent[0]); + sprintf (env_windowid, "WINDOWID=%lu", (unsigned long)parent[0]); /* add entries to the environment: * @ DISPLAY: in case we started with -display @@ -545,6 +506,7 @@ */ putenv (env_display); putenv (env_windowid); + if (env_colorfgbg) putenv (env_colorfgbg); @@ -552,7 +514,7 @@ putenv ("TERMINFO=" RXVT_TERMINFO); #endif - if (display->depth <= 2) + if (depth <= 2) putenv ("COLORTERM=" COLORTERMENV "-mono"); else putenv ("COLORTERM=" COLORTERMENVFULL); @@ -582,7 +544,7 @@ void rxvt_term::set_locale (const char *locale) { - TEMP_ENV; + set_environ (envv); #if HAVE_XSETLOCALE || HAVE_SETLOCALE free (this->locale); @@ -623,7 +585,7 @@ void rxvt_term::init_xlocale () { - TEMP_ENV; + set_environ (envv); #ifdef USE_XIM if (!locale) @@ -674,18 +636,12 @@ #endif /* add value for scrollBar */ - if (scrollbar_visible ()) + if (scrollBar.state) { priv_modes |= PrivMode_scrollBar; SavedModes |= PrivMode_scrollBar; } - if (menubar_visible ()) - { - priv_modes |= PrivMode_menuBar; - SavedModes |= PrivMode_menuBar; - } - run_command (argv); } @@ -699,7 +655,7 @@ pix_colors = pix_colors_focused; #endif - for (i = 0; i < (display->depth <= 2 ? 2 : NRS_COLORS); i++) + for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) { rxvt_color xcol; @@ -749,11 +705,11 @@ #ifdef OFF_FOCUS_FADING if (rs[Rs_fade]) - for (i = 0; i < (display->depth <= 2 ? 2 : NRS_COLORS); i++) - pix_colors_unfocused[i] = pix_colors_focused[i].fade (display, atoi (rs[Rs_fade]), pix_colors[Color_fade]); + for (i = 0; i < (depth <= 2 ? 2 : NRS_COLORS); i++) + pix_colors_unfocused[i] = pix_colors_focused[i].fade (this, atoi (rs[Rs_fade]), pix_colors[Color_fade]); #endif - if (display->depth <= 2) + if (depth <= 2) { if (!rs[Rs_color + Color_pointer_fg]) pix_colors[Color_pointer_fg] = pix_colors[Color_fg]; if (!rs[Rs_color + Color_pointer_bg]) pix_colors[Color_pointer_bg] = pix_colors[Color_bg]; @@ -761,14 +717,14 @@ } /* - * get scrollBar/menuBar shadow colors + * get scrollBar shadow colors * * The calculations of topShadow/bottomShadow values are adapted * from the fvwm window manager. */ #ifdef KEEP_SCROLLCOLOR - if (display->depth <= 2) + if (depth <= 2) { /* Monochrome */ pix_colors[Color_scroll] = pix_colors[Color_fg]; @@ -783,17 +739,17 @@ * xcol[2] == bot shadow */ xcol[1] = pix_colors[Color_scroll]; - xcol[0].set (display, 65535, 65535, 65535); + xcol[0].set (this, 65535, 65535, 65535); unsigned short pr1, pg1, pb1, pr0, pg0, pb0; - xcol[0].get (display, pr0, pg0, pb0); - xcol[1].get (display, pr1, pg1, pb1); + xcol[0].get (this, pr0, pg0, pb0); + xcol[1].get (this, pr1, pg1, pb1); - pix_colors[Color_bottomShadow] = xcol[1].fade (display, 50); + pix_colors[Color_bottomShadow] = xcol[1].fade (this, 50); /* topShadowColor */ - if (!xcol[1].set (display, + if (!xcol[1].set (this, min (pr0, max (pr0 / 5, pr1) * 7 / 5), min (pg0, max (pg0 / 5, pg1) * 7 / 5), min (pb0, max (pb0 / 5, pb1) * 7 / 5))) @@ -922,41 +878,31 @@ XClassHint classHint; XWMHints wmHint; #if ENABLE_FRILLS - Atom prop = None; MWMHints mwmhints; #endif XGCValues gcvalue; - long vt_emask; XSetWindowAttributes attributes; - XWindowAttributes gattr; Window top, parent; - dDisp; -#ifdef USING_W11LIB - /* enable W11 callbacks */ - W11AddEventHandler (disp, rxvt_W11_process_x_event); -#endif + dLocal (Display *, xdisp); - assert (sizeof (xa_names) / sizeof (char *) == NUM_XA); - XInternAtoms (disp, (char **)xa_names, NUM_XA, False, xa); + /* grab colors before netscape does */ + Get_Colours (); - if (OPTION (Opt_transparent)) - { - XGetWindowAttributes (disp, RootWindow (disp, display->screen), &gattr); - display->depth = gattr.depth; // doh //TODO, per-term not per-display? - } + if (!set_fonts ()) + rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); + + parent = display->root; + + attributes.override_redirect = !!OPTION (Opt_override_redirect); #if ENABLE_FRILLS if (OPTION (Opt_borderLess)) { - prop = XInternAtom(disp, "_MOTIF_WM_INFO", True); - - if (prop == None) + if (XInternAtom (xdisp, "_MOTIF_WM_INFO", True) == None) { /* print_warning("Window Manager does not support MWM hints. Bypassing window manager control for borderless window.\n");*/ -#ifdef PREFER_24BIT attributes.override_redirect = TRUE; -#endif mwmhints.flags = 0; } else @@ -969,14 +915,6 @@ mwmhints.flags = 0; #endif - /* grab colors before netscape does */ - Get_Colours (); - - if (!set_fonts ()) - rxvt_fatal ("unable to load base fontset, please specify a valid one using -fn, aborting.\n"); - - parent = DefaultRootWindow (disp); - #if ENABLE_XEMBED if (rs[Rs_embed]) { @@ -984,7 +922,7 @@ parent = strtol (rs[Rs_embed], 0, 0); - if (!XGetWindowAttributes (disp, parent, &wattr)) + if (!XGetWindowAttributes (xdisp, parent, &wattr)) rxvt_fatal ("invalid window-id specified with -embed, aborting.\n"); window_calc (wattr.width, wattr.height); @@ -994,45 +932,43 @@ window_calc (0, 0); /* sub-window placement & size in rxvt_resize_subwindows () */ -#ifdef PREFER_24BIT - attributes.background_pixel = pix_colors_focused[Color_border]; - attributes.border_pixel = pix_colors_focused[Color_border]; - attributes.colormap = display->cmap; - top = XCreateWindow (disp, parent, + attributes.background_pixel = pix_colors_focused [Color_border]; + attributes.border_pixel = pix_colors_focused [Color_border]; + attributes.colormap = cmap; + + top = XCreateWindow (xdisp, parent, szHint.x, szHint.y, szHint.width, szHint.height, ext_bwidth, - display->depth, InputOutput, - display->visual, - CWColormap | CWBackPixel | CWBorderPixel, &attributes); -#else - top = XCreateSimpleWindow (disp, parent, - szHint.x, szHint.y, - szHint.width, szHint.height, - ext_bwidth, - pix_colors_focused[Color_border], - pix_colors_focused[Color_border]); -#endif + depth, InputOutput, visual, + CWColormap | CWBackPixel | CWBorderPixel | CWOverrideRedirect, + &attributes); this->parent[0] = top; old_width = szHint.width; old_height = szHint.height; - process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); + process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST); process_xterm_seq (XTerm_iconName, rs[Rs_iconName], CHAR_ST); - classHint.res_name = (char *)rs[Rs_name]; + classHint.res_name = (char *)rs[Rs_name]; classHint.res_class = (char *)RESCLASS; - wmHint.flags = InputHint | StateHint | WindowGroupHint; - wmHint.input = True; + wmHint.flags = InputHint | StateHint | WindowGroupHint; + wmHint.input = True; wmHint.initial_state = OPTION (Opt_iconic) ? IconicState : NormalState; - wmHint.window_group = top; + wmHint.window_group = top; - XmbSetWMProperties (disp, top, NULL, NULL, (char **)argv, argc, + XmbSetWMProperties (xdisp, top, NULL, NULL, (char **)argv, argc, &szHint, &wmHint, &classHint); +#if ENABLE_FRILLS + if (mwmhints.flags) + XChangeProperty (xdisp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, + PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); +#endif + Atom protocols[] = { xa[XA_WM_DELETE_WINDOW], #if ENABLE_EWMH @@ -1040,24 +976,24 @@ #endif }; - XSetWMProtocols (disp, top, protocols, sizeof (protocols) / sizeof (protocols[0])); + XSetWMProtocols (xdisp, top, protocols, sizeof (protocols) / sizeof (protocols[0])); #if ENABLE_FRILLS if (rs[Rs_transient_for]) - XSetTransientForHint (disp, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); + XSetTransientForHint (xdisp, top, (Window)strtol (rs[Rs_transient_for], 0, 0)); #endif #if ENABLE_EWMH long pid = getpid (); - XChangeProperty (disp, top, + XChangeProperty (xdisp, top, xa[XA_NET_WM_PID], XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&pid, 1); // _NET_WM_WINDOW_TYPE is NORMAL, which is the default #endif - XSelectInput (disp, top, + XSelectInput (xdisp, top, KeyPressMask #if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755 | KeyReleaseMask @@ -1067,79 +1003,39 @@ termwin_ev.start (display, top); -#if ENABLE_FRILLS - if (mwmhints.flags) - XChangeProperty (disp, top, xa[XA_MOTIF_WM_HINTS], xa[XA_MOTIF_WM_HINTS], 32, - PropModeReplace, (unsigned char *)&mwmhints, PROP_MWM_HINTS_ELEMENTS); -#endif - /* vt cursor: Black-on-White is standard, but this is more popular */ - TermWin_cursor = XCreateFontCursor (disp, XC_xterm); + TermWin_cursor = XCreateFontCursor (xdisp, XC_xterm); -#if defined(HAVE_SCROLLBARS) || defined(MENUBAR) - /* cursor (menuBar/scrollBar): Black-on-White */ - leftptr_cursor = XCreateFontCursor (disp, XC_left_ptr); +#ifdef HAVE_SCROLLBARS + /* cursor scrollBar: Black-on-White */ + leftptr_cursor = XCreateFontCursor (xdisp, XC_left_ptr); #endif /* the vt window */ - vt = XCreateSimpleWindow (disp, top, - window_vt_x, - window_vt_y, - width, - height, - 0, - pix_colors_focused[Color_fg], - pix_colors_focused[Color_bg]); -#ifdef DEBUG_X - XStoreName (disp, vt, "vt window"); -#endif + vt = XCreateSimpleWindow (xdisp, top, + window_vt_x, window_vt_y, + width, height, + 0, + pix_colors_focused[Color_fg], + pix_colors_focused[Color_bg]); attributes.bit_gravity = NorthWestGravity; - XChangeWindowAttributes (disp, vt, CWBitGravity, &attributes); + XChangeWindowAttributes (xdisp, vt, CWBitGravity, &attributes); vt_emask = ExposureMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask; - if (OPTION (Opt_pointerBlank) -#ifdef ENABLE_PERL - || perl.self -#endif - ) + if (OPTION (Opt_pointerBlank)) vt_emask |= PointerMotionMask; else vt_emask |= Button1MotionMask | Button3MotionMask; - XSelectInput (disp, vt, vt_emask); - vt_ev.start (display, vt); - -#if defined(MENUBAR) && (MENUBAR_MAX > 1) - if (menuBar_height ()) - { - menuBar.win = XCreateSimpleWindow (disp, top, - window_vt_x, 0, - width, - menuBar_TotalHeight (), - 0, - pix_colors_focused[Color_fg], - pix_colors_focused[Color_scroll]); - -#ifdef DEBUG_X - XStoreName (disp, menuBar.win, "menubar"); -#endif + vt_select_input (); - menuBar.drawable = new rxvt_drawable (display, menuBar.win); - - XDefineCursor (disp, menuBar.win, - XCreateFontCursor (disp, XC_left_ptr)); - - XSelectInput (disp, menuBar.win, - (ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask)); - menubar_ev.start (display, menuBar.win); - } -#endif + vt_ev.start (display, vt); #ifdef XPM_BACKGROUND if (rs[Rs_backgroundPixmap] != NULL - && ! OPTION (Opt_transparent)) + && !OPTION (Opt_transparent)) { const char *p = rs[Rs_backgroundPixmap]; @@ -1155,22 +1051,23 @@ #endif /* graphics context for the vt window */ - gcvalue.foreground = pix_colors[Color_fg]; - gcvalue.background = pix_colors[Color_bg]; + gcvalue.foreground = pix_colors[Color_fg]; + gcvalue.background = pix_colors[Color_bg]; gcvalue.graphics_exposures = 1; - gc = XCreateGC (disp, vt, - GCForeground | GCBackground | GCGraphicsExposures, - &gcvalue); - drawable = new rxvt_drawable (display, vt); + gc = XCreateGC (xdisp, vt, + GCForeground | GCBackground | GCGraphicsExposures, + &gcvalue); + + drawable = new rxvt_drawable (this, vt); -#if defined(MENUBAR) || defined(RXVT_SCROLLBAR) +#ifdef RXVT_SCROLLBAR gcvalue.foreground = pix_colors[Color_topShadow]; - topShadowGC = XCreateGC (disp, vt, GCForeground, &gcvalue); + topShadowGC = XCreateGC (xdisp, vt, GCForeground, &gcvalue); gcvalue.foreground = pix_colors[Color_bottomShadow]; - botShadowGC = XCreateGC (disp, vt, GCForeground, &gcvalue); - gcvalue.foreground = pix_colors[ (display->depth <= 2 ? Color_fg : Color_scroll)]; - scrollbarGC = XCreateGC (disp, vt, GCForeground, &gcvalue); + botShadowGC = XCreateGC (xdisp, vt, GCForeground, &gcvalue); + gcvalue.foreground = pix_colors[ (depth <= 2 ? Color_fg : Color_scroll)]; + scrollbarGC = XCreateGC (xdisp, vt, GCForeground, &gcvalue); #endif #ifdef OFF_FOCUS_FADING @@ -1181,16 +1078,6 @@ pointer_unblank (); scr_recolour (); - -#if ENABLE_XEMBED - if (rs[Rs_embed]) - { - long info[2] = { 0, XEMBED_MAPPED }; - - XChangeProperty (disp, parent, xa[XA_XEMBED_INFO], xa[XA_XEMBED_INFO], - 32, PropModeReplace, (unsigned char *)&info, 2); - } -#endif } /* ------------------------------------------------------------------------- * @@ -1414,28 +1301,26 @@ void rxvt_term::run_command (const char *const *argv) { - TEMP_ENV; // not very temporary... - #if ENABLE_FRILLS if (rs[Rs_pty_fd]) { - pty.pty = atoi (rs[Rs_pty_fd]); + pty->pty = atoi (rs[Rs_pty_fd]); - if (pty.pty >= 0) + if (pty->pty >= 0) { if (getfd_hook) - pty.pty = (*getfd_hook) (pty.pty); + pty->pty = (*getfd_hook) (pty->pty); - if (pty.pty < 0 || fcntl (pty.pty, F_SETFL, O_NONBLOCK)) + if (pty->pty < 0 || fcntl (pty->pty, F_SETFL, O_NONBLOCK)) rxvt_fatal ("unusable pty-fd filehandle, aborting.\n"); } } else #endif - if (!pty.get ()) + if (!pty->get ()) rxvt_fatal ("can't initialize pseudo-tty, aborting.\n"); - pty.set_utf8_mode (enc_utf8); + pty->set_utf8_mode (enc_utf8); /* set initial window size */ tt_winch (); @@ -1458,7 +1343,6 @@ return; #endif -#ifndef __QNX__ /* spin off the command interpreter */ switch (cmd_pid = fork ()) { @@ -1470,20 +1354,20 @@ case 0: init_env (); - if (!pty.make_controlling_tty ()) + if (!pty->make_controlling_tty ()) fprintf (stderr, "%s: could not obtain control of tty.", RESNAME); else { /* Reopen stdin, stdout and stderr over the tty file descriptor */ - dup2 (pty.tty, STDIN_FILENO); - dup2 (pty.tty, STDOUT_FILENO); - dup2 (pty.tty, STDERR_FILENO); + dup2 (pty->tty, STDIN_FILENO); + dup2 (pty->tty, STDOUT_FILENO); + dup2 (pty->tty, STDERR_FILENO); // close all our file handles that we do no longer need for (rxvt_term **t = termlist.begin (); t < termlist.end (); t++) { - if ((*t)->pty.pty > 2) close ((*t)->pty.pty); - if ((*t)->pty.tty > 2) close ((*t)->pty.tty); + if ((*t)->pty->pty > 2) close ((*t)->pty->pty); + if ((*t)->pty->tty > 2) close ((*t)->pty->tty); } run_child (argv); @@ -1493,36 +1377,16 @@ _exit (EXIT_FAILURE); default: - { -#if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) - int fdstdin; + if (!OPTION (Opt_utmpInhibit)) + pty->login (cmd_pid, OPTION (Opt_loginShell), rs[Rs_display_name]); - fdstdin = dup (STDIN_FILENO); - dup2 (pty.tty, STDIN_FILENO); -#endif - -#ifdef UTMP_SUPPORT - privileged_utmp (SAVE); -#endif + pty->close_tty (); -#if defined(HAVE_STRUCT_UTMP) && defined(HAVE_TTYSLOT) + child_ev.start (cmd_pid); - dup2 (fdstdin, STDIN_FILENO); - close (fdstdin); -#endif - } - - pty.close_tty (); /* keep STDERR_FILENO, pty.pty, display->fd () open */ + HOOK_INVOKE ((this, HOOK_CHILD_START, DT_INT, cmd_pid, DT_END)); break; } -#else /* __QNX__ uses qnxspawn () */ - fchmod (pty.tty, 0622); - fcntl (pty.tty, F_SETFD, FD_CLOEXEC); - fcntl (pty.pty, F_SETFD, FD_CLOEXEC); - - if (run_child (argv) == -1) - exit (EXIT_FAILURE); -#endif } /* ------------------------------------------------------------------------- * @@ -1576,7 +1440,6 @@ sigemptyset (&ss); sigprocmask (SIG_SETMASK, &ss, 0); -#ifndef __QNX__ /* command interpreter path */ if (argv != NULL) { @@ -1612,62 +1475,6 @@ /* no error message: STDERR is closed! */ } -#else /* __QNX__ uses qnxspawn () */ - - char iov_a[10] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; - char *command = NULL, fullcommand[_MAX_PATH]; - char **arg_v, *arg_a[2] = { NULL, NULL }; - - if (argv != NULL) - { - if (access (argv[0], X_OK) == -1) - { - if (strchr (argv[0], '/') == NULL) - { - searchenv (argv[0], "PATH", fullcommand); - - if (fullcommand[0] != '\0') - command = fullcommand; - } - - if (access (command, X_OK) == -1) - return -1; - } - else - command = argv[0]; - - arg_v = argv; - } - else - { - if ((command = getenv ("SHELL")) == NULL || *command == '\0') - command = "/bin/sh"; - - arg_a[0] = my_basename (command); - - if (OPTION (Opt_loginShell)) - { - login = rxvt_malloc ((strlen (arg_a[0]) + 2) * sizeof (char)); - - login[0] = '-'; - strcpy (&login[1], arg_a[0]); - arg_a[0] = login; - } - - arg_v = arg_a; - } - - iov_a[0] = iov_a[1] = iov_a[2] = pty.tty; - cmd_pid = qnx_spawn (0, 0, 0, -1, -1, - _SPAWN_SETSID | _SPAWN_TCSETPGRP, - command, arg_v, environ, iov_a, 0); - if (login) - free (login); - - pty.close_tty (); - return pty.pty; -#endif - return -1; }