File tftp-hpa-0.46_libedit.patch of Package tftp
Index: configure.in
===================================================================
--- configure.in.orig
+++ configure.in
@@ -268,6 +268,29 @@ PA_WITH_BOOL(ipv6, 1,
[AC_MSG_RESULT(disabled)])
+AH_TEMPLATE([WITH_EDITLINE],
+[Define if we are compiling with editline command-line editing.])
+
+PA_WITH_BOOL(editline, 1,
+[ --without-editline disable the use of readline command-line editing],
+[
+ AC_CHECK_HEADER(editline/readline.h,
+ [
+ dnl readline may need libtermcap or somesuch...
+ AC_SEARCH_LIBS(tputs, [termcap terminfo])
+
+ AC_SEARCH_LIBS(readline, [edit],
+ [
+ AC_DEFINE(WITH_EDITLINE)
+ ],
+ [],
+ [])
+ ])
+],:)
+
+TFTP_LIBS="$LIBS $XTRALIBS"
+LIBS="$common_libs"
+
AC_SUBST(SRCROOT)
AC_SUBST(OBJROOT)
Index: tftp/main.c
===================================================================
--- tftp/main.c.orig
+++ tftp/main.c
@@ -47,6 +47,9 @@
#include <readline/history.h>
#endif
#endif
+#ifdef WITH_EDITLINE
+#include <editline/readline.h>
+#endif
#include "extern.h"
@@ -88,7 +91,7 @@ int verbose;
int literal;
int connected;
const struct modes *mode;
-#ifdef WITH_READLINE
+#if defined(WITH_READLINE) || defined(WITH_EDITLINE)
char *line = NULL;
#else
char line[LBUFLEN];
@@ -346,8 +349,8 @@ int main(int argc, char *argv[])
(*c->handler) (pargc, pargv);
exit(0);
}
-#ifdef WITH_READLINE
-#ifdef HAVE_READLINE_HISTORY_H
+#if defined(WITH_READLINE) || defined(WITH_EDITLINE)
+#if defined(HAVE_READLINE_HISTORY_H) || defined(WITH_EDITLINE)
using_history();
#endif
#endif
@@ -365,7 +368,7 @@ char *hostname;
the global variable "line" */
static void getmoreargs(const char *partial, const char *mprompt)
{
-#ifdef WITH_READLINE
+#if defined(WITH_READLINE) || defined(WITH_EDITLINE)
char *eline;
int len, elen;
@@ -385,7 +388,7 @@ static void getmoreargs(const char *part
strcpy(line + len, eline);
free(eline);
-#ifdef HAVE_READLINE_HISTORY_H
+#if defined(HAVE_READLINE_HISTORY_H) || defined(WITH_EDITLINE)
add_history(line);
#endif
#else
@@ -800,7 +803,7 @@ static void command(void)
struct cmd *c;
for (;;) {
-#ifdef WITH_READLINE
+#if defined(WITH_READLINE) || defined(WITH_EDITLINE)
if (line) {
free(line);
line = NULL;
@@ -820,8 +823,8 @@ static void command(void)
#endif
if ((line[0] == 0) || (line[0] == '\n'))
continue;
-#ifdef WITH_READLINE
-#ifdef HAVE_READLINE_HISTORY_H
+#if defined(WITH_READLINE) || defined(WITH_EDITLINE)
+#if defined(HAVE_READLINE_HISTORY_H) || defined(WITH_EDITLINE)
add_history(line);
#endif
#endif
Index: config.h
===================================================================
--- config.h.orig
+++ config.h
@@ -350,7 +350,7 @@ const char *inet_ntop(int, const void *,
#include "version.h"
-#ifdef WITH_READLINE
+#if defined(WITH_READLINE) || defined(WITH_EDITLINE)
#define WITH_READLINE_STR ", with readline"
#else
#define WITH_READLINE_STR ", without readline"