AC_DEFINE(FIRST_PTY_LETTER, ['z'])
AC_DEFINE(PTY_NAME_SPRINTF, [strcpy (pty_name, "/dev/ptmx");])
dnl Push various streams modules onto a PTY channel. Used in process.c.
- AC_DEFINE(SETUP_SLAVE_PTY, [if (ioctl (xforkin, I_PUSH, "ptem") == -1) fatal ("ioctl I_PUSH ptem"); if (ioctl (xforkin, I_PUSH, "ldterm") == -1) fatal ("ioctl I_PUSH ldterm"); if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) fatal ("ioctl I_PUSH ttcompat");], [How to set up a slave PTY, if needed.])
+ AC_DEFINE(SETUP_SLAVE_PTY, [if (ioctl (forkin, I_PUSH, "ptem") == -1) fatal ("ioctl I_PUSH ptem"); if (ioctl (forkin, I_PUSH, "ldterm") == -1) fatal ("ioctl I_PUSH ldterm"); if (ioctl (forkin, I_PUSH, "ttcompat") == -1) fatal ("ioctl I_PUSH ttcompat");], [How to set up a slave PTY, if needed.])
;;
esac
#ifndef WINDOWSNT
/* vfork, and prevent local vars from being clobbered by the vfork. */
- {
- Lisp_Object volatile current_dir_volatile = current_dir;
- Lisp_Object volatile lisp_pty_name_volatile = lisp_pty_name;
- char **volatile new_argv_volatile = new_argv;
- int volatile forkin_volatile = forkin;
- int volatile forkout_volatile = forkout;
- int volatile forkerr_volatile = forkerr;
- struct Lisp_Process *p_volatile = p;
-
- pid = vfork ();
-
- current_dir = current_dir_volatile;
- lisp_pty_name = lisp_pty_name_volatile;
- new_argv = new_argv_volatile;
- forkin = forkin_volatile;
- forkout = forkout_volatile;
- forkerr = forkerr_volatile;
- p = p_volatile;
-
- pty_flag = p->pty_flag;
- }
+ Lisp_Object volatile current_dir_volatile = current_dir;
+ Lisp_Object volatile lisp_pty_name_volatile = lisp_pty_name;
+ char **volatile new_argv_volatile = new_argv;
+ int volatile forkin_volatile = forkin;
+ int volatile forkout_volatile = forkout;
+ int volatile forkerr_volatile = forkerr;
+ struct Lisp_Process *p_volatile = p;
+
+ pid = vfork ();
+
+ current_dir = current_dir_volatile;
+ lisp_pty_name = lisp_pty_name_volatile;
+ new_argv = new_argv_volatile;
+ forkin = forkin_volatile;
+ forkout = forkout_volatile;
+ forkerr = forkerr_volatile;
+ p = p_volatile;
+
+ pty_flag = p->pty_flag;
if (pid == 0)
#endif /* not WINDOWSNT */
{
- int xforkin = forkin;
- int xforkout = forkout;
- int xforkerr = forkerr;
-
/* Make the pty be the controlling terminal of the process. */
#ifdef HAVE_PTYS
/* First, disconnect its current controlling terminal. */
process_set_signal to fail on SGI when using a pipe. */
setsid ();
/* Make the pty's terminal the controlling terminal. */
- if (pty_flag && xforkin >= 0)
+ if (pty_flag && forkin >= 0)
{
#ifdef TIOCSCTTY
/* We ignore the return value
because faith@cs.unc.edu says that is necessary on Linux. */
- ioctl (xforkin, TIOCSCTTY, 0);
+ ioctl (forkin, TIOCSCTTY, 0);
#endif
}
#if defined (LDISC1)
- if (pty_flag && xforkin >= 0)
+ if (pty_flag && forkin >= 0)
{
struct termios t;
- tcgetattr (xforkin, &t);
+ tcgetattr (forkin, &t);
t.c_lflag = LDISC1;
- if (tcsetattr (xforkin, TCSANOW, &t) < 0)
+ if (tcsetattr (forkin, TCSANOW, &t) < 0)
emacs_perror ("create_process/tcsetattr LDISC1");
}
#else
#if defined (NTTYDISC) && defined (TIOCSETD)
- if (pty_flag && xforkin >= 0)
+ if (pty_flag && forkin >= 0)
{
/* Use new line discipline. */
int ldisc = NTTYDISC;
- ioctl (xforkin, TIOCSETD, &ldisc);
+ ioctl (forkin, TIOCSETD, &ldisc);
}
#endif
#endif
/* I wonder if emacs_close (emacs_open (SSDATA (lisp_pty_name), ...))
would work? */
- if (xforkin >= 0)
- emacs_close (xforkin);
- xforkout = xforkin = emacs_open (SSDATA (lisp_pty_name), O_RDWR, 0);
+ if (forkin >= 0)
+ emacs_close (forkin);
+ forkout = forkin = emacs_open (SSDATA (lisp_pty_name), O_RDWR, 0);
- if (xforkin < 0)
+ if (forkin < 0)
{
emacs_perror (SSDATA (lisp_pty_name));
_exit (EXIT_CANCELED);
unblock_child_signal (&oldset);
if (pty_flag)
- child_setup_tty (xforkout);
+ child_setup_tty (forkout);
- if (xforkerr < 0)
- xforkerr = xforkout;
+ if (forkerr < 0)
+ forkerr = forkout;
#ifdef WINDOWSNT
- pid = child_setup (xforkin, xforkout, xforkerr, new_argv, 1, current_dir);
+ pid = child_setup (forkin, forkout, forkerr, new_argv, 1, current_dir);
#else /* not WINDOWSNT */
- child_setup (xforkin, xforkout, xforkerr, new_argv, 1, current_dir);
+ child_setup (forkin, forkout, forkerr, new_argv, 1, current_dir);
#endif /* not WINDOWSNT */
}