Allow "readline" to be used even if "history" is unavailable...

This commit is contained in:
hpa 2001-11-14 20:51:09 +00:00
parent a9be60cae6
commit 01acb3dc7f
4 changed files with 16 additions and 7 deletions

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -71,8 +71,10 @@ static const char *rcsid UNUSED =
#include <fcntl.h>
#ifdef WITH_READLINE
#include <readline/readline.h>
#ifdef HAVE_READLINE_HISTORY_H
#include <readline/history.h>
#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)