support for newer libedit

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5063 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1998-07-02 13:08:45 +00:00
parent fc43a5b140
commit f2abe2b51f

View File

@@ -61,21 +61,34 @@ static const char* ret_prompt(EditLine *e)
static History *h; static History *h;
#ifdef H_SETSIZE
#define EL_INIT_FOUR 1
#else
#ifdef H_SETMAXSIZE
/* backwards compatibility */
#define H_SETSIZE H_SETMAXSIZE
#endif
#endif
char * char *
readline(const char* prompt) readline(const char* prompt)
{ {
static EditLine *e; static EditLine *e;
#ifdef H_SETMAXSIZE #ifdef H_SETSIZE
HistEvent ev; HistEvent ev;
#endif #endif
int count; int count;
char *ret; char *ret;
if(e == NULL){ if(e == NULL){
#ifdef EL_INIT_FOUR
e = el_init("", stdin, stdout, stderr);
#else
e = el_init("", stdin, stdout); e = el_init("", stdin, stdout);
#endif
el_set(e, EL_PROMPT, ret_prompt); el_set(e, EL_PROMPT, ret_prompt);
h = history_init(); h = history_init();
#ifdef H_SETMAXSIZE #ifdef H_SETSIZE
history(h, &ev, H_SETMAXSIZE, 25); history(h, &ev, H_SETSIZE, 25);
#else #else
history(h, H_EVENT, 25); history(h, H_EVENT, 25);
#endif #endif
@@ -95,7 +108,7 @@ readline(const char* prompt)
void void
add_history(char *p) add_history(char *p)
{ {
#ifdef H_SETMAXSIZE #ifdef H_SETSIZE
HistEvent ev; HistEvent ev;
history(h, &ev, H_ENTER, p); history(h, &ev, H_ENTER, p);
#else #else