diff --git a/Makefile-minix.in b/Makefile-minix.in deleted file mode 100644 index 62f14da..0000000 --- a/Makefile-minix.in +++ /dev/null @@ -1,44 +0,0 @@ -## $Revision: 1390 $ -## -## Unix makefile for editline library. -## - - -## Set your options: -## -DANSI_ARROWS ANSI arrows keys work like emacs. -## -DHAVE_STDLIB Have . -## -DHAVE_TCGETATTR Have , . -## -DHAVE_TERMIO Have "struct termio" and -## (If neither of above two, we use and BSD ioctl's) -## -DHIDE Make static functions static (non debug). -## -DHIST_SIZE=n History size. -## -DNEED_STRDUP Don't have . -## -DUNIQUE_HISTORY Don't save command if same as last one. -## -DUSE_DIRENT Use , not ? -## -DUSE_TERMCAP Use the termcap library for terminal size -## see LDFLAGS, below, if you set this. -## -DNEED_PERROR Don't have (used in testit) -DEFS="-DANSI_ARROWS -DHAVE_STDLIB -DHAVE_TCGETATTR -DHIDE -DUSE_DIRENT \ - -DHIST_SIZE=100 -DUSE_TERMCAP -DSYS_UNIX" -#-DNEED_STRDUP - -CFLAGS="-O -D_MINIX -D_POSIX_SOURCE $DEFS -wo" -#CC1 = $(CC) $(CFLAGS) -c - -## If you have -DUSE_TERMCAP, set this as appropriate: -#LDFLAGS = -ltermlib -#LDFLAGS = -ltermcap - -## End of configuration. - -#SOURCES = editline.c complete.c sysunix.c -#LIBRARY = ../libedit.a -LIBRARIES=libedit -#OBJECTS = editline.o complete.o sysunix.o -libedit_FILES="editline.c complete.c sysunix.c" -#SHARFILES = README Makefile editline.3 editline.h unix.h editline.c \ - -TYPE=both -#include ../Makefile.inc - -#$(call ADDDEPENDENCIES,$(libedit_OBJECTS),editline.h) diff --git a/TODO b/TODO index 66f1a64..d8f5d39 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,6 @@ 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 8172766..5e4085b 100644 --- a/config.h.in +++ b/config.h.in @@ -18,6 +18,9 @@ /* Define to enable SIGSTOP (Ctrl-Z) key. */ #undef CONFIG_SIGSTOP +/* Don't save command if same as last one. */ +#undef CONFIG_UNIQUE_HISTORY + /* Define to use the termcap library for terminal size. */ #undef CONFIG_USE_TERMCAP diff --git a/configure b/configure index 8981921..6910daf 100755 --- a/configure +++ b/configure @@ -875,6 +875,7 @@ enable_sigstop enable_terminal_bell enable_termcap enable_history +enable_unique_history ' ac_precious_vars='build_alias host_alias @@ -1519,6 +1520,7 @@ Optional Features: --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-unique-history Uniqify scrollback history, i.e., don't save dupes. Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -4560,13 +4562,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:4563: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4565: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4566: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4568: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4569: output\"" >&5) + (eval echo "\"\$as_me:4571: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5772,7 +5774,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5775 "configure"' > conftest.$ac_ext + echo '#line 5777 "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7302,11 +7304,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:7305: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7307: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7309: \$? = $ac_status" >&5 + echo "$as_me:7311: \$? = $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. @@ -7641,11 +7643,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:7644: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7646: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7648: \$? = $ac_status" >&5 + echo "$as_me:7650: \$? = $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. @@ -7746,11 +7748,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:7749: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7751: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7753: \$? = $ac_status" >&5 + echo "$as_me:7755: \$? = $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 @@ -7801,11 +7803,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:7804: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7806: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7808: \$? = $ac_status" >&5 + echo "$as_me:7810: \$? = $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 @@ -10185,7 +10187,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10188 "configure" +#line 10190 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10281,7 +10283,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10284 "configure" +#line 10286 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11192,6 +11194,14 @@ cat >>confdefs.h <<_ACEOF _ACEOF +# Check whether --enable-unique-history was given. +if test "${enable_unique_history+set}" = set; then : + enableval=$enable_unique_history; +$as_echo "#define CONFIG_UNIQUE_HISTORY /**/" >>confdefs.h + +fi + + # 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 598df12..5bd3472 100644 --- a/configure.ac +++ b/configure.ac @@ -83,6 +83,10 @@ if test $HIST_SIZE -lt 1; then fi AC_DEFINE_UNQUOTED(HIST_SIZE, $HIST_SIZE, [Number of lines in history.]) +AC_ARG_ENABLE(unique-history, + [ --enable-unique-history Uniqify scrollback history, i.e., don't save dupes.], + AC_DEFINE([CONFIG_UNIQUE_HISTORY],, [Don't save command if same as last one.])) + # Restore gnu89 inline semantics on gcc 4.3 and newer saved_cflags="$CFLAGS" CFLAGS="$CFLAGS -fgnu89-inline" diff --git a/src/editline.c b/src/editline.c index 71efcd2..aa14c99 100644 --- a/src/editline.c +++ b/src/editline.c @@ -1059,9 +1059,9 @@ char *readline(const char *prompt) DISPOSE(H.Lines[--H.Size]); if (line != NULL && *line != '\0' -#if defined(UNIQUE_HISTORY) +#ifdef CONFIG_UNIQUE_HISTORY && !(H.Pos && strcmp((char *) line, (char *) H.Lines[H.Pos - 1]) == 0) -#endif /* defined(UNIQUE_HISTORY) */ +#endif && !(H.Size && strcmp((char *) line, (char *) H.Lines[H.Size - 1]) == 0) ) { hist_add(line); @@ -1081,10 +1081,10 @@ void add_history(char *p __attribute__ ((unused))) if (p == NULL || *p == '\0') return; -#if defined(UNIQUE_HISTORY) +#ifdef CONFIG_UNIQUE_HISTORY if (H.Pos && strcmp(p, (char *) H.Lines[H.Pos - 1]) == 0) return; -#endif /* defined(UNIQUE_HISTORY) */ +#endif if (H.Size && strcmp(p, (char *) H.Lines[H.Size - 1]) == 0) return; hist_add((char *)p);