Index: debugclient/configure.in =================================================================== RCS file: /repository/xdebug/debugclient/configure.in,v retrieving revision 1.4 diff -u -r1.4 configure.in --- configure.in 15 Nov 2004 17:52:28 -0000 1.4 +++ configure.in 17 Mar 2005 23:07:05 -0000 @@ -123,6 +123,46 @@ [ AC_DEFINE(HAVE_LIBEDIT, 1, [ ]) LIBS="-ledit $LIBS" + AC_MSG_CHECKING([for H_SETSIZE]) + AC_EGREP_HEADER([^#[[:space:]]*define[[:space:]]+H_SETSIZE], + histedit.h, + [AC_DEFINE([XDC_H_SETSIZE], H_SETSIZE, + [H_SETSIZE or H_EVENT]) + AC_MSG_RESULT([H_SETSIZE])], + [AC_DEFINE([XDC_H_SETSIZE], H_EVENT, + [H_SETSIZE or H_EVENT]) + AC_MSG_RESULT([H_EVENT])]) + AC_MSG_CHECKING([for number of arguments to el_init]) + AC_TRY_COMPILE([ +#include +#include +], [ +static EditLine *el = NULL; + +int main() +{ + el = el_init("foo", stdin, stdout, stderr); +} + ], + XDC_ELINIT_ARGS=4, + [AC_TRY_COMPILE([ +#include +#include +], [ +static EditLine *el = NULL; + +int main() +{ + el = el_init("foo", stdin, stdout); +} + ], + XDC_ELINIT_ARGS=3 + AC_DEFINE(XDC_OLD_LIBEDIT, 1, [ ]), + [AC_ERROR("you have strange libedit")] + )] + ) + AC_DEFINE_UNQUOTED([XDC_ELINIT_ARGS], $XDC_ELINIT_ARGS, [Number of arguments to el_init]) + AC_MSG_RESULT($XDC_ELINIT_ARGS) ], [ AC_ERROR("libedit was not found on your system.") Index: debugclient/main.c =================================================================== RCS file: /repository/xdebug/debugclient/main.c,v retrieving revision 1.30 diff -u -r1.30 main.c --- main.c 11 Nov 2004 16:30:12 -0000 1.30 +++ main.c 17 Mar 2005 23:07:06 -0000 @@ -58,7 +58,9 @@ static char prompt[8]; static EditLine *el = NULL; static History *hist = NULL; +#ifndef XDC_OLD_LIBEDIT static HistEvent ev; +#endif void initialize_libedit(const char *prog); void deinitialize_libedit(); @@ -73,10 +75,18 @@ hist = history_init(); /* Remember 100 events */ - history(hist, &ev, H_SETSIZE, 100); +#ifdef XDC_OLD_LIBEDIT + history(hist, XDC_H_SETSIZE, 100); +#else + history(hist, &ev, XDC_H_SETSIZE, 100); +#endif /* Initialize editline */ +#ifdef XDC_OLD_LIBEDIT + el = el_init(prog, stdin, stdout); +#else el = el_init(prog, stdin, stdout, stderr); +#endif el_set(el, EL_EDITOR, "emacs"); /* Default editor is emacs */ el_set(el, EL_SIGNAL, 1); /* Handle signals gracefully */ @@ -248,7 +258,11 @@ sprintf(prompt, "(cmd) "); if (((const char*) cmd = el_gets(el, &num)) != NULL && num != 0) { /* Add command to history */ +#ifdef XDC_OLD_LIBEDIT + history(hist, H_ENTER, cmd); +#else history(hist, &ev, H_ENTER, cmd); +#endif /* We overwrite the \n with \0 for libedit builds */ cmd[strlen(cmd) - 1] = '\0'; #else