diff --git a/CHANGES b/CHANGES index 3862168..b81dfd4 100644 --- a/CHANGES +++ b/CHANGES @@ -16,6 +16,9 @@ Changes in 0.26: Rewrite the man pages using standard "man" troff macros. + Enable the (limited) use of readline on systems which don't + have readline/history.h. + Changes in 0.25: Fixed Sorcerer's Apprentice bug in both the client and the diff --git a/Makefile b/Makefile index 454b7f7..f09c804 100644 --- a/Makefile +++ b/Makefile @@ -56,8 +56,7 @@ acconfig.h.in: configure.in aclocal.m4 autoheader -f configure: configure.in aclocal.m4 - rm -f MCONFIG configure config.log acconfig.h - rm -rf *.cache + rm -f MCONFIG configure config.log acconfig.h config.cache autoconf version.h: version diff --git a/configure.in b/configure.in index 64b5046..69f5a44 100644 --- a/configure.in +++ b/configure.in @@ -151,15 +151,14 @@ PA_WITH_BOOL(readline, 1, [ --without-readline disable the use of readline command-line editing], [ USE_READLINE=true - AC_CHECK_HEADER(readline/readline.h, [], [USE_READLINE=false]) - AC_CHECK_HEADER(readline/history.h, [], [USE_READLINE=false]) - if $USE_READLINE - then + AC_CHECK_HEADER(readline/readline.h, + [ AC_SEARCH_LIBS(readline, [readline history], [ AC_DEFINE(WITH_READLINE) ]) - fi + AC_CHECK_HEADERS(readline/history.h) + ]) ],:) TFTP_LIBS="$LIBS" diff --git a/tftp/main.c b/tftp/main.c index 89696a5..c0ae285 100644 --- a/tftp/main.c +++ b/tftp/main.c @@ -71,8 +71,10 @@ static const char *rcsid UNUSED = #include #ifdef WITH_READLINE #include +#ifdef HAVE_READLINE_HISTORY_H #include #endif +#endif #include "extern.h" @@ -237,7 +239,9 @@ main(int argc, char *argv[]) (void)putchar('\n'); #ifdef WITH_READLINE +#ifdef HAVE_READLINE_HISTORY_H using_history(); +#endif #endif command(); @@ -269,7 +273,9 @@ getmoreargs(const char *partial, const char *mprompt) strcpy(line, partial); strcpy(line+len, eline); +#ifdef HAVE_READLINE_HISTORY_H add_history(line); +#endif #else int len = strlen(partial); @@ -689,7 +695,9 @@ command(void) if ((line[0] == 0) || (line[0] == '\n')) continue; #ifdef WITH_READLINE +#ifdef HAVE_READLINE_HISTORY_H add_history(line); +#endif #endif makeargv(); if (margc == 0)