1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-18 15:21:16 +02:00

19456: Fix ptmx tests, again.

This commit is contained in:
Peter Stephenson 2004-02-20 15:27:35 +00:00
parent 01c29ffd95
commit 2073eca9f3
6 changed files with 48 additions and 9 deletions

View file

@ -1,3 +1,8 @@
2004-02-20 Peter Stephenson <pws@csr.com>
* 19456: configure.ac, Src/system.h, Src/Modules/zpty.c,
Src/Zle/iwidgets.list, Src/Zle/zle_hist.c: Fix 19428.
2004-02-20 Oliver Kiddle <opk@zsh.org> 2004-02-20 Oliver Kiddle <opk@zsh.org>
* 19455: Completion/Unix/Command/_mount: complete hostnames * 19455: Completion/Unix/Command/_mount: complete hostnames

View file

@ -154,8 +154,7 @@ getptycmd(char *name)
return NULL; return NULL;
} }
#if defined(HAVE_DEV_PTMX) && defined(HAVE_GRANTPT) && \ #ifdef USE_DEV_PTMX
defined(HAVE_PTSNAME) && defined(HAVE_UNLOCKPT)
#ifdef HAVE_SYS_STROPTS_H #ifdef HAVE_SYS_STROPTS_H
#include <sys/stropts.h> #include <sys/stropts.h>
@ -190,7 +189,7 @@ get_pty(int master, int *retfd)
close(mfd); close(mfd);
return 1; return 1;
} }
#if defined(I_FIND) && defined(I_PUSH) #if defined(I_FIND) && defined(I_PUSH) && defined(__SVR4)
/* /*
* Use if STREAMS is available. The test is probably OK, * Use if STREAMS is available. The test is probably OK,
* but we could use e.g. the sys/stropts.h test. * but we could use e.g. the sys/stropts.h test.

View file

@ -56,7 +56,7 @@
"expand-word", expandword, 0 "expand-word", expandword, 0
"forward-char", forwardchar, 0 "forward-char", forwardchar, 0
"forward-word", forwardword, 0 "forward-word", forwardword, 0
"get-line", getline, 0 "get-line", zgetline, 0
"gosmacs-transpose-chars", gosmacstransposechars, 0 "gosmacs-transpose-chars", gosmacstransposechars, 0
"history-beginning-search-backward", historybeginningsearchbackward, 0 "history-beginning-search-backward", historybeginningsearchbackward, 0
"history-beginning-search-forward", historybeginningsearchforward, 0 "history-beginning-search-forward", historybeginningsearchforward, 0

View file

@ -660,9 +660,10 @@ pushinput(char **args)
return ret; return ret;
} }
/* Renamed to avoid clash with library function */
/**/ /**/
int int
getline(char **args) zgetline(char **args)
{ {
char *s = (char *)getlinknode(bufstack); char *s = (char *)getlinknode(bufstack);

View file

@ -37,6 +37,14 @@
#endif #endif
#endif #endif
#ifdef __linux
/*
* Turn on numerous extensions.
* This is in order to get the functions for manipulating /dev/ptmx.
*/
#define _GNU_SOURCE 1
#endif
/* NeXT has half-implemented POSIX support * /* NeXT has half-implemented POSIX support *
* which currently fools configure */ * which currently fools configure */
#ifdef __NeXT__ #ifdef __NeXT__

View file

@ -1802,8 +1802,6 @@ dnl Check for pty multiplexer for use in pty module.
dnl We need to open it read/write, so make sure it is writeable. dnl We need to open it read/write, so make sure it is writeable.
dnl Yet another test which won't work when cross-compiling. dnl Yet another test which won't work when cross-compiling.
dnl --------------- dnl ---------------
AH_TEMPLATE([HAVE_DEV_PTMX],
[Define to 1 if your system can use /dev/ptmx for creating ptys.])
AC_CACHE_CHECK(if your system has /dev/ptmx, AC_CACHE_CHECK(if your system has /dev/ptmx,
ac_cv_have_dev_ptmx, ac_cv_have_dev_ptmx,
[if test -w /dev/ptmx; then [if test -w /dev/ptmx; then
@ -1811,9 +1809,37 @@ ac_cv_have_dev_ptmx,
else else
ac_cv_have_dev_ptmx=no ac_cv_have_dev_ptmx=no
fi]) fi])
if test $ac_cv_have_dev_ptmx = yes; then
AC_DEFINE(HAVE_DEV_PTMX) dnl --------
dnl Check if the ptmx functions are usable.
dnl We need to be able to find the prototypes, which may
dnl require non-POSIX source definitions. So test to see
dnl if ptsname is correctly recognised as returning a char *.
dnl We do this by making sure a program where ptsname() is declared
dnl as returning int does *not* compile.
dnl On Linux we need the XOPEN extensions. The easiest way to get
dnl these is by defining _GNU_SOURCE.
dnl -------
AH_TEMPLATE([USE_DEV_PTMX],
[Define to 1 if all the kit for using /dev/ptmx for ptys is available.])
if test $ac_cv_have_dev_ptmx = yes && \
test $ac_cv_func_grantpt = yes && \
test $ac_cv_func_unlockpt = yes && \
test $ac_cv_func_ptsname = yes; then
AC_CACHE_CHECK([if /dev/ptmx is usable],
ac_cv_use_dev_ptmx,
[AC_TRY_COMPILE([#ifdef __linux
#define _GNU_SOURCE 1
#endif
#include <stdlib.h>
int ptsname();], ,
ac_cv_use_dev_ptmx=no,
ac_cv_use_dev_ptmx=yes)])
if test $ac_cv_use_dev_ptmx = yes; then
AC_DEFINE(USE_DEV_PTMX)
fi fi
fi
dnl --------------- dnl ---------------
dnl dynamic loading dnl dynamic loading