diff --git a/config.h.in b/config.h.in index 0f8004f..fe3b3dd 100644 --- a/config.h.in +++ b/config.h.in @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Define to include ANSI arrow keys support in minix-editline */ +#undef ANSI_ARROWS + /* Define to 1 if the `closedir' function returns void instead of `int'. */ #undef CLOSEDIR_VOID diff --git a/configure b/configure index fefa824..1a42e85 100755 --- a/configure +++ b/configure @@ -1286,6 +1286,7 @@ Optional Features: --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-default-complete Enable default completion handler. + --enable-arrow-keys Enable ANSI arrow keys. Some influential environment variables: CC C compiler command @@ -5003,6 +5004,23 @@ else fi +ac_enable_arrow_keys=no +# Check whether --enable-arrow-keys was given. +if test "${enable_arrow_keys+set}" = set; then + enableval=$enable_arrow_keys; ac_enable_arrow_keys=$enableval +else + ac_enable_arrow_keys=no +fi + + +if test "x${ac_enable_arrow_keys}" = xyes ; then + +cat >>confdefs.h <<\_ACEOF +#define ANSI_ARROWS +_ACEOF + +fi + ac_config_files="$ac_config_files Makefile src/Makefile include/Makefile man/Makefile examples/Makefile" cat >confcache <<\_ACEOF @@ -6342,3 +6360,4 @@ if test "$no_create" != yes; then $ac_cs_success || { (exit 1); exit 1; } fi + diff --git a/configure.ac b/configure.ac index af1df1f..2528430 100644 --- a/configure.ac +++ b/configure.ac @@ -55,4 +55,15 @@ AC_ARG_ENABLE([default-complete], esac],[complete=false]) AM_CONDITIONAL([COMPLETE], [test x$complete = xtrue]) +ac_enable_arrow_keys=no +AC_ARG_ENABLE(arrow-keys, + [ --enable-arrow-keys Enable ANSI arrow keys.], + [ ac_enable_arrow_keys=$enableval ], [ ac_enable_arrow_keys=no]) + +if test "x${ac_enable_arrow_keys}" = xyes ; then + AC_DEFINE([ANSI_ARROWS], [], + [Define to include ANSI arrow keys support in minix-editline]) +fi + AC_OUTPUT(Makefile src/Makefile include/Makefile man/Makefile examples/Makefile) + diff --git a/src/complete.c b/src/complete.c index 4cc813f..1bb9ca7 100755 --- a/src/complete.c +++ b/src/complete.c @@ -25,15 +25,11 @@ strdup(p) ** strcmp-like sorting predicate for qsort. */ static int -compare(p1, p2) - CONST void *p1; - CONST void *p2; +compare(void *p1, void *p2) { - CONST char **v1; - CONST char **v2; + char **v1 = (char **)p1; + char **v2 = (char **)p2; - v1 = (CONST char **)p1; - v2 = (CONST char **)p2; return strcmp(*v1, *v2); }