- strcpy (program, "( ");
- strcat (program, oprogram);
- strcat (program, " ) 2>&1");
-
- if (mine->pipe) abort();
-
-# ifdef HAVE_FORKPTY
- if (get_boolean_resource ("usePty", "Boolean"))
- {
- int fd;
- struct winsize ws;
-
- ws.ws_col = SCREEN_COLS;
- ws.ws_row = SCREEN_ROWS;
- ws.ws_xpixel = ws.ws_col * 6;
- ws.ws_ypixel = ws.ws_row * 8;
-
- mine->pipe = NULL;
- if((mine->pid = forkpty(&fd, NULL, NULL, &ws)) < 0)
- {
- /* Unable to fork */
- sprintf (buf, "%.100s: forkpty", progname);
- perror(buf);
- }
- else if(!mine->pid)
- {
- /* This is the child fork. */
- if (putenv("TERM=vt100"))
- abort();
- execl("/bin/sh", "/bin/sh", "-c", oprogram, NULL);
- sprintf (buf, "%.100s: %.100s", progname, oprogram);
- perror(buf);
- exit(1);
- }
- else
- {
- /* This is the parent fork. */
- mine->pipe = fdopen(fd, "r+");
- mine->pipe_id =
- XtAppAddInput (app, fileno (mine->pipe),
- (XtPointer) (XtInputReadMask | XtInputExceptMask),
- subproc_cb, (XtPointer) mine);
- }
- }
- else
-# endif /* HAVE_FORKPTY */
-
- if ((mine->pipe = popen (program, "r")))
- {
- if (mine->pipe_id) abort();
- mine->pipe_id =
- XtAppAddInput (app, fileno (mine->pipe),
- (XtPointer) (XtInputReadMask | XtInputExceptMask),
- subproc_cb, (XtPointer) mine);
- }
- else
- {
- sprintf (buf, "%.100s: %.100s", progname, program);
- perror(buf);
- }
-}
-
-static void
-relaunch_generator_timer (XtPointer closure, XtIntervalId *id)
-{
- struct terminal_controller_data *mine =
- (struct terminal_controller_data *) closure;
- mine->timeout_id=0;
- launch_text_generator (mine);
-}