* configure.ac (FIRST_PTY_LETTER PTY_ITERATION): Move here from src/s.
* src/s/aix4-2.h, src/s/bsd-common.h, src/s/cygwin.h, src/s/darwin.h:
* src/s/gnu-linux.h, src/s/hpux10-20.h, src/s/irix6-5.h, src/s/template.h:
* src/s/usg5-4-common.h: Move FIRST_PTY_LETTER, PTY_ITERATION to configure.
* configure.ac (NARROWPROTO, NO_ABORT, BROKEN_GET_CURRENT_DIR_NAME)
(BROKEN_FIONREAD, BROKEN_PTY_READ_AFTER_EAGAIN, BROKEN_SIGAIO)
- (BROKEN_SIGPOLL, BROKEN_SIGPTY, G_SLICE_ALWAYS_MALLOC, PREFER_VSUSP)
+ (BROKEN_SIGPOLL, BROKEN_SIGPTY, FIRST_PTY_LETTER)
+ (G_SLICE_ALWAYS_MALLOC, PREFER_VSUSP, PTY_ITERATION)
(RUN_TIME_REMAP, SETPGRP_RELEASES_CTTY, TAB3, TABDLY, RUN_TIME_REMAP
(XOS_NEEDS_TIME_H): Move here from src/s.
esac
+dnl Used in process.c, this must be a loop, even if it only runs once.
+dnl (Except on SGI; see below. Take that, clarity and consistency!)
+AH_TEMPLATE(PTY_ITERATION, [How to iterate over PTYs.])
+dnl Only used if !PTY_ITERATION. Iterate from FIRST_PTY_LETTER to z,
+dnl trying suffixes 0-16.
+AH_TEMPLATE(FIRST_PTY_LETTER, [Letter to use in finding device name of
+ first PTY, if PTYs are supported.])
+
+case $opsys in
+ aix4-2 )
+ AC_DEFINE(PTY_ITERATION, [int c; for (c = 0; !c ; c++)] )
+ ;;
+
+ cygwin )
+ AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)] )
+ ;;
+
+ darwin )
+ AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)] )
+ dnl Not used, because PTY_ITERATION is defined.
+ AC_DEFINE(FIRST_PTY_LETTER, ['p'])
+ ;;
+
+ gnu | hpux* | freebsd | netbsd | openbsd )
+ AC_DEFINE(FIRST_PTY_LETTER, ['p'])
+ ;;
+
+ gnu-linux | gnu-kfreebsd )
+ dnl if HAVE_GRANTPT
+ if test "x$ac_cv_func_grantpt" = xyes; then
+ AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)] )
+ else
+ AC_DEFINE(FIRST_PTY_LETTER, ['p'])
+ fi
+ ;;
+
+ irix6-5 )
+ dnl It looks like this cannot be right, because it is not a loop.
+ dnl However, process.c actually does this:
+ dnl # ifndef __sgi
+ dnl continue;
+ dnl # else
+ dnl return -1;
+ dnl # endif
+ dnl which presumably makes it OK, since irix == sgi (?).
+ dnl FIXME it seems like this special treatment is unnecessary?
+ dnl Why can't irix use a single-trip loop like eg cygwin?
+ AC_DEFINE(PTY_ITERATION, [])
+ dnl Not used, because PTY_ITERATION is defined.
+ AC_DEFINE(FIRST_PTY_LETTER, ['q'])
+ ;;
+
+ sol2* | unixware )
+ dnl This change means that we don't loop through allocate_pty too
+ dnl many times in the (rare) event of a failure.
+ AC_DEFINE(FIRST_PTY_LETTER, ['z'])
+ ;;
+esac
+
+
AH_TEMPLATE(SIGNALS_VIA_CHARACTERS, [Make process_send_signal work by
"typing" a signal character on the pty.])
+2012-07-12 Glenn Morris <rgm@gnu.org>
+
+ * s/aix4-2.h, s/bsd-common.h, s/cygwin.h, s/darwin.h:
+ * s/gnu-linux.h, s/hpux10-20.h, s/irix6-5.h, s/template.h:
+ * s/usg5-4-common.h: Move FIRST_PTY_LETTER, PTY_ITERATION to configure.
+
2012-07-12 Dmitry Antipov <dmantipov@yandex.ru>
Use empty_unibyte_string where applicable.
/* In AIX, you allocate a pty by opening /dev/ptc to get the master side.
To get the name of the slave side, you just ttyname() the master side. */
-#define PTY_ITERATION int c; for (c = 0; !c ; c++)
#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptc");
#define PTY_TTY_NAME_SPRINTF strcpy (pty_name, ttyname (fd));
/* For mem-limits.h. */
#define BSD4_2
-
-/* First pty name is /dev/ptyp0. */
-#define FIRST_PTY_LETTER 'p'
You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
-#define PTY_ITERATION int i; for (i = 0; i < 1; i++) /* ick */
#define PTY_NAME_SPRINTF /* none */
#define PTY_TTY_NAME_SPRINTF /* none */
#define PTY_OPEN \
distinguish OS X from pure Darwin. */
#define DARWIN_OS
-/* Letter to use in finding device name of first pty,
- if system supports pty's. 'a' means it is /dev/ptya0 */
-#define FIRST_PTY_LETTER 'p'
-
-/* Run only once. We need a `for'-loop because the code uses `continue'. */
-#define PTY_ITERATION int i; for (i = 0; i < 1; i++)
#define PTY_NAME_SPRINTF /* none */
#define PTY_TTY_NAME_SPRINTF /* none */
/* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
#if defined HAVE_GRANTPT
#define UNIX98_PTYS
-/* Run only once. We need a `for'-loop because the code uses `continue'. */
-#define PTY_ITERATION int i; for (i = 0; i < 1; i++)
-
#ifdef HAVE_GETPT
#define PTY_NAME_SPRINTF
#define PTY_OPEN fd = getpt ()
sigunblock (sigmask (SIGCHLD)); \
}
-#else /* not HAVE_GRANTPT */
-
-/* Letter to use in finding device name of first pty,
- if system supports pty's. 'p' means it is /dev/ptyp0 */
-#define FIRST_PTY_LETTER 'p'
-
-#endif /* not HAVE_GRANTPT */
+#endif /* HAVE_GRANTPT */
/* Here, on a separate page, add any special hacks needed
to make Emacs work on this system. For example,
#define USG5
#define HPUX
-/* Letter to use in finding device name of first pty,
- if system supports pty's. 'p' means it is /dev/ptym/ptyp0 */
-#define FIRST_PTY_LETTER 'p'
-
/* Special hacks needed to make Emacs run on this system. */
/* This is how to get the device name of the tty end of a pty. */
#undef SETUP_SLAVE_PTY
-/* Letter to use in finding device name of first pty,
- if system supports pty's. 'a' means it is /dev/ptya0 */
-#undef FIRST_PTY_LETTER
-#define FIRST_PTY_LETTER 'q'
-
/* No need to use sprintf to get the tty name--we get that from _getpty. */
#define PTY_TTY_NAME_SPRINTF
/* No need to get the pty name at all. */
#ifdef emacs
char *_getpty();
#endif
-/* We need only try once to open a pty. */
-#define PTY_ITERATION
/* Here is how to do it. */
#define PTY_OPEN \
{ \
/* #define BSD4_2 */
/* #define BSD_SYSTEM */
-/* Letter to use in finding device name of first pty,
- if system supports pty's. 'a' means it is /dev/ptya0. */
-#define FIRST_PTY_LETTER 'a'
-
/* subprocesses should be undefined if you do NOT want to
have code for asynchronous subprocesses
(as used in M-x compile and M-x shell).
this is all we need. */
#define TIOCSIGSEND TIOCSIGNAL
-/* This change means that we don't loop through allocate_pty too many
- times in the (rare) event of a failure. */
-#define FIRST_PTY_LETTER 'z'
-
/* This sets the name of the master side of the PTY. */
#define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");