mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 21:44:16 +00:00
Provide fallback is struct winsize is not defined
darcs-hash:20060730205544-ac50b-26f34eb04b56924baa34f560fd274cf38413b5f5.gz
This commit is contained in:
parent
60f0533821
commit
e79fdcb194
3 changed files with 31 additions and 0 deletions
5
common.c
5
common.c
|
@ -1412,10 +1412,15 @@ int acquire_lock_file( const char *lockfile, const int timeout, int force )
|
||||||
|
|
||||||
void common_handle_winch( int signal )
|
void common_handle_winch( int signal )
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_WINSIZE
|
||||||
if (ioctl(1,TIOCGWINSZ,&termsize)!=0)
|
if (ioctl(1,TIOCGWINSZ,&termsize)!=0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
termsize.ws_col = 80;
|
||||||
|
termsizews_row = 24;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int common_get_width()
|
int common_get_width()
|
||||||
|
|
16
configure.ac
16
configure.ac
|
@ -286,6 +286,22 @@ else
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Check if struct winsize exists
|
||||||
|
AC_MSG_CHECKING([if struct winsize exists])
|
||||||
|
AC_LINK_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM([
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_SIGINFO_H
|
||||||
|
#include <siginfo.h>
|
||||||
|
#endif],
|
||||||
|
[struct winsize termsize; ioctl(1,TIOCGWINSZ,&termsize);])],
|
||||||
|
[AC_MSG_RESULT(yes); AC_DEFINE([HAVE_WINSIZE], [1], [Define to 1 if the winsize struct exists])],
|
||||||
|
AC_MSG_RESULT(no))
|
||||||
|
|
||||||
# If we have a fwprintf in libc, test that it actually works. As of
|
# If we have a fwprintf in libc, test that it actually works. As of
|
||||||
# March 2006, it is broken under Dragonfly BSD.
|
# March 2006, it is broken under Dragonfly BSD.
|
||||||
if test "$ac_cv_func_fwprintf" = yes; then
|
if test "$ac_cv_func_fwprintf" = yes; then
|
||||||
|
|
10
fallback.h
10
fallback.h
|
@ -43,6 +43,16 @@ typedef int tputs_arg_t;
|
||||||
typedef char tputs_arg_t;
|
typedef char tputs_arg_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_WINSIZE
|
||||||
|
struct winsize
|
||||||
|
{
|
||||||
|
unsigned short ws_row;
|
||||||
|
unsigned short ws_col;
|
||||||
|
}
|
||||||
|
;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef TPUTS_KLUDGE
|
#ifdef TPUTS_KLUDGE
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue