[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: library/942: make build fails in usr.sbin/afs on a really cleansystem



The following reply was made to PR library/942; it has been noted by GNATS.

From: David Leonard <leonard@csee.uq.edu.au>
To: Thierry Deval <tdeval@PrimeOBJ.COM>
Cc: gnats@openbsd.org
Subject: Re: library/942: make build fails in usr.sbin/afs on a really clean
 system
Date: Mon, 15 Nov 1999 09:11:16 +1000 (EST)

 perhaps editline should be used instead of readline. this helps to
 keep gnu dependencies out.
 
 Index: sl.c
 ===================================================================
 RCS file: /occult/openbsd/cvs/src/usr.sbin/afs/src/lib/sl/sl.c,v
 retrieving revision 1.2
 diff -u -r1.2 sl.c
 --- sl.c	1999/04/30 01:59:13	1.2
 +++ sl.c	1999/11/14 23:08:58
 @@ -198,7 +198,57 @@
      }
  }
  
 -#ifdef HAVE_READLINE
 +#if defined(HAVE_EDITLINE)
 +
 +#include <histedit.h>
 +
 +static EditLine *el = NULL;
 +static History *elh = NULL;
 +static char *el_prompt = NULL;
 +
 +static char * 
 +editline_getprompt(EditLine * el)
 +{
 +	return el_prompt;
 +}
 +
 +static char *
 +readline(char *prompt)
 +{
 +	int len;
 +	char *line;
 +
 +	el_prompt = prompt;
 +
 +	if (el == NULL) {
 +		el = el_init("sl", stdin, stdout);
 +		if (el == NULL)
 +			return NULL;
 +		elh = history_init();
 +		history(elh, H_EVENT, 1000);
 +		el_set(el, EL_HIST, history, elh);
 +		el_set(el, EL_PROMPT, editline_getprompt);
 +		el_set(el, EL_SIGNAL, 1);
 +	}
 +
 +	len = 0;
 +	line = el_gets(el, &len);
 +	if (line == NULL) {
 +		printf("\n");
 +		return NULL;
 +	}
 +	if (len && line[len - 1] == '\n')
 +		line[len - 1] = '\0';
 +	return strdup(line);
 +}
 +
 +static void
 +add_history(char *line)
 +{
 +	history(elh, H_ENTER, line);
 +}
 +
 +#elif defined(HAVE_READLINE)
  
  char *readline(char *prompt);
  void add_history(char *p);