diff --git a/Makefile.in b/Makefile.in index 08cef5c..94dd987 100644 --- a/Makefile.in +++ b/Makefile.in @@ -137,6 +137,7 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HIST_SIZE = @HIST_SIZE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/TODO b/TODO index bd96b8d..66f1a64 100644 --- a/TODO +++ b/TODO @@ -2,6 +2,7 @@ TODO * Port "fileman" example from BSD editline * Add --enable-FEATURE for remaining features defined in Makefile-minix.in +* Check for tgetent to find termcap, e.g., http://www.tex.ac.uk/tex-archive/macros/texinfo/texinfo/configure.ac * Add support for rl_bind_key(), currently one needs to "hack" the Map[] * Add support for inhibiting completion: rl_inhibit_completion diff --git a/config.h.in b/config.h.in index 90fabc5..28d0de8 100644 --- a/config.h.in +++ b/config.h.in @@ -100,6 +100,9 @@ /* Enable static keyword, hides internal methods. */ #undef HIDE +/* Number of lines in history. */ +#undef HIST_SIZE + /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK diff --git a/configure b/configure index 58898aa..5fa676d 100755 --- a/configure +++ b/configure @@ -872,6 +872,7 @@ enable_default_complete enable_arrow_keys enable_sigstop enable_terminal_bell +enable_history ' ac_precious_vars='build_alias host_alias @@ -1514,6 +1515,7 @@ Optional Features: --enable-arrow-keys Enable ANSI arrow keys. --enable-sigstop Enable SIGSTOP key. --enable-terminal-bell Enable terminal bell on completion. + --enable-history=LINES Enable scrollback history, default off. Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -4555,13 +4557,13 @@ if test "${lt_cv_nm_interface+set}" = set; then : else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:4558: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4560: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4561: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4563: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4564: output\"" >&5) + (eval echo "\"\$as_me:4566: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5767,7 +5769,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5770 "configure"' > conftest.$ac_ext + echo '#line 5772 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7297,11 +7299,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7300: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7302: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7304: \$? = $ac_status" >&5 + echo "$as_me:7306: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7636,11 +7638,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7639: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7641: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7643: \$? = $ac_status" >&5 + echo "$as_me:7645: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7741,11 +7743,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7744: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7746: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7748: \$? = $ac_status" >&5 + echo "$as_me:7750: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7796,11 +7798,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7799: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7801: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7803: \$? = $ac_status" >&5 + echo "$as_me:7805: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10180,7 +10182,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10183 "configure" +#line 10185 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10276,7 +10278,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10279 "configure" +#line 10281 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11105,6 +11107,22 @@ $as_echo "#define CONFIG_ANNOYING_NOISE /**/" >>confdefs.h fi +# Default history size 1, i.e. disabled. +let HIST_SIZE=1 +# Check whether --enable-history was given. +if test "${enable_history+set}" = set; then : + enableval=$enable_history; let HIST_SIZE=$enableval +fi + +if test $HIST_SIZE -lt 1; then + let HIST_SIZE=1 +fi + +cat >>confdefs.h <<_ACEOF +#define HIST_SIZE $HIST_SIZE +_ACEOF + + # Restore gnu89 inline semantics on gcc 4.3 and newer saved_cflags="$CFLAGS" CFLAGS="$CFLAGS -fgnu89-inline" diff --git a/configure.ac b/configure.ac index 33322a2..7bb7341 100644 --- a/configure.ac +++ b/configure.ac @@ -59,6 +59,16 @@ AC_ARG_ENABLE(terminal-bell, [ --enable-terminal-bell Enable terminal bell on completion.], AC_DEFINE([CONFIG_ANNOYING_NOISE],, [Define to enable terminal bell on completion.])) +# Default history size 1, i.e. disabled. +let HIST_SIZE=1 +AC_ARG_ENABLE(history, + [ --enable-history=LINES Enable scrollback history, default off.], + let HIST_SIZE=$enableval) +if test $HIST_SIZE -lt 1; then + let HIST_SIZE=1 +fi +AC_DEFINE_UNQUOTED(HIST_SIZE, $HIST_SIZE, [Number of lines in history.]) + # Restore gnu89 inline semantics on gcc 4.3 and newer saved_cflags="$CFLAGS" CFLAGS="$CFLAGS -fgnu89-inline" diff --git a/examples/Makefile.in b/examples/Makefile.in index baf09b7..a69b433 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -117,6 +117,7 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HIST_SIZE = @HIST_SIZE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/include/Makefile.in b/include/Makefile.in index ce74ba4..839ab9c 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -108,6 +108,7 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HIST_SIZE = @HIST_SIZE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/man/Makefile.in b/man/Makefile.in index 157507b..cc3d148 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -107,6 +107,7 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HIST_SIZE = @HIST_SIZE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/src/Makefile.in b/src/Makefile.in index bcbaedb..117c27c 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -138,6 +138,7 @@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GREP = @GREP@ +HIST_SIZE = @HIST_SIZE@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --git a/src/editline.c b/src/editline.c index 491b0a1..be17564 100644 --- a/src/editline.c +++ b/src/editline.c @@ -37,9 +37,9 @@ #define META(x) ((x) | 0x80) #define ISMETA(x) ((x) & 0x80) #define UNMETA(x) ((x) & 0x7F) -#if !defined(HIST_SIZE) -#define HIST_SIZE 20 -#endif /* !defined(HIST_SIZE) */ +#ifndef HIST_SIZE /* Default to one line history, i.e. disabled. */ +#define HIST_SIZE 1 +#endif #define SEPS "\"#$&'()*:;<=>?[\\]^`{|}~\n\t " /* @@ -237,7 +237,7 @@ static void tty_info(void) tty_width = tty_rows = 0; #ifdef USE_TERMCAP - bp = &buff[0]; + bp = buff; if ((term = getenv("TERM")) == NULL) term = "dumb"; if (tgetent(buff, term) < 0) {