diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-09-07 13:50:57 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-09-08 12:00:17 -0400 |
| commit | 8860ffdc093f19a6b0fe1abd43ff782d938a2d2d (patch) | |
| tree | 0bb9148eb061ae31676426f22ed6132be8a07c6d | |
| parent | afc9534f6727f9298da4881d2e1c8279f6ca315f (diff) | |
vtysh: Add code to isolate append_history
The append_history function in lib readline appears to
not be universally available across all of the esoteric
platforms we may want to compile on. As such
provide a way to gracefully do nothing.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| -rwxr-xr-x | configure.ac | 4 | ||||
| -rw-r--r-- | vtysh/vtysh_main.c | 10 |
2 files changed, 14 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index f1ffd43f5b..055cdda957 100755 --- a/configure.ac +++ b/configure.ac @@ -1056,6 +1056,10 @@ dnl [TODO] on Linux, and in [TODO] on Solaris. if test $ac_cv_lib_readline_rl_completion_matches = no; then AC_DEFINE(rl_completion_matches,completion_matches,Old readline) fi + AC_SEARCH_LIBS([append_history], [readline], [frr_cv_append_history=yes], [frr_cv_append_history=no]) + if test "$frr_cv_append_history" = yes; then + AC_DEFINE(HAVE_APPEND_HISTORY, 1, [Have history.h append_history]) + fi ;; esac AC_SUBST(LIBREADLINE) diff --git a/vtysh/vtysh_main.c b/vtysh/vtysh_main.c index 86fa62f474..7e979f2c8f 100644 --- a/vtysh/vtysh_main.c +++ b/vtysh/vtysh_main.c @@ -30,6 +30,16 @@ #include <readline/readline.h> #include <readline/history.h> +/* + * The append_history function only appears in newer versions + * of the readline library it appears like. Since we don't + * need this just silently ignore the code on these + * ancient platforms. + */ +#if !defined HAVE_APPEND_HISTORY +#define append_history(A, B) +#endif + #include <lib/version.h> #include "getopt.h" #include "command.h" |
