]> granicus.if.org Git - pdns/commitdiff
Replace readline with libedit
authorChristian Hofstaedtler <christian.hofstaedtler@deduktiva.com>
Tue, 12 Jan 2016 20:21:05 +0000 (21:21 +0100)
committerChristian Hofstaedtler <christian.hofstaedtler@deduktiva.com>
Tue, 12 Jan 2016 22:00:27 +0000 (23:00 +0100)
14 files changed:
.travis.yml
build-scripts/debian-dnsdist/control.in
configure.ac
m4/ax_lib_readline.m4 [deleted file]
m4/pdns_check_libedit.m4 [new file with mode: 0644]
m4/pdns_check_readline.m4 [deleted file]
pdns/Makefile.am
pdns/dnsdist-console.cc
pdns/dnsdist.cc
pdns/dnsdistdist/Makefile.am
pdns/dnsdistdist/configure.ac
pdns/dnsdistdist/m4/ax_lib_readline.m4 [deleted symlink]
pdns/dnsdistdist/m4/pdns_check_libedit.m4 [new symlink]
pdns/dnsdistdist/m4/pdns_check_readline.m4 [deleted symlink]

index 569ee694982c2e76b6c15048d940046a374cd060..24e271db58fa97f418ee007b80dd4f17d5799d8c 100644 (file)
@@ -23,6 +23,7 @@ before_script:
   - sudo apt-get -qq --no-install-recommends install
     libboost-all-dev
     liblua5.1-dev
+    libedit-dev
   - cd ..
   - wget https://xs.powerdns.com/tmp/libsodium_1.0.2-1_amd64.deb
   - sudo dpkg -i libsodium_1.0.2-1_amd64.deb
index 60631796142c45bfb70af9c84d403d27810b8eaa..c222bc5dbc71137f7277a5a9d0ded71d372a1bbc 100644 (file)
@@ -3,7 +3,7 @@ Section: net
 Priority: optional
 Maintainer: PowerDNS Autobuilder <powerdns.support@powerdns.com>
 Origin: PowerDNS
-Build-Depends: debhelper (>= 9), dh-systemd (>= 1.5), autotools-dev, libboost-dev, liblua5.2-dev @LIBSODIUMDEV@
+Build-Depends: debhelper (>= 9), dh-systemd (>= 1.5), autotools-dev, libboost-dev, libedit-dev, liblua5.2-dev @LIBSODIUMDEV@
 Standards-Version: 3.9.5
 Homepage: http://dnsdist.org
 
index ddb21de6749fe74e947112aa31ab1774e9f7ebe0..6f827490ee499ae29d935239f5750d604648583d 100644 (file)
@@ -112,7 +112,7 @@ AX_CHECK_OPENSSL([
        ]
 )
 
-PDNS_CHECK_READLINE
+PDNS_CHECK_LIBEDIT
 PDNS_CHECK_RAGEL
 PDNS_CHECK_LIBSODIUM
 PDNS_CHECK_CLOCK_GETTIME
diff --git a/m4/ax_lib_readline.m4 b/m4/ax_lib_readline.m4
deleted file mode 100644 (file)
index 056f25c..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-# ===========================================================================
-#      http://www.gnu.org/software/autoconf-archive/ax_lib_readline.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AX_LIB_READLINE
-#
-# DESCRIPTION
-#
-#   Searches for a readline compatible library. If found, defines
-#   `HAVE_LIBREADLINE'. If the found library has the `add_history' function,
-#   sets also `HAVE_READLINE_HISTORY'. Also checks for the locations of the
-#   necessary include files and sets `HAVE_READLINE_H' or
-#   `HAVE_READLINE_READLINE_H' and `HAVE_READLINE_HISTORY_H' or
-#   'HAVE_HISTORY_H' if the corresponding include files exists.
-#
-#   The libraries that may be readline compatible are `libedit',
-#   `libeditline' and `libreadline'. Sometimes we need to link a termcap
-#   library for readline to work, this macro tests these cases too by trying
-#   to link with `libtermcap', `libcurses' or `libncurses' before giving up.
-#
-#   Here is an example of how to use the information provided by this macro
-#   to perform the necessary includes or declarations in a C file:
-#
-#     #ifdef HAVE_LIBREADLINE
-#     #  if defined(HAVE_READLINE_READLINE_H)
-#     #    include <readline/readline.h>
-#     #  elif defined(HAVE_READLINE_H)
-#     #    include <readline.h>
-#     #  else /* !defined(HAVE_READLINE_H) */
-#     extern char *readline ();
-#     #  endif /* !defined(HAVE_READLINE_H) */
-#     char *cmdline = NULL;
-#     #else /* !defined(HAVE_READLINE_READLINE_H) */
-#       /* no readline */
-#     #endif /* HAVE_LIBREADLINE */
-#
-#     #ifdef HAVE_READLINE_HISTORY
-#     #  if defined(HAVE_READLINE_HISTORY_H)
-#     #    include <readline/history.h>
-#     #  elif defined(HAVE_HISTORY_H)
-#     #    include <history.h>
-#     #  else /* !defined(HAVE_HISTORY_H) */
-#     extern void add_history ();
-#     extern int write_history ();
-#     extern int read_history ();
-#     #  endif /* defined(HAVE_READLINE_HISTORY_H) */
-#       /* no history */
-#     #endif /* HAVE_READLINE_HISTORY */
-#
-# LICENSE
-#
-#   Copyright (c) 2008 Ville Laurikari <vl@iki.fi>
-#
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved. This file is offered as-is, without any
-#   warranty.
-
-#serial 6
-
-AU_ALIAS([VL_LIB_READLINE], [AX_LIB_READLINE])
-AC_DEFUN([AX_LIB_READLINE], [
-  AC_CACHE_CHECK([for a readline compatible library],
-                 ax_cv_lib_readline, [
-    ORIG_LIBS="$LIBS"
-    for readline_lib in readline edit editline; do
-      for termcap_lib in "" termcap curses ncurses; do
-        if test -z "$termcap_lib"; then
-          TRY_LIB="-l$readline_lib"
-        else
-          TRY_LIB="-l$readline_lib -l$termcap_lib"
-        fi
-        LIBS="$ORIG_LIBS $TRY_LIB"
-        AC_TRY_LINK_FUNC(readline, ax_cv_lib_readline="$TRY_LIB")
-        if test -n "$ax_cv_lib_readline"; then
-          break
-        fi
-      done
-      if test -n "$ax_cv_lib_readline"; then
-        break
-      fi
-    done
-    if test -z "$ax_cv_lib_readline"; then
-      ax_cv_lib_readline="no"
-    fi
-    LIBS="$ORIG_LIBS"
-  ])
-
-  if test "$ax_cv_lib_readline" != "no"; then
-    LIBS="$LIBS $ax_cv_lib_readline"
-    AC_DEFINE(HAVE_LIBREADLINE, 1,
-              [Define if you have a readline compatible library])
-    AC_CHECK_HEADERS(readline.h readline/readline.h)
-    AC_CACHE_CHECK([whether readline supports history],
-                   ax_cv_lib_readline_history, [
-      ax_cv_lib_readline_history="no"
-      AC_TRY_LINK_FUNC(add_history, ax_cv_lib_readline_history="yes")
-    ])
-    if test "$ax_cv_lib_readline_history" = "yes"; then
-      AC_DEFINE(HAVE_READLINE_HISTORY, 1,
-                [Define if your readline library has \`add_history'])
-      AC_CHECK_HEADERS(history.h readline/history.h)
-    fi
-  fi
-])dnl
diff --git a/m4/pdns_check_libedit.m4 b/m4/pdns_check_libedit.m4
new file mode 100644 (file)
index 0000000..0d42407
--- /dev/null
@@ -0,0 +1,9 @@
+AC_DEFUN([PDNS_CHECK_LIBEDIT], [
+  PKG_CHECK_MODULES(LIBEDIT, libedit, [], [
+    AS_IF([test "$1" = "mandatory"],[
+      AS_IF([test x"$LIBEDIT_LIBS" = "x"],[
+        AC_MSG_ERROR([libedit support is mandatory])
+      ])
+    ])
+  ])
+])
diff --git a/m4/pdns_check_readline.m4 b/m4/pdns_check_readline.m4
deleted file mode 100644 (file)
index ad5f975..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-AC_DEFUN([PDNS_CHECK_READLINE], [
-  OLD_LIBS="$LIBS"
-  LIBS=""
-  AX_LIB_READLINE
-  AC_SUBST([READLINE_LIBS], [$LIBS])
-  LIBS="$OLD_LIBS"
-  AS_IF([test "$1" = "mandatory"],[
-    AS_IF([test x"$READLINE_LIBS" = "x"],[
-      AC_MSG_ERROR([readline support is mandatory])
-    ])
-  ])
-])
index a3ccfafa9bbc38baf2ecedabfe48c663e174112f..c0915d9e19ff364d7ab866a971f248fcb59576e7 100644 (file)
@@ -3,7 +3,8 @@ JSON11_LIBS = -L$(top_srcdir)/ext/json11 -ljson11
 AM_CPPFLAGS += \
        -I$(top_srcdir)/ext/json11 \
        $(YAHTTP_CFLAGS) \
-       $(MBEDTLS_CFLAGS)
+       $(MBEDTLS_CFLAGS) \
+       $(LIBEDIT_CFLAGS)
 
 AM_CXXFLAGS = \
        -DSYSCONFDIR=\"$(sysconfdir)\" \
@@ -647,7 +648,7 @@ dnsdist_LDFLAGS = \
 
 dnsdist_LDADD = \
        $(LUA_LIBS) \
-       $(READLINE_LIBS) \
+       $(LIBEDIT_LIBS) \
        $(RT_LIBS) \
        $(YAHTTP_LIBS) \
        $(LIBSODIUM_LIBS)
index e5aa6e282955e5ecfed504ecd30af7dba1df5e6f..e964aeba554c7f82bc5c909903678a26da5d0439 100644 (file)
@@ -1,7 +1,7 @@
 #include "dnsdist.hh"
 #include "sodcrypto.hh"
-#include <readline/readline.h>
-#include <readline/history.h>
+#include <readline.h>
+#include <history.h>
 #include <fstream>
 #include "dolog.hh"
 
@@ -233,9 +233,10 @@ char** my_completion( const char * text , int start,  int end)
   char **matches=0;
   if (start == 0)
     matches = rl_completion_matches ((char*)text, &my_generator);
-  else
-    rl_bind_key('\t',rl_abort);
+
+  // skip default filename completion.
+  rl_attempted_completion_over = 1;
+
   return matches;
 }
 }
index 5a064ffd6ac6007eab7e4b21c1ebe4991f1ecc36..60ed5f9eb88b67517d21d3f7732475cf77dc46d9 100644 (file)
@@ -27,8 +27,8 @@
 #include <netinet/tcp.h>
 #include <limits>
 #include "dolog.hh"
-#include <readline/readline.h>
-#include <readline/history.h>
+#include <readline.h>
+#include <history.h>
 #include "dnsname.hh"
 #include "dnswriter.hh"
 #include "base64.hh"
index 68c998fe6756e4cd38108494e68832479783c5f0..d508fc0a601442eb7807bc332d2155e5ab66a849 100644 (file)
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I pdns $(LUA_CFLAGS) $(YAHTTP_CFLAGS) $(BOOST_CPPFLAGS) $(SANITIZER_FLAGS) -O3 -Wall -pthread -DSYSCONFDIR=\"${sysconfdir}\"
+AM_CPPFLAGS = -I pdns $(LUA_CFLAGS) $(LIBEDIT_CFLAGS) $(YAHTTP_CFLAGS) $(BOOST_CPPFLAGS) $(SANITIZER_FLAGS) -O3 -Wall -pthread -DSYSCONFDIR=\"${sysconfdir}\"
 
 ACLOCAL_AMFLAGS = -I m4
 
@@ -72,7 +72,7 @@ dnsdist_LDFLAGS = \
 
 dnsdist_LDADD = \
        $(LUA_LIBS) \
-       $(READLINE_LIBS) \
+       $(LIBEDIT_LIBS) \
        $(RT_LIBS) \
        $(YAHTTP_LIBS) \
        $(LIBSODIUM_LIBS) \
index 5c374224e4238669b03a39c0a18e32acd18d335c..7e30b440c5e24a5b94f1a500832c99ea521537c2 100644 (file)
@@ -7,7 +7,7 @@ AC_PROG_CC
 AC_PROG_CXX
 PDNS_CHECK_LIBSODIUM
 AC_PROG_LIBTOOL
-PDNS_CHECK_READLINE([mandatory])
+PDNS_CHECK_LIBEDIT([mandatory])
 PDNS_CHECK_CLOCK_GETTIME
 BOOST_REQUIRE([1.35])
 BOOST_FOREACH
diff --git a/pdns/dnsdistdist/m4/ax_lib_readline.m4 b/pdns/dnsdistdist/m4/ax_lib_readline.m4
deleted file mode 120000 (symlink)
index e42b3b9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../m4/ax_lib_readline.m4
\ No newline at end of file
diff --git a/pdns/dnsdistdist/m4/pdns_check_libedit.m4 b/pdns/dnsdistdist/m4/pdns_check_libedit.m4
new file mode 120000 (symlink)
index 0000000..e8ffe5e
--- /dev/null
@@ -0,0 +1 @@
+../../../m4/pdns_check_libedit.m4
\ No newline at end of file
diff --git a/pdns/dnsdistdist/m4/pdns_check_readline.m4 b/pdns/dnsdistdist/m4/pdns_check_readline.m4
deleted file mode 120000 (symlink)
index 69fca25..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../../m4/pdns_check_readline.m4
\ No newline at end of file