mirror of
https://github.com/troglobit/editline.git
synced 2025-05-06 04:21:24 +08:00
Add configurable support for using termcap library for terminal size.
This commit is contained in:
parent
8b85bab216
commit
6d2f4c99a3
@ -171,6 +171,7 @@ SED = @SED@
|
|||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
|
TERMLIBS = @TERMLIBS@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
abs_builddir = @abs_builddir@
|
abs_builddir = @abs_builddir@
|
||||||
abs_srcdir = @abs_srcdir@
|
abs_srcdir = @abs_srcdir@
|
||||||
|
12
config.h.in
12
config.h.in
@ -18,6 +18,12 @@
|
|||||||
/* Define to enable SIGSTOP (Ctrl-Z) key. */
|
/* Define to enable SIGSTOP (Ctrl-Z) key. */
|
||||||
#undef CONFIG_SIGSTOP
|
#undef CONFIG_SIGSTOP
|
||||||
|
|
||||||
|
/* Define to use the termcap library for terminal size. */
|
||||||
|
#undef CONFIG_USE_TERMCAP
|
||||||
|
|
||||||
|
/* Define to 1 if `TIOCGWINSZ' requires <sys/ioctl.h>. */
|
||||||
|
#undef GWINSZ_IN_SYS_IOCTL
|
||||||
|
|
||||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||||
*/
|
*/
|
||||||
#undef HAVE_DIRENT_H
|
#undef HAVE_DIRENT_H
|
||||||
@ -34,6 +40,9 @@
|
|||||||
/* Define to 1 if you have the <memory.h> header file. */
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
#undef HAVE_MEMORY_H
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ncurses/termcap.h> header file. */
|
||||||
|
#undef HAVE_NCURSES_TERMCAP_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||||
#undef HAVE_NDIR_H
|
#undef HAVE_NDIR_H
|
||||||
|
|
||||||
@ -88,6 +97,9 @@
|
|||||||
/* Define to 1 if you have the `tcgetattr' function. */
|
/* Define to 1 if you have the `tcgetattr' function. */
|
||||||
#undef HAVE_TCGETATTR
|
#undef HAVE_TCGETATTR
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <termcap.h> header file. */
|
||||||
|
#undef HAVE_TERMCAP_H
|
||||||
|
|
||||||
/* Define to 1 if you have the <termios.h> header file. */
|
/* Define to 1 if you have the <termios.h> header file. */
|
||||||
#undef HAVE_TERMIOS_H
|
#undef HAVE_TERMIOS_H
|
||||||
|
|
||||||
|
243
configure
vendored
243
configure
vendored
@ -746,6 +746,7 @@ ac_includes_default="\
|
|||||||
ac_subst_vars='am__EXEEXT_FALSE
|
ac_subst_vars='am__EXEEXT_FALSE
|
||||||
am__EXEEXT_TRUE
|
am__EXEEXT_TRUE
|
||||||
LTLIBOBJS
|
LTLIBOBJS
|
||||||
|
TERMLIBS
|
||||||
AM_CFLAGS
|
AM_CFLAGS
|
||||||
CONFIG_DEFAULT_COMPLETE_FALSE
|
CONFIG_DEFAULT_COMPLETE_FALSE
|
||||||
CONFIG_DEFAULT_COMPLETE_TRUE
|
CONFIG_DEFAULT_COMPLETE_TRUE
|
||||||
@ -872,6 +873,7 @@ enable_default_complete
|
|||||||
enable_arrow_keys
|
enable_arrow_keys
|
||||||
enable_sigstop
|
enable_sigstop
|
||||||
enable_terminal_bell
|
enable_terminal_bell
|
||||||
|
enable_termcap
|
||||||
enable_history
|
enable_history
|
||||||
'
|
'
|
||||||
ac_precious_vars='build_alias
|
ac_precious_vars='build_alias
|
||||||
@ -1515,6 +1517,7 @@ Optional Features:
|
|||||||
--enable-arrow-keys Enable ANSI arrow keys.
|
--enable-arrow-keys Enable ANSI arrow keys.
|
||||||
--enable-sigstop Enable SIGSTOP key.
|
--enable-sigstop Enable SIGSTOP key.
|
||||||
--enable-terminal-bell Enable terminal bell on completion.
|
--enable-terminal-bell Enable terminal bell on completion.
|
||||||
|
--enable-termcap Use the termcap library for terminal size.
|
||||||
--enable-history=LINES Enable scrollback history, default off.
|
--enable-history=LINES Enable scrollback history, default off.
|
||||||
|
|
||||||
Optional Packages:
|
Optional Packages:
|
||||||
@ -4557,13 +4560,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
|
|||||||
else
|
else
|
||||||
lt_cv_nm_interface="BSD nm"
|
lt_cv_nm_interface="BSD nm"
|
||||||
echo "int some_variable = 0;" > conftest.$ac_ext
|
echo "int some_variable = 0;" > conftest.$ac_ext
|
||||||
(eval echo "\"\$as_me:4560: $ac_compile\"" >&5)
|
(eval echo "\"\$as_me:4563: $ac_compile\"" >&5)
|
||||||
(eval "$ac_compile" 2>conftest.err)
|
(eval "$ac_compile" 2>conftest.err)
|
||||||
cat conftest.err >&5
|
cat conftest.err >&5
|
||||||
(eval echo "\"\$as_me:4563: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
(eval echo "\"\$as_me:4566: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
||||||
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
|
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
|
||||||
cat conftest.err >&5
|
cat conftest.err >&5
|
||||||
(eval echo "\"\$as_me:4566: output\"" >&5)
|
(eval echo "\"\$as_me:4569: output\"" >&5)
|
||||||
cat conftest.out >&5
|
cat conftest.out >&5
|
||||||
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
|
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
|
||||||
lt_cv_nm_interface="MS dumpbin"
|
lt_cv_nm_interface="MS dumpbin"
|
||||||
@ -5769,7 +5772,7 @@ ia64-*-hpux*)
|
|||||||
;;
|
;;
|
||||||
*-*-irix6*)
|
*-*-irix6*)
|
||||||
# Find out which ABI we are using.
|
# Find out which ABI we are using.
|
||||||
echo '#line 5772 "configure"' > conftest.$ac_ext
|
echo '#line 5775 "configure"' > conftest.$ac_ext
|
||||||
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
|
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
|
||||||
(eval $ac_compile) 2>&5
|
(eval $ac_compile) 2>&5
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
@ -7299,11 +7302,11 @@ else
|
|||||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||||
-e 's:$: $lt_compiler_flag:'`
|
-e 's:$: $lt_compiler_flag:'`
|
||||||
(eval echo "\"\$as_me:7302: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:7305: $lt_compile\"" >&5)
|
||||||
(eval "$lt_compile" 2>conftest.err)
|
(eval "$lt_compile" 2>conftest.err)
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
cat conftest.err >&5
|
cat conftest.err >&5
|
||||||
echo "$as_me:7306: \$? = $ac_status" >&5
|
echo "$as_me:7309: \$? = $ac_status" >&5
|
||||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||||
# The compiler can only warn and ignore the option if not recognized
|
# The compiler can only warn and ignore the option if not recognized
|
||||||
# So say no if there are warnings other than the usual output.
|
# So say no if there are warnings other than the usual output.
|
||||||
@ -7638,11 +7641,11 @@ else
|
|||||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||||
-e 's:$: $lt_compiler_flag:'`
|
-e 's:$: $lt_compiler_flag:'`
|
||||||
(eval echo "\"\$as_me:7641: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:7644: $lt_compile\"" >&5)
|
||||||
(eval "$lt_compile" 2>conftest.err)
|
(eval "$lt_compile" 2>conftest.err)
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
cat conftest.err >&5
|
cat conftest.err >&5
|
||||||
echo "$as_me:7645: \$? = $ac_status" >&5
|
echo "$as_me:7648: \$? = $ac_status" >&5
|
||||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||||
# The compiler can only warn and ignore the option if not recognized
|
# The compiler can only warn and ignore the option if not recognized
|
||||||
# So say no if there are warnings other than the usual output.
|
# So say no if there are warnings other than the usual output.
|
||||||
@ -7743,11 +7746,11 @@ else
|
|||||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||||
-e 's:$: $lt_compiler_flag:'`
|
-e 's:$: $lt_compiler_flag:'`
|
||||||
(eval echo "\"\$as_me:7746: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:7749: $lt_compile\"" >&5)
|
||||||
(eval "$lt_compile" 2>out/conftest.err)
|
(eval "$lt_compile" 2>out/conftest.err)
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
cat out/conftest.err >&5
|
cat out/conftest.err >&5
|
||||||
echo "$as_me:7750: \$? = $ac_status" >&5
|
echo "$as_me:7753: \$? = $ac_status" >&5
|
||||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||||
then
|
then
|
||||||
# The compiler can only warn and ignore the option if not recognized
|
# The compiler can only warn and ignore the option if not recognized
|
||||||
@ -7798,11 +7801,11 @@ else
|
|||||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||||
-e 's:$: $lt_compiler_flag:'`
|
-e 's:$: $lt_compiler_flag:'`
|
||||||
(eval echo "\"\$as_me:7801: $lt_compile\"" >&5)
|
(eval echo "\"\$as_me:7804: $lt_compile\"" >&5)
|
||||||
(eval "$lt_compile" 2>out/conftest.err)
|
(eval "$lt_compile" 2>out/conftest.err)
|
||||||
ac_status=$?
|
ac_status=$?
|
||||||
cat out/conftest.err >&5
|
cat out/conftest.err >&5
|
||||||
echo "$as_me:7805: \$? = $ac_status" >&5
|
echo "$as_me:7808: \$? = $ac_status" >&5
|
||||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||||
then
|
then
|
||||||
# The compiler can only warn and ignore the option if not recognized
|
# The compiler can only warn and ignore the option if not recognized
|
||||||
@ -10182,7 +10185,7 @@ else
|
|||||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||||
lt_status=$lt_dlunknown
|
lt_status=$lt_dlunknown
|
||||||
cat > conftest.$ac_ext <<_LT_EOF
|
cat > conftest.$ac_ext <<_LT_EOF
|
||||||
#line 10185 "configure"
|
#line 10188 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#if HAVE_DLFCN_H
|
#if HAVE_DLFCN_H
|
||||||
@ -10278,7 +10281,7 @@ else
|
|||||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||||
lt_status=$lt_dlunknown
|
lt_status=$lt_dlunknown
|
||||||
cat > conftest.$ac_ext <<_LT_EOF
|
cat > conftest.$ac_ext <<_LT_EOF
|
||||||
#line 10281 "configure"
|
#line 10284 "configure"
|
||||||
#include "confdefs.h"
|
#include "confdefs.h"
|
||||||
|
|
||||||
#if HAVE_DLFCN_H
|
#if HAVE_DLFCN_H
|
||||||
@ -10822,7 +10825,7 @@ fi
|
|||||||
|
|
||||||
# Check for malloc.h instead of AC_FUNC_MALLOC/REALLOC AIX and others
|
# Check for malloc.h instead of AC_FUNC_MALLOC/REALLOC AIX and others
|
||||||
# mess up the traditional malloc check.
|
# mess up the traditional malloc check.
|
||||||
for ac_header in malloc.h signal.h sgtty.h stdlib.h string.h termio.h termios.h
|
for ac_header in malloc.h signal.h stdlib.h string.h termcap.h termio.h termios.h sgtty.h
|
||||||
do :
|
do :
|
||||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||||
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
|
||||||
@ -10837,6 +10840,68 @@ fi
|
|||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# In termios.h or in sys/ioctl.g?
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether termios.h defines TIOCGWINSZ" >&5
|
||||||
|
$as_echo_n "checking whether termios.h defines TIOCGWINSZ... " >&6; }
|
||||||
|
if test "${ac_cv_sys_tiocgwinsz_in_termios_h+set}" = set; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <termios.h>
|
||||||
|
#ifdef TIOCGWINSZ
|
||||||
|
yes
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_ACEOF
|
||||||
|
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||||
|
$EGREP "yes" >/dev/null 2>&1; then :
|
||||||
|
ac_cv_sys_tiocgwinsz_in_termios_h=yes
|
||||||
|
else
|
||||||
|
ac_cv_sys_tiocgwinsz_in_termios_h=no
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_tiocgwinsz_in_termios_h" >&5
|
||||||
|
$as_echo "$ac_cv_sys_tiocgwinsz_in_termios_h" >&6; }
|
||||||
|
|
||||||
|
if test $ac_cv_sys_tiocgwinsz_in_termios_h != yes; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/ioctl.h defines TIOCGWINSZ" >&5
|
||||||
|
$as_echo_n "checking whether sys/ioctl.h defines TIOCGWINSZ... " >&6; }
|
||||||
|
if test "${ac_cv_sys_tiocgwinsz_in_sys_ioctl_h+set}" = set; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#ifdef TIOCGWINSZ
|
||||||
|
yes
|
||||||
|
#endif
|
||||||
|
|
||||||
|
_ACEOF
|
||||||
|
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
|
||||||
|
$EGREP "yes" >/dev/null 2>&1; then :
|
||||||
|
ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=yes
|
||||||
|
else
|
||||||
|
ac_cv_sys_tiocgwinsz_in_sys_ioctl_h=no
|
||||||
|
fi
|
||||||
|
rm -f conftest*
|
||||||
|
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&5
|
||||||
|
$as_echo "$ac_cv_sys_tiocgwinsz_in_sys_ioctl_h" >&6; }
|
||||||
|
|
||||||
|
if test $ac_cv_sys_tiocgwinsz_in_sys_ioctl_h = yes; then
|
||||||
|
|
||||||
|
$as_echo "#define GWINSZ_IN_SYS_IOCTL 1" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Overrides and types, should be a check.
|
# Overrides and types, should be a check.
|
||||||
|
|
||||||
$as_echo "#define SYS_UNIX 1" >>confdefs.h
|
$as_echo "#define SYS_UNIX 1" >>confdefs.h
|
||||||
@ -11103,6 +11168,14 @@ $as_echo "#define CONFIG_ANNOYING_NOISE /**/" >>confdefs.h
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Check whether --enable-termcap was given.
|
||||||
|
if test "${enable_termcap+set}" = set; then :
|
||||||
|
enableval=$enable_termcap;
|
||||||
|
$as_echo "#define CONFIG_USE_TERMCAP /**/" >>confdefs.h
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Default history size 1, i.e. disabled.
|
# Default history size 1, i.e. disabled.
|
||||||
let HIST_SIZE=1
|
let HIST_SIZE=1
|
||||||
# Check whether --enable-history was given.
|
# Check whether --enable-history was given.
|
||||||
@ -11194,6 +11267,146 @@ CFLAGS="$saved_cflags"
|
|||||||
AM_CFLAGS="-std=gnu99 $inline_cflags -W -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
|
AM_CFLAGS="-std=gnu99 $inline_cflags -W -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
|
||||||
|
|
||||||
|
|
||||||
|
### The following magic for determining the location of termcap library is from GNU Texinfo
|
||||||
|
### http://www.tex.ac.uk/tex-archive/macros/texinfo/texinfo/configure.ac
|
||||||
|
# Some GNU/Linux systems (e.g., SuSE 4.3, 1996) don't have curses, but
|
||||||
|
# rather ncurses. So we check for it.
|
||||||
|
TERMLIBS=
|
||||||
|
# Check for termlib before termcap because Solaris termcap needs libucb.
|
||||||
|
TERMLIB_VARIANTS="termlib termcap terminfo ncurses curses"
|
||||||
|
for termlib in ${TERMLIB_VARIANTS}; do
|
||||||
|
as_ac_Lib=`$as_echo "ac_cv_lib_${termlib}''_tgetent" | $as_tr_sh`
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -l${termlib}" >&5
|
||||||
|
$as_echo_n "checking for tgetent in -l${termlib}... " >&6; }
|
||||||
|
if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
ac_check_lib_save_LIBS=$LIBS
|
||||||
|
LIBS="-l${termlib} $LIBS"
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
/* Override any GCC internal prototype to avoid an error.
|
||||||
|
Use char because int might match the return type of a GCC
|
||||||
|
builtin and then its argument prototype would still apply. */
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C"
|
||||||
|
#endif
|
||||||
|
char tgetent ();
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
return tgetent ();
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
eval "$as_ac_Lib=yes"
|
||||||
|
else
|
||||||
|
eval "$as_ac_Lib=no"
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
LIBS=$ac_check_lib_save_LIBS
|
||||||
|
fi
|
||||||
|
eval ac_res=\$$as_ac_Lib
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||||
|
$as_echo "$ac_res" >&6; }
|
||||||
|
eval as_val=\$$as_ac_Lib
|
||||||
|
if test "x$as_val" = x""yes; then :
|
||||||
|
TERMLIBS="${TERMLIBS} -l${termlib}"; break
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
# don't bother warning on djgpp, it doesn't have a term library, it
|
||||||
|
# ports each termcap-needing program separately according to its needs.
|
||||||
|
if test -z "$TERMLIBS" && echo "$build" | grep -v djgpp >/dev/null; then
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: probably need a terminal library, one of: ${TERMLIB_VARIANTS}" >&5
|
||||||
|
$as_echo "$as_me: WARNING: probably need a terminal library, one of: ${TERMLIB_VARIANTS}" >&2;}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checks for variables.
|
||||||
|
# HP-UX 9 (at least) needs -lncurses which defines termcap variables PC etc.
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library with termcap variables" >&5
|
||||||
|
$as_echo_n "checking for library with termcap variables... " >&6; }
|
||||||
|
if test "${ac_cv_var_ospeed+set}" = set; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
oldLIBS=$LIBS
|
||||||
|
for trylib in $termlib ${TERMLIB_VARIANTS}; do
|
||||||
|
if test "x$trylib" != "x$termlib"; then
|
||||||
|
LIBS="$oldLIBS -l$termlib -l$trylib"
|
||||||
|
else
|
||||||
|
LIBS="$oldLIBS -l$termlib"
|
||||||
|
fi
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
|
||||||
|
int
|
||||||
|
main ()
|
||||||
|
{
|
||||||
|
#ifdef HAVE_NCURSES_TERMCAP_H
|
||||||
|
#include <ncurses/termcap.h>
|
||||||
|
#else
|
||||||
|
#ifdef HAVE_TERMCAP_H
|
||||||
|
#include <termcap.h>
|
||||||
|
#else
|
||||||
|
#undef PC
|
||||||
|
char *BC;
|
||||||
|
char **UP;
|
||||||
|
char PC;
|
||||||
|
short ospeed;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
/* Make sure all variables actually exist. AIX 4.3 has ospeed but no BC.
|
||||||
|
--Andreas Ley <andy@rz.uni-karlsruhe.de> 24 Aug 2000. */
|
||||||
|
BC++;
|
||||||
|
UP++;
|
||||||
|
PC++;
|
||||||
|
return ospeed != 0;
|
||||||
|
|
||||||
|
;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
ac_cv_var_ospeed=$trylib; break
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
done
|
||||||
|
LIBS=$oldLIBS
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_var_ospeed" >&5
|
||||||
|
$as_echo "$ac_cv_var_ospeed" >&6; }
|
||||||
|
if test -n "$ac_cv_var_ospeed" \
|
||||||
|
&& test "x$termlib" != "x$ac_cv_var_ospeed"; then
|
||||||
|
TERMLIBS="${TERMLIBS} -l${ac_cv_var_ospeed}"
|
||||||
|
fi
|
||||||
|
#
|
||||||
|
|
||||||
|
# Do not use <ncurses/termcap.h> unless we're linking with ncurses.
|
||||||
|
# Must come after the termlib tests.
|
||||||
|
if test "x$termlib" = xncurses; then
|
||||||
|
# Use AC_CHECK_HEADERS so the HAVE_*_H symbol gets defined.
|
||||||
|
for ac_header in ncurses/termcap.h
|
||||||
|
do :
|
||||||
|
ac_fn_c_check_header_mongrel "$LINENO" "ncurses/termcap.h" "ac_cv_header_ncurses_termcap_h" "$ac_includes_default"
|
||||||
|
if test "x$ac_cv_header_ncurses_termcap_h" = x""yes; then :
|
||||||
|
cat >>confdefs.h <<_ACEOF
|
||||||
|
#define HAVE_NCURSES_TERMCAP_H 1
|
||||||
|
_ACEOF
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
|
fi
|
||||||
|
### End-of-Termcap magic from http://www.tex.ac.uk/tex-archive/macros/texinfo/texinfo/configure.ac
|
||||||
|
|
||||||
ac_config_files="$ac_config_files Makefile src/Makefile include/Makefile man/Makefile examples/Makefile"
|
ac_config_files="$ac_config_files Makefile src/Makefile include/Makefile man/Makefile examples/Makefile"
|
||||||
|
|
||||||
cat >confcache <<\_ACEOF
|
cat >confcache <<\_ACEOF
|
||||||
|
86
configure.ac
86
configure.ac
@ -1,5 +1,16 @@
|
|||||||
# Minix libeditline -*- Autoconf -*-
|
# Minix libeditline -*- Autoconf -*-
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008-2010 Joachim Nilsson <troglobit()vmlinux!org>
|
||||||
|
#
|
||||||
# Process this file with autoconf to produce a configure script.
|
# Process this file with autoconf to produce a configure script.
|
||||||
|
#
|
||||||
|
# This file is free software; as a special exception the author gives
|
||||||
|
# unlimited permission to copy and/or distribute it, with or without
|
||||||
|
# modifications, as long as this notice is preserved.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful, but
|
||||||
|
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
|
||||||
AC_PREREQ(2.61)
|
AC_PREREQ(2.61)
|
||||||
AC_INIT(editline, 1.13.0, troglobit@vmlinux.org)
|
AC_INIT(editline, 1.13.0, troglobit@vmlinux.org)
|
||||||
@ -25,7 +36,10 @@ AC_HEADER_STAT
|
|||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
# Check for malloc.h instead of AC_FUNC_MALLOC/REALLOC AIX and others
|
# Check for malloc.h instead of AC_FUNC_MALLOC/REALLOC AIX and others
|
||||||
# mess up the traditional malloc check.
|
# mess up the traditional malloc check.
|
||||||
AC_CHECK_HEADERS([malloc.h signal.h sgtty.h stdlib.h string.h termio.h termios.h])
|
AC_CHECK_HEADERS([malloc.h signal.h stdlib.h string.h termcap.h termio.h termios.h sgtty.h])
|
||||||
|
|
||||||
|
# In termios.h or in sys/ioctl.g?
|
||||||
|
AC_HEADER_TIOCGWINSZ
|
||||||
|
|
||||||
# Overrides and types, should be a check.
|
# Overrides and types, should be a check.
|
||||||
AC_DEFINE([SYS_UNIX], [1], [Default to UNIX backend, should be detected.])
|
AC_DEFINE([SYS_UNIX], [1], [Default to UNIX backend, should be detected.])
|
||||||
@ -55,6 +69,10 @@ AC_ARG_ENABLE(terminal-bell,
|
|||||||
[ --enable-terminal-bell Enable terminal bell on completion.],
|
[ --enable-terminal-bell Enable terminal bell on completion.],
|
||||||
AC_DEFINE([CONFIG_ANNOYING_NOISE],, [Define to enable terminal bell on completion.]))
|
AC_DEFINE([CONFIG_ANNOYING_NOISE],, [Define to enable terminal bell on completion.]))
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(termcap,
|
||||||
|
[ --enable-termcap Use the termcap library for terminal size.],
|
||||||
|
AC_DEFINE([CONFIG_USE_TERMCAP],, [Define to use the termcap library for terminal size.]))
|
||||||
|
|
||||||
# Default history size 1, i.e. disabled.
|
# Default history size 1, i.e. disabled.
|
||||||
let HIST_SIZE=1
|
let HIST_SIZE=1
|
||||||
AC_ARG_ENABLE(history,
|
AC_ARG_ENABLE(history,
|
||||||
@ -92,5 +110,71 @@ CFLAGS="$saved_cflags"
|
|||||||
AM_CFLAGS="-std=gnu99 $inline_cflags -W -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
|
AM_CFLAGS="-std=gnu99 $inline_cflags -W -Wall -Wundef -Wunused -Wstrict-prototypes -Werror-implicit-function-declaration $nopointersign_cflags -Wshadow"
|
||||||
AC_SUBST(AM_CFLAGS)
|
AC_SUBST(AM_CFLAGS)
|
||||||
|
|
||||||
|
### The following magic for determining the location of termcap library is from GNU Texinfo
|
||||||
|
### http://www.tex.ac.uk/tex-archive/macros/texinfo/texinfo/configure.ac
|
||||||
|
# Some GNU/Linux systems (e.g., SuSE 4.3, 1996) don't have curses, but
|
||||||
|
# rather ncurses. So we check for it.
|
||||||
|
TERMLIBS=
|
||||||
|
# Check for termlib before termcap because Solaris termcap needs libucb.
|
||||||
|
TERMLIB_VARIANTS="termlib termcap terminfo ncurses curses"
|
||||||
|
for termlib in ${TERMLIB_VARIANTS}; do
|
||||||
|
AC_CHECK_LIB(${termlib}, tgetent,
|
||||||
|
[TERMLIBS="${TERMLIBS} -l${termlib}"; break])
|
||||||
|
done
|
||||||
|
# don't bother warning on djgpp, it doesn't have a term library, it
|
||||||
|
# ports each termcap-needing program separately according to its needs.
|
||||||
|
if test -z "$TERMLIBS" && echo "$build" | grep -v djgpp >/dev/null; then
|
||||||
|
AC_MSG_WARN([probably need a terminal library, one of: ${TERMLIB_VARIANTS}])
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Checks for variables.
|
||||||
|
# HP-UX 9 (at least) needs -lncurses which defines termcap variables PC etc.
|
||||||
|
AC_MSG_CHECKING(for library with termcap variables)
|
||||||
|
AC_CACHE_VAL(ac_cv_var_ospeed,
|
||||||
|
[oldLIBS=$LIBS
|
||||||
|
for trylib in $termlib ${TERMLIB_VARIANTS}; do
|
||||||
|
if test "x$trylib" != "x$termlib"; then
|
||||||
|
LIBS="$oldLIBS -l$termlib -l$trylib"
|
||||||
|
else
|
||||||
|
LIBS="$oldLIBS -l$termlib"
|
||||||
|
fi
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [[#ifdef HAVE_NCURSES_TERMCAP_H
|
||||||
|
#include <ncurses/termcap.h>
|
||||||
|
#else
|
||||||
|
#ifdef HAVE_TERMCAP_H
|
||||||
|
#include <termcap.h>
|
||||||
|
#else
|
||||||
|
#undef PC
|
||||||
|
char *BC;
|
||||||
|
char **UP;
|
||||||
|
char PC;
|
||||||
|
short ospeed;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
/* Make sure all variables actually exist. AIX 4.3 has ospeed but no BC.
|
||||||
|
--Andreas Ley <andy@rz.uni-karlsruhe.de> 24 Aug 2000. */
|
||||||
|
BC++;
|
||||||
|
UP++;
|
||||||
|
PC++;
|
||||||
|
return ospeed != 0;
|
||||||
|
]])], [ac_cv_var_ospeed=$trylib; break])
|
||||||
|
done
|
||||||
|
LIBS=$oldLIBS
|
||||||
|
])
|
||||||
|
AC_MSG_RESULT($ac_cv_var_ospeed)
|
||||||
|
if test -n "$ac_cv_var_ospeed" \
|
||||||
|
&& test "x$termlib" != "x$ac_cv_var_ospeed"; then
|
||||||
|
TERMLIBS="${TERMLIBS} -l${ac_cv_var_ospeed}"
|
||||||
|
fi
|
||||||
|
AC_SUBST(TERMLIBS)#
|
||||||
|
|
||||||
|
# Do not use <ncurses/termcap.h> unless we're linking with ncurses.
|
||||||
|
# Must come after the termlib tests.
|
||||||
|
if test "x$termlib" = xncurses; then
|
||||||
|
# Use AC_CHECK_HEADERS so the HAVE_*_H symbol gets defined.
|
||||||
|
AC_CHECK_HEADERS(ncurses/termcap.h)
|
||||||
|
fi
|
||||||
|
### End-of-Termcap magic from http://www.tex.ac.uk/tex-archive/macros/texinfo/texinfo/configure.ac
|
||||||
|
|
||||||
AC_OUTPUT(Makefile src/Makefile include/Makefile man/Makefile examples/Makefile)
|
AC_OUTPUT(Makefile src/Makefile include/Makefile man/Makefile examples/Makefile)
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
AUTOMAKE_OPTIONS = foreign
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
noinst_PROGRAMS = testit cli
|
noinst_PROGRAMS = testit cli
|
||||||
LDADD = $(top_builddir)/src/libeditline.la
|
LDADD = $(top_builddir)/src/libeditline.la $(TERMLIBS)
|
||||||
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
|
AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include
|
||||||
|
|
||||||
|
@ -52,14 +52,17 @@ PROGRAMS = $(noinst_PROGRAMS)
|
|||||||
cli_SOURCES = cli.c
|
cli_SOURCES = cli.c
|
||||||
cli_OBJECTS = cli.$(OBJEXT)
|
cli_OBJECTS = cli.$(OBJEXT)
|
||||||
cli_LDADD = $(LDADD)
|
cli_LDADD = $(LDADD)
|
||||||
cli_DEPENDENCIES = $(top_builddir)/src/libeditline.la
|
am__DEPENDENCIES_1 =
|
||||||
|
cli_DEPENDENCIES = $(top_builddir)/src/libeditline.la \
|
||||||
|
$(am__DEPENDENCIES_1)
|
||||||
AM_V_lt = $(am__v_lt_$(V))
|
AM_V_lt = $(am__v_lt_$(V))
|
||||||
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
|
||||||
am__v_lt_0 = --silent
|
am__v_lt_0 = --silent
|
||||||
testit_SOURCES = testit.c
|
testit_SOURCES = testit.c
|
||||||
testit_OBJECTS = testit.$(OBJEXT)
|
testit_OBJECTS = testit.$(OBJEXT)
|
||||||
testit_LDADD = $(LDADD)
|
testit_LDADD = $(LDADD)
|
||||||
testit_DEPENDENCIES = $(top_builddir)/src/libeditline.la
|
testit_DEPENDENCIES = $(top_builddir)/src/libeditline.la \
|
||||||
|
$(am__DEPENDENCIES_1)
|
||||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
|
||||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||||
am__depfiles_maybe = depfiles
|
am__depfiles_maybe = depfiles
|
||||||
@ -151,6 +154,7 @@ SED = @SED@
|
|||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
|
TERMLIBS = @TERMLIBS@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
abs_builddir = @abs_builddir@
|
abs_builddir = @abs_builddir@
|
||||||
abs_srcdir = @abs_srcdir@
|
abs_srcdir = @abs_srcdir@
|
||||||
@ -205,7 +209,7 @@ top_build_prefix = @top_build_prefix@
|
|||||||
top_builddir = @top_builddir@
|
top_builddir = @top_builddir@
|
||||||
top_srcdir = @top_srcdir@
|
top_srcdir = @top_srcdir@
|
||||||
AUTOMAKE_OPTIONS = foreign
|
AUTOMAKE_OPTIONS = foreign
|
||||||
LDADD = $(top_builddir)/src/libeditline.la
|
LDADD = $(top_builddir)/src/libeditline.la $(TERMLIBS)
|
||||||
all: all-am
|
all: all-am
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
|
@ -142,6 +142,7 @@ SED = @SED@
|
|||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
|
TERMLIBS = @TERMLIBS@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
abs_builddir = @abs_builddir@
|
abs_builddir = @abs_builddir@
|
||||||
abs_srcdir = @abs_srcdir@
|
abs_srcdir = @abs_srcdir@
|
||||||
|
@ -141,6 +141,7 @@ SED = @SED@
|
|||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
|
TERMLIBS = @TERMLIBS@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
abs_builddir = @abs_builddir@
|
abs_builddir = @abs_builddir@
|
||||||
abs_srcdir = @abs_srcdir@
|
abs_srcdir = @abs_srcdir@
|
||||||
|
@ -172,6 +172,7 @@ SED = @SED@
|
|||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
|
TERMLIBS = @TERMLIBS@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
abs_builddir = @abs_builddir@
|
abs_builddir = @abs_builddir@
|
||||||
abs_srcdir = @abs_srcdir@
|
abs_srcdir = @abs_srcdir@
|
||||||
|
@ -240,3 +240,12 @@ int default_rl_list_possib(char *pathname, char ***avp)
|
|||||||
|
|
||||||
return ac;
|
return ac;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local Variables:
|
||||||
|
* version-control: t
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* c-file-style: "ellemtel"
|
||||||
|
* c-basic-offset: 4
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
/*
|
/*
|
||||||
** Manifest constants.
|
** Manifest constants.
|
||||||
*/
|
*/
|
||||||
#define SCREEN_WIDTH 80
|
#define SCREEN_COLS 80
|
||||||
#define SCREEN_ROWS 24
|
#define SCREEN_ROWS 24
|
||||||
#define NO_ARG (-1)
|
#define NO_ARG (-1)
|
||||||
#define DEL 127
|
#define DEL 127
|
||||||
@ -107,7 +107,7 @@ static SIZE_T Length;
|
|||||||
static SIZE_T ScreenCount;
|
static SIZE_T ScreenCount;
|
||||||
static SIZE_T ScreenSize;
|
static SIZE_T ScreenSize;
|
||||||
static char *backspace;
|
static char *backspace;
|
||||||
static int tty_width;
|
static int tty_cols;
|
||||||
static int tty_rows;
|
static int tty_rows;
|
||||||
|
|
||||||
/* Display print 8-bit chars as `M-x' or as the actual 8-bit char? */
|
/* Display print 8-bit chars as `M-x' or as the actual 8-bit char? */
|
||||||
@ -122,11 +122,10 @@ int (*rl_list_possib)(char *token, char ***av);
|
|||||||
** Declarations.
|
** Declarations.
|
||||||
*/
|
*/
|
||||||
static char *editinput(void);
|
static char *editinput(void);
|
||||||
#ifdef USE_TERMCAP
|
#ifdef CONFIG_USE_TERMCAP
|
||||||
extern char *getenv(void);
|
extern char *tgetstr(const char *, char **);
|
||||||
extern char *tgetstr(void);
|
extern int tgetent(char *, const char *);
|
||||||
extern int tgetent(void);
|
extern int tgetnum(const char *);
|
||||||
extern int tgetnum(void);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -213,7 +212,7 @@ static void tty_backn(int n)
|
|||||||
static void tty_info(void)
|
static void tty_info(void)
|
||||||
{
|
{
|
||||||
static int init;
|
static int init;
|
||||||
#ifdef USE_TERMCAP
|
#ifdef CONFIG_USE_TERMCAP
|
||||||
char *term;
|
char *term;
|
||||||
char buff[2048];
|
char buff[2048];
|
||||||
char *bp;
|
char *bp;
|
||||||
@ -227,7 +226,7 @@ static void tty_info(void)
|
|||||||
/* Perhaps we got resized. */
|
/* Perhaps we got resized. */
|
||||||
if (ioctl(0, TIOCGWINSZ, &W) >= 0
|
if (ioctl(0, TIOCGWINSZ, &W) >= 0
|
||||||
&& W.ws_col > 0 && W.ws_row > 0) {
|
&& W.ws_col > 0 && W.ws_row > 0) {
|
||||||
tty_width = (int)W.ws_col;
|
tty_cols = (int)W.ws_col;
|
||||||
tty_rows = (int)W.ws_row;
|
tty_rows = (int)W.ws_row;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -235,32 +234,31 @@ static void tty_info(void)
|
|||||||
}
|
}
|
||||||
init++;
|
init++;
|
||||||
|
|
||||||
tty_width = tty_rows = 0;
|
/* Initialize to faulty values to trigger fallback if nothing else works. */
|
||||||
#ifdef USE_TERMCAP
|
tty_cols = tty_rows = -1;
|
||||||
|
#ifdef CONFIG_USE_TERMCAP
|
||||||
bp = buff;
|
bp = buff;
|
||||||
if ((term = getenv("TERM")) == NULL)
|
if ((term = getenv("TERM")) == NULL)
|
||||||
term = "dumb";
|
term = "dumb";
|
||||||
if (tgetent(buff, term) < 0) {
|
if (-1 != tgetent(buff, term)) {
|
||||||
tty_width = SCREEN_WIDTH;
|
if ((backspace = tgetstr("le", &bp)) != NULL)
|
||||||
tty_rows = SCREEN_ROWS;
|
backspace = strdup(backspace);
|
||||||
return;
|
tty_cols = tgetnum("co");
|
||||||
|
tty_rows = tgetnum("li");
|
||||||
}
|
}
|
||||||
if ((backspace = tgetstr("le", &bp)) != NULL)
|
/* Make sure to check width & rows and fallback to TIOCGWINSZ if available. */
|
||||||
backspace = strdup(backspace);
|
|
||||||
tty_width = tgetnum("co");
|
|
||||||
tty_rows = tgetnum("li");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (tty_cols <= 0 || tty_rows <= 0) {
|
||||||
#ifdef TIOCGWINSZ
|
#ifdef TIOCGWINSZ
|
||||||
if (ioctl(0, TIOCGWINSZ, &W) >= 0) {
|
if (-1 != ioctl(0, TIOCGWINSZ, &W)) {
|
||||||
tty_width = (int)W.ws_col;
|
tty_cols = (int)W.ws_col;
|
||||||
tty_rows = (int)W.ws_row;
|
tty_rows = (int)W.ws_row;
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
tty_cols = SCREEN_COLS;
|
||||||
if (tty_width <= 0 || tty_rows <= 0) {
|
tty_rows = SCREEN_ROWS;
|
||||||
tty_width = SCREEN_WIDTH;
|
|
||||||
tty_rows = SCREEN_ROWS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +281,7 @@ static void columns(int ac, char **av)
|
|||||||
for (longest = 0, i = 0; i < ac; i++)
|
for (longest = 0, i = 0; i < ac; i++)
|
||||||
if ((j = strlen((char *)av[i])) > longest)
|
if ((j = strlen((char *)av[i])) > longest)
|
||||||
longest = j;
|
longest = j;
|
||||||
cols = tty_width / (longest + 3);
|
cols = tty_cols / (longest + 3);
|
||||||
|
|
||||||
tty_puts(NEWLINE);
|
tty_puts(NEWLINE);
|
||||||
for (skip = ac / cols + 1, i = 0; i < skip; i++) {
|
for (skip = ac / cols + 1, i = 0; i < skip; i++) {
|
||||||
@ -1467,3 +1465,11 @@ static el_keymap_t MetaMap[]= {
|
|||||||
{ 0, NULL }
|
{ 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Local Variables:
|
||||||
|
* version-control: t
|
||||||
|
* indent-tabs-mode: t
|
||||||
|
* c-file-style: "ellemtel"
|
||||||
|
* c-basic-offset: 4
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
@ -45,6 +45,13 @@
|
|||||||
#ifdef SYS_OS9
|
#ifdef SYS_OS9
|
||||||
#include "os9.h"
|
#include "os9.h"
|
||||||
#endif
|
#endif
|
||||||
|
/* The following two are for TIOCGWINSZ */
|
||||||
|
#ifdef HAVE_TERMIOS_H
|
||||||
|
# include <termios.h>
|
||||||
|
#endif
|
||||||
|
#ifdef GWINSZ_IN_SYS_IOCTL
|
||||||
|
# include <sys/ioctl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef SIZE_T
|
#ifndef SIZE_T
|
||||||
#define SIZE_T unsigned int
|
#define SIZE_T unsigned int
|
||||||
|
Loading…
Reference in New Issue
Block a user