mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-02 22:11:54 +02:00
Detect variant tgetent() return value and test for it correctly.
This commit is contained in:
parent
cefd2de2e1
commit
d3454531d4
3 changed files with 42 additions and 8 deletions
|
@ -535,11 +535,11 @@ init_term(void)
|
|||
|
||||
#ifdef TGETENT_ACCEPTS_NULL
|
||||
/* If possible, we let tgetent allocate its own termcap buffer */
|
||||
if (tgetent(NULL, term) != 1) {
|
||||
if (tgetent(NULL, term) != TGETENT_SUCCESS)
|
||||
#else
|
||||
if (tgetent(termbuf, term) != 1) {
|
||||
if (tgetent(termbuf, term) != TGETENT_SUCCESS)
|
||||
#endif
|
||||
|
||||
{
|
||||
if (isset(INTERACTIVE))
|
||||
zerr("can't find terminal definition for %s", term, 0);
|
||||
errflag = 0;
|
||||
|
|
|
@ -187,6 +187,9 @@
|
|||
/* Define to 1 if tgetent() accepts NULL as a buffer */
|
||||
#undef TGETENT_ACCEPTS_NULL
|
||||
|
||||
/* Define to what tgetent() returns on success (0 on HP-UX X/Open curses) */
|
||||
#define TGETENT_SUCCESS 1
|
||||
|
||||
/* Define to 1 if you use POSIX style signal handling */
|
||||
#undef POSIX_SIGNALS
|
||||
|
||||
|
|
41
zshconfig.ac
41
zshconfig.ac
|
@ -964,14 +964,16 @@ zsh_cv_func_tgetent_accepts_null,
|
|||
[AC_TRY_RUN([
|
||||
main()
|
||||
{
|
||||
int i = tgetent((char*)0,"vt100");
|
||||
if (i > 0) {
|
||||
char tbuf[1024], *u;
|
||||
u = tbuf;
|
||||
char buf[4096];
|
||||
int r1 = tgetent(buf, "vt100");
|
||||
int r2 = tgetent((char*)0,"vt100");
|
||||
if (r1 >= 0 && r1 == r2) {
|
||||
char tbuf[1024], *u;
|
||||
u = tbuf;
|
||||
tgetstr("cl", &u);
|
||||
creat("conftest.tgetent", 0640);
|
||||
}
|
||||
exit(!i || i == -1);
|
||||
exit((r1 != r2) || r2 == -1);
|
||||
}
|
||||
],
|
||||
if test -f conftest.tgetent; then
|
||||
|
@ -984,6 +986,35 @@ main()
|
|||
if test $zsh_cv_func_tgetent_accepts_null = yes; then
|
||||
AC_DEFINE(TGETENT_ACCEPTS_NULL)
|
||||
fi
|
||||
AC_CACHE_CHECK(if tgetent returns 0 on success,
|
||||
zsh_cv_func_tgetent_zero_success,
|
||||
[AC_TRY_RUN([
|
||||
main()
|
||||
{
|
||||
char buf[4096];
|
||||
int r1 = tgetent(buf, "!@#$%^&*");
|
||||
int r2 = tgetent(buf, "vt100");
|
||||
if (r1 < 0 && r2 == 0) {
|
||||
char tbuf[1024], *u;
|
||||
u = tbuf;
|
||||
tgetstr("cl", &u);
|
||||
creat("conftest.tgetent0", 0640);
|
||||
}
|
||||
exit(r1 == r2);
|
||||
}
|
||||
],
|
||||
if test -f conftest.tgetent0; then
|
||||
zsh_cv_func_tgetent_zero_success=yes
|
||||
else
|
||||
zsh_cv_func_tgetent_zero_success=no
|
||||
fi,
|
||||
zsh_cv_func_tgetent_zero_success=no,
|
||||
zsh_cv_func_tgetent_zero_success=no)])
|
||||
if test $zsh_cv_func_tgetent_zero_success = yes; then
|
||||
AC_DEFINE(TGETENT_SUCCESS, 0)
|
||||
else
|
||||
AC_DEFINE(TGETENT_SUCCESS, 1)
|
||||
fi
|
||||
|
||||
AC_FUNC_MMAP
|
||||
if test x$ac_cv_func_mmap_fixed_mapped = xyes; then
|
||||
|
|
Loading…
Reference in a new issue