From 7d4ccea736c1ce325de00c23dee28c61de47e638 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Wed, 25 Jul 2012 12:21:54 +0000 Subject: Enable usage of system-provided NetBSD editline library if available. This patch changes the Asterisk configure script and build system to detect the presence of the NetBSD editline library (libedit) on the system. If it is found, it will be used in preference to the version included in the Asterisk source tree. (closes issue ASTERISK-18725) Reported by: Jeffrey C. Ollie Review: https://reviewboard.asterisk.org/r/1528/ Patches: 0001-Allow-linking-building-against-an-external-editline.patch uploaded by jcollie (license #5373) (heavily modified by kpfleming) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370481 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- CHANGES | 2 + build_tools/menuselect-deps.in | 1 + configure | 161 +++++++++++++++++++++++++++++++++++++- configure.ac | 25 +++++- contrib/scripts/install_prereq | 4 +- include/asterisk/autoconfig.h.in | 3 + main/Makefile | 15 +++- main/asterisk.c | 29 ++----- main/cli.c | 2 +- main/editline/configure | 2 +- main/editline/configure.in | 2 +- main/editline/readline.c | 2 +- main/editline/readline.h | 118 ++++++++++++++++++++++++++++ main/editline/readline/readline.h | 118 ---------------------------- makeopts.in | 4 + 15 files changed, 333 insertions(+), 155 deletions(-) create mode 100644 main/editline/readline.h delete mode 100644 main/editline/readline/readline.h diff --git a/CHANGES b/CHANGES index a0fce4547..a64b38e47 100644 --- a/CHANGES +++ b/CHANGES @@ -399,6 +399,8 @@ Core CONNECTED_LINE_SEND_SUB_ARGS. For CCSS, use cc_callback_sub instead of cc_callback_macro in channel configurations. + * Asterisk can now use a system-provided NetBSD editline library (libedit) if it + is available. AGI ------------------ diff --git a/build_tools/menuselect-deps.in b/build_tools/menuselect-deps.in index e8ab91a60..6f4418b26 100644 --- a/build_tools/menuselect-deps.in +++ b/build_tools/menuselect-deps.in @@ -27,6 +27,7 @@ IXJUSER=@PBX_IXJUSER@ JACK=@PBX_JACK@ KQUEUE=@PBX_KQUEUE@ LDAP=@PBX_LDAP@ +LIBEDIT=@PBX_LIBEDIT@ LIBXML2=@PBX_LIBXML2@ LTDL=@PBX_LTDL@ LUA=@PBX_LUA@ diff --git a/configure b/configure index 2005fa01f..4933b842d 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac Revision: 369346 . +# From configure.ac Revision: 370407 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.68 for asterisk trunk. # @@ -649,6 +649,9 @@ CONFIG_NEON CONFIG_MYSQLCLIENT PBX_MISDN_FAC_ERROR PBX_MISDN_FAC_RESULT +LIBEDIT_LIBS +LIBEDIT_CFLAGS +LIBEDIT_INTERNAL ILBC_LIBS ILBC_CFLAGS ILBC_INTERNAL @@ -934,6 +937,10 @@ PBX_LIBXML2 LIBXML2_DIR LIBXML2_INCLUDE LIBXML2_LIB +PBX_LIBEDIT +LIBEDIT_DIR +LIBEDIT_INCLUDE +LIBEDIT_LIB CURL_LIB CURL_INCLUDE _libcurl_config @@ -1214,6 +1221,7 @@ with_jack with_kqueue with_ldap with_libcurl +with_libedit with_libxml2 with_ltdl with_lua @@ -1281,6 +1289,8 @@ PKG_CONFIG_PATH PKG_CONFIG_LIBDIR ILBC_CFLAGS ILBC_LIBS +LIBEDIT_CFLAGS +LIBEDIT_LIBS GMIME_CFLAGS GMIME_LIBS GTK2_CFLAGS @@ -1940,6 +1950,8 @@ Optional Packages: --with-kqueue=PATH use kqueue support files in PATH --with-ldap=PATH use OpenLDAP files in PATH --with-libcurl=DIR look for the curl library in DIR + --with-libedit=PATH use NetBSD Editline library files in PATH, use + 'internal' Editline otherwise --with-libxml2=PATH use LibXML2 files in PATH --with-ltdl=PATH use libtool files in PATH --with-lua=PATH use Lua files in PATH @@ -2006,6 +2018,10 @@ Some influential environment variables: path overriding pkg-config's built-in search path ILBC_CFLAGS C compiler flags for ILBC, overriding pkg-config ILBC_LIBS linker flags for ILBC, overriding pkg-config + LIBEDIT_CFLAGS + C compiler flags for LIBEDIT, overriding pkg-config + LIBEDIT_LIBS + linker flags for LIBEDIT, overriding pkg-config GMIME_CFLAGS C compiler flags for GMIME, overriding pkg-config GMIME_LIBS linker flags for GMIME, overriding pkg-config @@ -9213,6 +9229,38 @@ _ACEOF unset _libcurl_with + LIBEDIT_DESCRIP="NetBSD Editline library" + LIBEDIT_OPTION="libedit" + PBX_LIBEDIT=0 + +# Check whether --with-libedit was given. +if test "${with_libedit+set}" = set; then : + withval=$with_libedit; + case ${withval} in + n|no) + USE_LIBEDIT=no + # -1 is a magic value used by menuselect to know that the package + # was disabled, other than 'not found' + PBX_LIBEDIT=-1 + ;; + y|ye|yes) + ac_mandatory_list="${ac_mandatory_list} LIBEDIT" + ;; + *) + LIBEDIT_DIR="${withval}" + ac_mandatory_list="${ac_mandatory_list} LIBEDIT" + ;; + esac + +fi + + + + + + + + LIBXML2_DESCRIP="LibXML2" LIBXML2_OPTION="libxml2" PBX_LIBXML2=0 @@ -17998,8 +18046,8 @@ $as_echo "#define HAVE_ILBC 1" >>confdefs.h fi fi - if test "$PBX_ILBC" = '1'; then - ILBC_INTERNAL='no' + if test "$PBX_ILBC" = "1"; then + ILBC_INTERNAL="no" fi fi if test "${ILBC_INTERNAL}" = "yes"; then @@ -18007,6 +18055,113 @@ fi fi fi +LIBEDIT_INTERNAL="yes" + +LIBEDIT_SYSTEM="yes" +if test "${USE_LIBEDIT}" != "no"; then + if test "${LIBEDIT_DIR}" = "internal"; then + LIBEDIT_SYSTEM="no" + elif test "${LIBEDIT_DIR}" != ""; then + LIBEDIT_INTERNAL="no" + fi + if test "${LIBEDIT_SYSTEM}" = "yes"; then + + if test "x${PBX_LIBEDIT}" != "x1" -a "${USE_LIBEDIT}" != "no"; then + +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBEDIT" >&5 +$as_echo_n "checking for LIBEDIT... " >&6; } + +if test -n "$LIBEDIT_CFLAGS"; then + pkg_cv_LIBEDIT_CFLAGS="$LIBEDIT_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libedit\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libedit") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBEDIT_CFLAGS=`$PKG_CONFIG --cflags "libedit" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$LIBEDIT_LIBS"; then + pkg_cv_LIBEDIT_LIBS="$LIBEDIT_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libedit\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libedit") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_LIBEDIT_LIBS=`$PKG_CONFIG --libs "libedit" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBEDIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libedit" 2>&1` + else + LIBEDIT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libedit" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBEDIT_PKG_ERRORS" >&5 + + + PBX_LIBEDIT=0 + + +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + + PBX_LIBEDIT=0 + + +else + LIBEDIT_CFLAGS=$pkg_cv_LIBEDIT_CFLAGS + LIBEDIT_LIBS=$pkg_cv_LIBEDIT_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + + PBX_LIBEDIT=1 + LIBEDIT_INCLUDE="$LIBEDIT_CFLAGS" + LIBEDIT_LIB="$LIBEDIT_LIBS" + +$as_echo "#define HAVE_LIBEDIT 1" >>confdefs.h + + +fi + fi + + if test "$PBX_LIBEDIT" = "1"; then + LIBEDIT_INTERNAL="no" + fi + fi + if test "${LIBEDIT_INTERNAL}" = "yes"; then + PBX_LIBEDIT=1 + fi +fi + if test "x${PBX_ICONV}" != "x1" -a "${USE_ICONV}" != "no"; then pbxlibdir="" diff --git a/configure.ac b/configure.ac index 55377d318..99ed5110e 100644 --- a/configure.ac +++ b/configure.ac @@ -406,6 +406,7 @@ AST_EXT_LIB_SETUP([JACK], [Jack Audio Connection Kit], [jack]) AST_EXT_LIB_SETUP([KQUEUE], [kqueue support], [kqueue]) AST_EXT_LIB_SETUP([LDAP], [OpenLDAP], [ldap]) AST_LIBCURL_CHECK_CONFIG([], [7.10.1]) +AST_EXT_LIB_SETUP([LIBEDIT], [NetBSD Editline library], [libedit], [, use 'internal' Editline otherwise]) AST_EXT_LIB_SETUP([LIBXML2], [LibXML2], [libxml2]) AST_EXT_LIB_SETUP([LTDL], [libtool], [ltdl]) AST_EXT_LIB_SETUP([LUA], [Lua], [lua]) @@ -1262,8 +1263,8 @@ if test "${USE_ILBC}" != "no"; then fi if test "${ILBC_SYSTEM}" = "yes"; then AST_PKG_CONFIG_CHECK(ILBC, libilbc) - if test "$PBX_ILBC" = '1'; then - ILBC_INTERNAL='no' + if test "$PBX_ILBC" = "1"; then + ILBC_INTERNAL="no" fi fi if test "${ILBC_INTERNAL}" = "yes"; then @@ -1271,6 +1272,26 @@ if test "${USE_ILBC}" != "no"; then fi fi +LIBEDIT_INTERNAL="yes" +AC_SUBST(LIBEDIT_INTERNAL) +LIBEDIT_SYSTEM="yes" +if test "${USE_LIBEDIT}" != "no"; then + if test "${LIBEDIT_DIR}" = "internal"; then + LIBEDIT_SYSTEM="no" + elif test "${LIBEDIT_DIR}" != ""; then + LIBEDIT_INTERNAL="no" + fi + if test "${LIBEDIT_SYSTEM}" = "yes"; then + AST_PKG_CONFIG_CHECK(LIBEDIT, libedit) + if test "$PBX_LIBEDIT" = "1"; then + LIBEDIT_INTERNAL="no" + fi + fi + if test "${LIBEDIT_INTERNAL}" = "yes"; then + PBX_LIBEDIT=1 + fi +fi + AST_EXT_LIB_CHECK([ICONV], [iconv], [iconv_open], [iconv.h]) # GNU libiconv #define's iconv_open to libiconv_open, so we need to search for that symbol AST_EXT_LIB_CHECK([ICONV], [iconv], [libiconv_open], [iconv.h]) diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq index 609d400be..55da3ebfc 100755 --- a/contrib/scripts/install_prereq +++ b/contrib/scripts/install_prereq @@ -27,11 +27,11 @@ PACKAGES_DEBIAN="$PACKAGES_DEBIAN libcurl-dev libspeex-dev libspeexdsp-dev libog PACKAGES_DEBIAN="$PACKAGES_DEBIAN libpq-dev unixodbc-dev libsqlite0-dev libmysqlclient15-dev libneon27-dev libgmime-dev libusb-dev liblua5.1-0-dev lua5.1" PACKAGES_DEBIAN="$PACKAGES_DEBIAN libopenh323-dev libvpb-dev libgtk2.0-dev libmysqlclient-dev libbluetooth-dev libradiusclient-ng-dev freetds-dev" PACKAGES_DEBIAN="$PACKAGES_DEBIAN libsnmp-dev libiksemel-dev libcorosync-dev libnewt-dev libpopt-dev libical-dev libspandsp-dev libjack-dev" -PACKAGES_DEBIAN="$PACKAGES_DEBIAN libresample-dev libc-client-dev binutils-dev libsrtp-dev libgsm1-dev" +PACKAGES_DEBIAN="$PACKAGES_DEBIAN libresample-dev libc-client-dev binutils-dev libsrtp-dev libgsm1-dev libedit-dev" PACKAGES_RH="automake gcc gcc-c++ ncurses-devel openssl-devel libxml2-devel unixODBC-devel libcurl-devel libogg-devel libvorbis-devel speex-devel" PACKAGES_RH="$PACKAGES_RH spandsp-devel freetds-devel net-snmp-devel iksemel-devel corosynclib-devel newt-devel popt-devel libtool-ltdl-devel lua-devel" PACKAGES_RH="$PACKAGES_RH libsqlite3x-devel radiusclient-ng-devel portaudio-devel postgresql-devel libresample-devel neon-devel libical-devel" -PACKAGES_RH="$PACKAGES_RH openldap-devel gmime22-devel sqlite2-devel mysql-devel bluez-libs-devel jack-audio-connection-kit-devel gsm-devel" +PACKAGES_RH="$PACKAGES_RH openldap-devel gmime22-devel sqlite2-devel mysql-devel bluez-libs-devel jack-audio-connection-kit-devel gsm-devel libedit-devel" PACKAGES_OBSD="popt gmake wget libxml libogg libvorbis curl iksemel spandsp speex iodbc freetds-0.63p1-msdblib mysql-client gmime sqlite sqlite3 jack" diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in index 481726269..9288cce54 100644 --- a/include/asterisk/autoconfig.h.in +++ b/include/asterisk/autoconfig.h.in @@ -376,6 +376,9 @@ /* Define to 1 if you have the OpenLDAP library. */ #undef HAVE_LDAP +/* Define if your system has the LIBEDIT libraries. */ +#undef HAVE_LIBEDIT + /* Define to 1 if you have the header file. */ #undef HAVE_LIBINTL_H diff --git a/main/Makefile b/main/Makefile index 4d446f08c..0ff0deaf8 100644 --- a/main/Makefile +++ b/main/Makefile @@ -144,7 +144,14 @@ testexpr2: ast_expr2f.c ast_expr2.c ast_expr2.h $(CC) -g -o testexpr2 ast_expr2f.o ast_expr2.o -lm rm ast_expr2.o ast_expr2f.o +ifneq ($(LIBEDIT_INTERNAL),no) +LIBEDIT_OBJ=editline/libedit.a +LIBEDIT_INCLUDE=-Ieditline +endif + db.o: _ASTCFLAGS+=$(SQLITE3_INCLUDE) +asterisk.o: _ASTCFLAGS+=$(LIBEDIT_INCLUDE) +cli.o: _ASTCFLAGS+=$(LIBEDIT_INCLUDE) ifneq ($(findstring ENABLE_UPLOADS,$(MENUSELECT_CFLAGS)),) http.o: _ASTCFLAGS+=$(GMIME_INCLUDE) @@ -228,13 +235,13 @@ endif endif -$(MAIN_TGT): $(OBJS) $(ASTSSL_LIB) editline/libedit.a $(AST_EMBED_LDSCRIPTS) +$(MAIN_TGT): $(OBJS) $(ASTSSL_LIB) $(LIBEDIT_OBJ) $(AST_EMBED_LDSCRIPTS) @$(CC) -c -o buildinfo.o $(_ASTCFLAGS) buildinfo.c $(ASTCFLAGS) - $(ECHO_PREFIX) echo " [LD] $(OBJS) editline/libedit.a $(AST_EMBED_LDSCRIPTS) -> $@" + $(ECHO_PREFIX) echo " [LD] $(OBJS) $(LIBEDIT_OBJ) $(AST_EMBED_LDSCRIPTS) -> $@" ifneq ($(findstring chan_h323,$(MENUSELECT_CHANNELS)),) - $(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(OBJS) $(ASTSSL_LDLIBS) editline/libedit.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS) + $(CMD_PREFIX) $(CC) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(OBJS) $(ASTSSL_LDLIBS) $(LIBEDIT_OBJ) $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(GMIMELDFLAGS) $(LIBEDIT_LIB) else - $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $(OBJS) $(ASTSSL_LDLIBS) editline/libedit.a $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS) + $(CMD_PREFIX) $(CXX) $(STATIC_BUILD) -o $@ $(ASTLINK) $(AST_EMBED_LDFLAGS) $(_ASTLDFLAGS) $(ASTLDFLAGS) $(H323LDFLAGS) $(OBJS) $(ASTSSL_LDLIBS) $(LIBEDIT_OBJ) $(AST_EMBED_LDSCRIPTS) buildinfo.o $(AST_LIBS) $(AST_EMBED_LIBS) $(H323LDLIBS) $(GMIMELDFLAGS) $(LIBEDIT_LIB) endif ifeq ($(GNU_LD),1) diff --git a/main/asterisk.c b/main/asterisk.c index 23d6c2320..e06d70a4a 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -98,6 +98,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #endif #endif #include +#include #if defined(SOLARIS) int daemon(int, int); /* defined in libresolv of all places */ @@ -2704,7 +2705,7 @@ static char *cli_complete(EditLine *editline, int ch) int mlen = 0, maxmbuf = 2048; /* Start with a 2048 byte buffer */ if (!(mbuf = ast_malloc(maxmbuf))) { - lf->cursor[0] = savechr; + *((char *) lf->cursor) = savechr; return (char *)(CC_ERROR); } snprintf(buf, sizeof(buf), "_COMMAND MATCHESARRAY \"%s\" \"%s\"", lf->buffer, ptr); @@ -2716,7 +2717,7 @@ static char *cli_complete(EditLine *editline, int ch) /* Every step increment buffer 1024 bytes */ maxmbuf += 1024; if (!(mbuf = ast_realloc(mbuf, maxmbuf))) { - lf->cursor[0] = savechr; + *((char *) lf->cursor) = savechr; return (char *)(CC_ERROR); } } @@ -2778,7 +2779,7 @@ static char *cli_complete(EditLine *editline, int ch) ast_free(matches); } - lf->cursor[0] = savechr; + *((char *) lf->cursor) = savechr; return (char *)(long)retval; } @@ -2861,29 +2862,13 @@ static int ast_el_write_history(char *filename) static int ast_el_read_history(char *filename) { - char buf[MAX_HISTORY_COMMAND_LENGTH]; - FILE *f; - int ret = -1; + HistEvent ev; - if (el_hist == NULL || el == NULL) + if (el_hist == NULL || el == NULL) { ast_el_initialize(); - - if ((f = fopen(filename, "r")) == NULL) - return ret; - - while (!feof(f)) { - if (!fgets(buf, sizeof(buf), f)) - break; - if (!strcmp(buf, "_HiStOrY_V2_\n")) - continue; - if (ast_all_zeros(buf)) - continue; - if ((ret = ast_el_add_history(buf)) == -1) - break; } - fclose(f); - return ret; + return history(el_hist, &ev, H_LOAD, filename); } static void ast_remotecontrol(char *data) diff --git a/main/cli.c b/main/cli.c index bb20bc1fa..7f71da924 100644 --- a/main/cli.c +++ b/main/cli.c @@ -39,6 +39,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include #include #include +#include #include "asterisk/cli.h" #include "asterisk/linkedlists.h" @@ -48,7 +49,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/utils.h" #include "asterisk/app.h" #include "asterisk/lock.h" -#include "editline/readline/readline.h" #include "asterisk/threadstorage.h" #include "asterisk/translate.h" diff --git a/main/editline/configure b/main/editline/configure index b5fc6e02c..d5d0a4dea 100755 --- a/main/editline/configure +++ b/main/editline/configure @@ -2031,7 +2031,7 @@ TCSRCS="TEST/test.c" if test "x$enable_readline" = "xyes" ; then CCSRCS="$CCSRCS readline.c" - IHDRS="$IHDRS readline/readline.h" + IHDRS="$IHDRS readline.h" IHDR_LINKS="readline.h readline/history.h" HDR_DIRS="$HDR_DIRS include/readline" LIB_A_LINKS="$LIB_A_LINKS libedit.a libreadline.a" diff --git a/main/editline/configure.in b/main/editline/configure.in index db533343d..d8bc706b1 100644 --- a/main/editline/configure.in +++ b/main/editline/configure.in @@ -235,7 +235,7 @@ TCSRCS="TEST/test.c" dnl Add files to the lists if readline compatibility is enabled. if test "x$enable_readline" = "xyes" ; then CCSRCS="$CCSRCS readline.c" - IHDRS="$IHDRS readline/readline.h" + IHDRS="$IHDRS readline.h" IHDR_LINKS="readline.h readline/history.h" HDR_DIRS="$HDR_DIRS include/readline" LIB_A_LINKS="$LIB_A_LINKS libedit.a libreadline.a" diff --git a/main/editline/readline.c b/main/editline/readline.c index 77827c3f9..adf054d63 100644 --- a/main/editline/readline.c +++ b/main/editline/readline.c @@ -58,7 +58,7 @@ __RCSID("$NetBSD: readline.c,v 1.21 2002/03/18 16:20:36 christos Exp $"); #endif #include "histedit.h" -#include "readline/readline.h" +#include "readline.h" #include "el.h" #include "fcns.h" /* for EL_NUM_FCNS */ diff --git a/main/editline/readline.h b/main/editline/readline.h new file mode 100644 index 000000000..7485dde40 --- /dev/null +++ b/main/editline/readline.h @@ -0,0 +1,118 @@ +/* $NetBSD: readline.h,v 1.1 2001/01/05 21:15:50 jdolecek Exp $ */ + +/*- + * Copyright (c) 1997 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jaromir Dolecek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _READLINE_H_ +#define _READLINE_H_ + +#include + +/* list of readline stuff supported by editline library's readline wrapper */ + +/* typedefs */ +typedef int Function(const char *, int); +typedef void VFunction(void); +typedef char *CPFunction(const char *, int); +typedef char **CPPFunction(const char *, int, int); + +typedef struct _hist_entry { + const char *line; + const char *data; +} HIST_ENTRY; + +/* global variables used by readline enabled applications */ +#ifdef __cplusplus +extern "C" { +#endif +extern const char *rl_library_version; +extern char *rl_readline_name; +extern FILE *rl_instream; +extern FILE *rl_outstream; +extern char *rl_line_buffer; +extern int rl_point, rl_end; +extern int history_base, history_length; +extern int max_input_history; +extern char *rl_basic_word_break_characters; +extern char *rl_completer_word_break_characters; +extern char *rl_completer_quote_characters; +extern CPFunction *rl_completion_entry_function; +extern CPPFunction *rl_attempted_completion_function; +extern int rl_completion_type; +extern int rl_completion_query_items; +extern char *rl_special_prefixes; +extern int rl_completion_append_character; + +/* supported functions */ +char *readline(const char *); +int rl_initialize(void); + +void using_history(void); +int add_history(const char *); +void clear_history(void); +void stifle_history(int); +int unstifle_history(void); +int history_is_stifled(void); +int where_history(void); +HIST_ENTRY *current_history(void); +HIST_ENTRY *history_get(int); +int history_total_bytes(void); +int history_set_pos(int); +HIST_ENTRY *previous_history(void); +HIST_ENTRY *next_history(void); +int history_search(const char *, int); +int history_search_prefix(const char *, int); +int history_search_pos(const char *, int, int); +int read_history(const char *); +int write_history(const char *); +int history_expand(char *, char **); +char **history_tokenize(const char *); + +char *tilde_expand(char *); +char *filename_completion_function(const char *, int); +char *username_completion_function(const char *, int); +int rl_complete(int, int); +int rl_read_key(void); +char **completion_matches(const char *, CPFunction *); +void rl_display_match_list(char **, int, int); + +int rl_insert(int, int); +void rl_reset_terminal(const char *); +int rl_bind_key(int, int (*)(int, int)); +#ifdef __cplusplus +} +#endif + +#endif /* _READLINE_H_ */ diff --git a/main/editline/readline/readline.h b/main/editline/readline/readline.h deleted file mode 100644 index 7485dde40..000000000 --- a/main/editline/readline/readline.h +++ /dev/null @@ -1,118 +0,0 @@ -/* $NetBSD: readline.h,v 1.1 2001/01/05 21:15:50 jdolecek Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jaromir Dolecek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _READLINE_H_ -#define _READLINE_H_ - -#include - -/* list of readline stuff supported by editline library's readline wrapper */ - -/* typedefs */ -typedef int Function(const char *, int); -typedef void VFunction(void); -typedef char *CPFunction(const char *, int); -typedef char **CPPFunction(const char *, int, int); - -typedef struct _hist_entry { - const char *line; - const char *data; -} HIST_ENTRY; - -/* global variables used by readline enabled applications */ -#ifdef __cplusplus -extern "C" { -#endif -extern const char *rl_library_version; -extern char *rl_readline_name; -extern FILE *rl_instream; -extern FILE *rl_outstream; -extern char *rl_line_buffer; -extern int rl_point, rl_end; -extern int history_base, history_length; -extern int max_input_history; -extern char *rl_basic_word_break_characters; -extern char *rl_completer_word_break_characters; -extern char *rl_completer_quote_characters; -extern CPFunction *rl_completion_entry_function; -extern CPPFunction *rl_attempted_completion_function; -extern int rl_completion_type; -extern int rl_completion_query_items; -extern char *rl_special_prefixes; -extern int rl_completion_append_character; - -/* supported functions */ -char *readline(const char *); -int rl_initialize(void); - -void using_history(void); -int add_history(const char *); -void clear_history(void); -void stifle_history(int); -int unstifle_history(void); -int history_is_stifled(void); -int where_history(void); -HIST_ENTRY *current_history(void); -HIST_ENTRY *history_get(int); -int history_total_bytes(void); -int history_set_pos(int); -HIST_ENTRY *previous_history(void); -HIST_ENTRY *next_history(void); -int history_search(const char *, int); -int history_search_prefix(const char *, int); -int history_search_pos(const char *, int, int); -int read_history(const char *); -int write_history(const char *); -int history_expand(char *, char **); -char **history_tokenize(const char *); - -char *tilde_expand(char *); -char *filename_completion_function(const char *, int); -char *username_completion_function(const char *, int); -int rl_complete(int, int); -int rl_read_key(void); -char **completion_matches(const char *, CPFunction *); -void rl_display_match_list(char **, int, int); - -int rl_insert(int, int); -void rl_reset_terminal(const char *); -int rl_bind_key(int, int (*)(int, int)); -#ifdef __cplusplus -} -#endif - -#endif /* _READLINE_H_ */ diff --git a/makeopts.in b/makeopts.in index bcb3a5144..dd10f9b54 100644 --- a/makeopts.in +++ b/makeopts.in @@ -169,6 +169,10 @@ JACK_LIB=@JACK_LIB@ LDAP_INCLUDE=@LDAP_INCLUDE@ LDAP_LIB=@LDAP_LIB@ +LIBEDIT_INTERNAL=@LIBEDIT_INTERNAL@ +LIBEDIT_INCLUDE=@LIBEDIT_INCLUDE@ +LIBEDIT_LIB=@LIBEDIT_LIB@ + LUA_INCLUDE=@LUA_INCLUDE@ LUA_LIB=@LUA_LIB@ -- cgit v1.2.3