- /* Make sure that our_ttystate (etc) are initialized. */
- gdb_has_a_terminal ();
-
- /* We could just as well copy our_ttystate (if we felt like adding
- a new function SERIAL_COPY_TTY_STATE). */
- if (inferior_ttystate)
- free (inferior_ttystate);
- inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
- SERIAL_SET_PROCESS_GROUP (stdin_serial, inferior_ttystate, inferior_pid);
-
- /* Make sure that next time we call terminal_inferior (which will be
- before the program runs, as it needs to be), we install the new
- process group. */
- terminal_is_ours = 1;
+ if (gdb_has_a_terminal ())
+ {
+ /* We could just as well copy our_ttystate (if we felt like adding
+ a new function SERIAL_COPY_TTY_STATE). */
+ if (inferior_ttystate)
+ xfree (inferior_ttystate);
+ inferior_ttystate = SERIAL_GET_TTY_STATE (stdin_serial);
+
+#ifdef PROCESS_GROUP_TYPE
+ inferior_process_group = pgrp;
+#endif
+
+ /* Make sure that next time we call terminal_inferior (which will be
+ before the program runs, as it needs to be), we install the new
+ process group. */
+ terminal_is_ours = 1;
+ }
+}
+
+void
+terminal_init_inferior (void)
+{
+#ifdef PROCESS_GROUP_TYPE
+ /* This is for Lynx, and should be cleaned up by having Lynx be a separate
+ debugging target with a version of target_terminal_init_inferior which
+ passes in the process group to a generic routine which does all the work
+ (and the non-threaded child_terminal_init_inferior can just pass in
+ inferior_pid to the same routine). */
+ /* We assume INFERIOR_PID is also the child's process group. */
+ terminal_init_inferior_with_pgrp (PIDGET (inferior_pid));
+#endif /* PROCESS_GROUP_TYPE */