libedit update

Peter Avalos pavalos at theshell.com
Sat Apr 28 16:18:52 PDT 2007


Attached is a patch that syncs us up with NetBSD's libedit.  Please
review and provide feedback.  If no problems arise, I'll plan on
committing this next week.

--Peter

(Also available at http://www.theshell.com/~pavalos/wip/libedit.patch)
Index: include/histedit.h
===================================================================
RCS file: /home/dcvs/src/include/histedit.h,v
retrieving revision 1.4
diff -u -r1.4 histedit.h
--- include/histedit.h	13 Nov 2005 11:58:30 -0000	1.4
+++ include/histedit.h	28 Apr 2007 17:52:08 -0000
@@ -1,5 +1,5 @@
 /* $DragonFly: src/include/histedit.h,v 1.4 2005/11/13 11:58:30 corecode Exp $ */
-/*	$NetBSD: histedit.h,v 1.27 2005/06/12 06:58:21 christos Exp $	*/
+/*	$NetBSD: histedit.h,v 1.31 2006/12/15 22:13:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -107,7 +107,7 @@
  * Low level editline access functions
  */
 int		 el_set(EditLine *, int, ...);
-int		 el_get(EditLine *, int, void *);
+int		 el_get(EditLine *, int, ...);
 unsigned char	_el_fn_complete(EditLine *, int);
 
 /*
@@ -131,6 +131,9 @@
 #define	EL_CLIENTDATA	14	/* , void *);			*/
 #define	EL_UNBUFFERED	15	/* , int);			*/
 #define	EL_PREP_TERM    16      /* , int);                      */
+#define	EL_GETTC	17	/* , const char *, ..., NULL);	*/
+#define EL_GETFP	18	/* , int, FILE **)		*/
+#define EL_SETFP	19	/* , int, FILE *)		*/
 
 #define EL_BUILTIN_GETCFN	(NULL)
 
@@ -195,6 +198,7 @@
 #define	H_CLEAR		19	/* , void);		*/
 #define	H_SETUNIQUE	20	/* , int);		*/
 #define	H_GETUNIQUE	21	/* , void);		*/
+#define	H_DEL		22	/* , int);		*/
 
 
 /*
Index: lib/libedit/Makefile
===================================================================
RCS file: /home/dcvs/src/lib/libedit/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- lib/libedit/Makefile	13 Nov 2005 11:58:30 -0000	1.4
+++ lib/libedit/Makefile	28 Apr 2007 19:46:00 -0000
@@ -53,7 +53,7 @@
 fcns.h: ${AHDR} makelist
 	sh ${.CURDIR}/makelist -fh ${AHDR} > ${.TARGET}
 
-fcns.c: ${AHDR} fcns.h makelist
+fcns.c: ${AHDR} fcns.h help.h makelist
 	sh ${.CURDIR}/makelist -fc ${AHDR} > ${.TARGET}
 
 help.c: ${ASRC} makelist
@@ -62,7 +62,7 @@
 help.h: ${ASRC} makelist
 	sh ${.CURDIR}/makelist -bh ${ASRC} > ${.TARGET}
 
-editline.c:
+editline.c: ${OSRCS} makelist
 	sh ${.CURDIR}/makelist -e ${OSRCS} > ${.TARGET}
 
 beforedepend editline.o editline.po editline.So: \
Index: lib/libedit/chared.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/chared.c,v
retrieving revision 1.7
diff -u -r1.7 chared.c
--- lib/libedit/chared.c	13 Nov 2005 11:58:30 -0000	1.7
+++ lib/libedit/chared.c	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)chared.c 8.1 (Berkeley) 6/4/93
- * $NetBSD: chared.c,v 1.23 2005/06/01 11:37:52 lukem Exp $
+ * $NetBSD: chared.c,v 1.25 2005/08/08 01:41:30 christos Exp $
  * $DragonFly: src/lib/libedit/chared.c,v 1.7 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -42,6 +42,8 @@
 #include <stdlib.h>
 #include "el.h"
 
+private void ch__clearmacro(EditLine *);
+
 /* value to leave unused in line buffer */
 #define	EL_LEAVE	2
 
@@ -441,6 +443,8 @@
 protected int
 ch_init(EditLine *el)
 {
+	c_macro_t *ma = &el->el_chared.c_macro;
+
 	el->el_line.buffer		= (char *) el_malloc(EL_BUFSIZ);
 	if (el->el_line.buffer == NULL)
 		return (-1);
@@ -481,11 +485,10 @@
 	el->el_state.argument		= 1;
 	el->el_state.lastcmd		= ED_UNASSIGNED;
 
-	el->el_chared.c_macro.level	= -1;
-	el->el_chared.c_macro.offset	= 0;
-	el->el_chared.c_macro.macro	= (char **) el_malloc(EL_MAXMACRO *
-	    sizeof(char *));
-	if (el->el_chared.c_macro.macro == NULL)
+	ma->level	= -1;
+	ma->offset	= 0;
+	ma->macro	= (char **) el_malloc(EL_MAXMACRO * sizeof(char *));
+	if (ma->macro == NULL)
 		return (-1);
 	return (0);
 }
@@ -494,7 +497,7 @@
  *	Reset the character editor
  */
 protected void
-ch_reset(EditLine *el)
+ch_reset(EditLine *el, int mclear)
 {
 	el->el_line.cursor		= el->el_line.buffer;
 	el->el_line.lastchar		= el->el_line.buffer;
@@ -515,9 +518,19 @@
 	el->el_state.argument		= 1;
 	el->el_state.lastcmd		= ED_UNASSIGNED;
 
-	el->el_chared.c_macro.level	= -1;
-
 	el->el_history.eventno		= 0;
+
+	if (mclear)
+		ch__clearmacro(el);
+}
+
+private void
+ch__clearmacro(el)
+	EditLine *el;
+{
+	c_macro_t *ma = &el->el_chared.c_macro;
+	while (ma->level >= 0)
+		el_free((ptr_t)ma->macro[ma->level--]);
 }
 
 /* ch_enlargebufs():
@@ -625,9 +638,9 @@
 	el->el_chared.c_redo.cmd = ED_UNASSIGNED;
 	el_free((ptr_t) el->el_chared.c_kill.buf);
 	el->el_chared.c_kill.buf = NULL;
+	ch_reset(el, 1);
 	el_free((ptr_t) el->el_chared.c_macro.macro);
 	el->el_chared.c_macro.macro = NULL;
-	ch_reset(el);
 }
 
 
Index: lib/libedit/chared.h
===================================================================
RCS file: /home/dcvs/src/lib/libedit/chared.h,v
retrieving revision 1.4
diff -u -r1.4 chared.h
--- lib/libedit/chared.h	13 Nov 2005 11:58:30 -0000	1.4
+++ lib/libedit/chared.h	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)chared.h	8.1 (Berkeley) 6/4/93
- * $NetBSD: chared.h,v 1.14 2004/08/13 12:10:39 mycroft Exp $
+ * $NetBSD: chared.h,v 1.17 2006/03/06 21:11:56 christos Exp $
  * $DragonFly: src/lib/libedit/chared.h,v 1.4 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -48,7 +48,7 @@
 #define	EL_MAXMACRO	10
 
 /*
- * This is a issue of basic "vi" look-and-feel. Defining VI_MOVE works
+ * This is an issue of basic "vi" look-and-feel. Defining VI_MOVE works
  * like real vi: i.e. the transition from command<->insert modes moves
  * the cursor.
  *
@@ -116,7 +116,6 @@
 } el_chared_t;
 
 
-#define	STReof		"^D\b\b"
 #define	STRQQ		"\"\""
 
 #define	isglob(a)	(strchr("*[]?", (a)) != NULL)
@@ -161,7 +160,7 @@
 protected int	 c_hpos(EditLine *);
 
 protected int	 ch_init(EditLine *);
-protected void	 ch_reset(EditLine *);
+protected void	 ch_reset(EditLine *, int);
 protected int	 ch_enlargebufs(EditLine *, size_t);
 protected void	 ch_end(EditLine *);
 
Index: lib/libedit/common.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/common.c,v
retrieving revision 1.5
diff -u -r1.5 common.c
--- lib/libedit/common.c	13 Nov 2005 11:58:30 -0000	1.5
+++ lib/libedit/common.c	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)common.c 8.1 (Berkeley) 6/4/93
- * $NetBSD: common.c,v 1.16 2003/08/07 16:44:30 agc Exp $
+ * $NetBSD: common.c,v 1.19 2006/03/06 21:11:56 christos Exp $
  * $DragonFly: src/lib/libedit/common.c,v 1.5 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -132,7 +132,7 @@
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_delete_next_char(EditLine *el, int c __attribute__((__unused__)))
+ed_delete_next_char(EditLine *el, int c)
 {
 #ifdef notdef			/* XXX */
 #define	EL	el->el_line
@@ -149,9 +149,8 @@
 #ifdef KSHVI
 				return (CC_ERROR);
 #else
-				term_overwrite(el, STReof, 4);
-					/* then do a EOF */
-				term__flush();
+				/* then do an EOF */
+				term_writechar(el, c);
 				return (CC_EOF);
 #endif
 			} else {
@@ -611,7 +610,7 @@
 ed_start_over(EditLine *el, int c __attribute__((__unused__)))
 {
 
-	ch_reset(el);
+	ch_reset(el, 0);
 	return (CC_REFRESH);
 }
 
Index: lib/libedit/editline.3
===================================================================
RCS file: /home/dcvs/src/lib/libedit/editline.3,v
retrieving revision 1.3
diff -u -r1.3 editline.3
--- lib/libedit/editline.3	13 Nov 2005 11:58:30 -0000	1.3
+++ lib/libedit/editline.3	28 Apr 2007 17:52:08 -0000
@@ -11,11 +11,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"        This product includes software developed by the NetBSD
-.\"        Foundation, Inc. and its contributors.
-.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\" 3. Neither the name of The NetBSD Foundation nor the names of its
 .\"    contributors may be used to endorse or promote products derived
 .\"    from this software without specific prior written permission.
 .\"
@@ -31,10 +27,10 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $NetBSD: editline.3,v 1.46 2005/03/19 17:36:02 christos Exp $
+.\" $NetBSD: editline.3,v 1.55 2007/01/12 16:31:13 christos Exp $
 .\" $DragonFly: src/lib/libedit/editline.3,v 1.3 2005/11/13 11:58:30 corecode Exp $
 .\"
-.Dd March 19, 2005
+.Dd January 12, 2007
 .Os
 .Dt EDITLINE 3
 .Sh NAME
@@ -47,6 +43,7 @@
 .Nm el_push ,
 .Nm el_parse ,
 .Nm el_set ,
+.Nm el_get ,
 .Nm el_source ,
 .Nm el_resize ,
 .Nm el_line ,
@@ -82,7 +79,7 @@
 .Ft int
 .Fn el_set "EditLine *e" "int op" "..."
 .Ft int
-.Fn el_get "EditLine *e" "int op" "void *result"
+.Fn el_get "EditLine *e" "int op" "..."
 .Ft int
 .Fn el_source "EditLine *e" "const char *file"
 .Ft void
@@ -402,6 +399,25 @@
 It can be retrieved with the corresponding
 .Fn el_get
 call.
+.It Dv EL_SETFP , Fa "int fd" , Fa "FILE *fp"
+Set the current
+.Nm editline
+file pointer for
+.Dq input
+.Fa fd
+=
+.Dv 0 ,
+.Dq output
+.Fa fd
+=
+.Dv 1 ,
+or
+.Dq error
+.Fa fd
+=
+.Dv 2
+from
+.Fa fp .
 .El
 .It Fn el_get
 Get
@@ -426,15 +442,24 @@
 .Dq emacs
 or
 .Dq vi .
+.It Dv EL_GETTC , Fa "const char *name" , Fa "void *value"
+Return non-zero if
+.Fa name
+is a valid
+.Xr termcap 5
+capability
+and set
+.Fa value
+to the current value of that capability.
 .It Dv EL_SIGNAL , Fa "int *"
 Return non-zero if
 .Nm
 has installed private signal handlers (see
 .Fn el_get
 above).
-.It Dv EL_EDITMODE, Fa "int *"
+.It Dv EL_EDITMODE , Fa "int *"
 Return non-zero if editing is enabled.
-.It Dv EL_GETCFN, Fa "int (**f)(EditLine *, char *)"
+.It Dv EL_GETCFN , Fa "int (**f)(EditLine *, char *)"
 Return a pointer to the function that read characters, which is equal to
 ``EL_BUILTIN_GETCFN'' in the case of the default builtin function.
 .It Dv EL_CLIENTDATA , Fa "void **data"
@@ -443,13 +468,32 @@
 previously registered with the corresponding
 .Fn el_set
 call.
-.It Dv EL_UNBUFFERED, Fa "int"
+.It Dv EL_UNBUFFERED , Fa "int"
 Sets or clears unbuffered mode.
 In this mode,
 .Fn el_gets
 will return immediately after processing a single character.
-.It Dv EL_PREP_TERM, Fa "int"
+.It Dv EL_PREP_TERM , Fa "int"
 Sets or clears terminal editing mode.
+.It Dv EL_GETFP , Fa "int fd", Fa "FILE **fp"
+Return in
+.Fa fp
+the current
+.Nm editline
+file pointer for
+.Dq input
+.Fa fd
+=
+.Dv 0 ,
+.Dq output
+.Fa fd
+=
+.Dv 1 ,
+or
+.Dq error
+.Fa fd
+=
+.Dv 2 .
 .El
 .It Fn el_source
 Initialise
@@ -511,7 +555,7 @@
 is empty or won't fit, and 0 otherwise.
 .It Fn el_deletestr
 Delete
-.Fa num
+.Fa count
 characters before the cursor.
 .El
 .Sh HISTORY LIST FUNCTIONS
@@ -630,11 +674,19 @@
 Save the history list to
 .Fa file .
 .It Dv H_SETUNIQUE , Fa "int unique"
-Set if the adjacent identical event strings should not be entered into
-the history.
+Set flag that adjacent identical event strings should not be entered
+into the history.
 .It Dv H_GETUNIQUE
-Retrieve the current setting if if adjacent elements should be entered into
-the history.
+Retrieve the current setting if adjacent identical elements should
+be entered into the history.
+.It Dv H_DEL , Fa "int e"
+Delete the event numbered
+.Fa e .
+This function is only provided for
+.Xr readline 3
+compatibility.
+The caller is responsible for free'ing the string in the returned
+.Fa HistEvent .
 .El
 .Pp
 .Fn history
@@ -723,7 +775,8 @@
 .Xr sh 1 ,
 .Xr signal 3 ,
 .Xr termcap 3 ,
-.Xr editrc 5
+.Xr editrc 5 ,
+.Xr termcap 5
 .Sh HISTORY
 The
 .Nm
Index: lib/libedit/editrc.5
===================================================================
RCS file: /home/dcvs/src/lib/libedit/editrc.5,v
retrieving revision 1.4
diff -u -r1.4 editrc.5
--- lib/libedit/editrc.5	27 Mar 2006 16:45:43 -0000	1.4
+++ lib/libedit/editrc.5	28 Apr 2007 17:52:08 -0000
@@ -11,11 +11,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"        This product includes software developed by the NetBSD
-.\"        Foundation, Inc. and its contributors.
-.\" 4. Neither the name of The NetBSD Foundation nor the names of its
+.\" 3. Neither the name of The NetBSD Foundation nor the names of its
 .\"    contributors may be used to endorse or promote products derived
 .\"    from this software without specific prior written permission.
 .\"
@@ -31,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $NetBSD: editrc.5,v 1.19 2003/11/01 23:35:33 christos Exp $
+.\" $NetBSD: editrc.5,v 1.20 2006/08/21 12:45:30 christos Exp $
 .\" $DragonFly: src/lib/libedit/editrc.5,v 1.4 2006/03/27 16:45:43 swildner Exp $
 .\"
 .Dd October 18, 2003
Index: lib/libedit/el.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/el.c,v
retrieving revision 1.5
diff -u -r1.5 el.c
--- lib/libedit/el.c	13 Nov 2005 11:58:30 -0000	1.5
+++ lib/libedit/el.c	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)el.c     8.2 (Berkeley) 1/3/94
- * $NetBSD: el.c,v 1.39 2004/07/08 00:51:36 christos Exp $
+ * $NetBSD: el.c,v 1.44 2006/12/15 22:13:33 christos Exp $
  * $DragonFly: src/lib/libedit/el.c,v 1.5 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -60,9 +60,12 @@
 
 	memset(el, 0, sizeof(EditLine));
 
-	el->el_infd = fileno(fin);
+	el->el_infile = fin;
 	el->el_outfile = fout;
 	el->el_errfile = ferr;
+
+	el->el_infd = fileno(fin);
+
 	if ((el->el_prog = el_strdup(prog)) == NULL) {
 		el_free(el);
 		return NULL;
@@ -128,7 +131,7 @@
 {
 
 	tty_cookedmode(el);
-	ch_reset(el);		/* XXX: Do we want that? */
+	ch_reset(el, 0);		/* XXX: Do we want that? */
 }
 
 
@@ -138,29 +141,29 @@
 public int
 el_set(EditLine *el, int op, ...)
 {
-	va_list va;
+	va_list ap;
 	int rv = 0;
 
 	if (el == NULL)
 		return (-1);
-	va_start(va, op);
+	va_start(ap, op);
 
 	switch (op) {
 	case EL_PROMPT:
 	case EL_RPROMPT:
-		rv = prompt_set(el, va_arg(va, el_pfunc_t), op);
+		rv = prompt_set(el, va_arg(ap, el_pfunc_t), op);
 		break;
 
 	case EL_TERMINAL:
-		rv = term_set(el, va_arg(va, char *));
+		rv = term_set(el, va_arg(ap, char *));
 		break;
 
 	case EL_EDITOR:
-		rv = map_set_editor(el, va_arg(va, char *));
+		rv = map_set_editor(el, va_arg(ap, char *));
 		break;
 
 	case EL_SIGNAL:
-		if (va_arg(va, int))
+		if (va_arg(ap, int))
 			el->el_flags |= HANDLE_SIGNALS;
 		else
 			el->el_flags &= ~HANDLE_SIGNALS;
@@ -169,6 +172,7 @@
 	case EL_BIND:
 	case EL_TELLTC:
 	case EL_SETTC:
+	case EL_GETTC:
 	case EL_ECHOTC:
 	case EL_SETTY:
 	{
@@ -176,7 +180,7 @@
 		int i;
 
 		for (i = 1; i < 20; i++)
-			if ((argv[i] = va_arg(va, char *)) == NULL)
+			if ((argv[i] = va_arg(ap, char *)) == NULL)
 				break;
 
 		switch (op) {
@@ -215,9 +219,9 @@
 
 	case EL_ADDFN:
 	{
-		char *name = va_arg(va, char *);
-		char *help = va_arg(va, char *);
-		el_func_t func = va_arg(va, el_func_t);
+		char *name = va_arg(ap, char *);
+		char *help = va_arg(ap, char *);
+		el_func_t func = va_arg(ap, el_func_t);
 
 		rv = map_addfunc(el, name, help, func);
 		break;
@@ -225,15 +229,15 @@
 
 	case EL_HIST:
 	{
-		hist_fun_t func = va_arg(va, hist_fun_t);
-		ptr_t ptr = va_arg(va, char *);
+		hist_fun_t func = va_arg(ap, hist_fun_t);
+		ptr_t ptr = va_arg(ap, char *);
 
 		rv = hist_set(el, func, ptr);
 		break;
 	}
 
 	case EL_EDITMODE:
-		if (va_arg(va, int))
+		if (va_arg(ap, int))
 			el->el_flags &= ~EDIT_DISABLED;
 		else
 			el->el_flags |= EDIT_DISABLED;
@@ -242,17 +246,17 @@
 
 	case EL_GETCFN:
 	{
-		el_rfunc_t rc = va_arg(va, el_rfunc_t);
+		el_rfunc_t rc = va_arg(ap, el_rfunc_t);
 		rv = el_read_setfn(el, rc);
 		break;
 	}
 
 	case EL_CLIENTDATA:
-		el->el_data = va_arg(va, void *);
+		el->el_data = va_arg(ap, void *);
 		break;
 
 	case EL_UNBUFFERED:
-		rv = va_arg(va, int);
+		rv = va_arg(ap, int);
 		if (rv && !(el->el_flags & UNBUFFERED)) {
 			el->el_flags |= UNBUFFERED;
 			read_prepare(el);
@@ -264,7 +268,7 @@
 		break;
 
 	case EL_PREP_TERM:
-		rv = va_arg(va, int);
+		rv = va_arg(ap, int);
 		if (rv)
 			(void) tty_rawmode(el);
 		else
@@ -272,12 +276,39 @@
 		rv = 0;
 		break;
 
+	case EL_SETFP:
+	{
+		FILE *fp;
+		int what;
+
+		what = va_arg(ap, int);
+		fp = va_arg(ap, FILE *);
+
+		rv = 0;
+		switch (what) {
+		case 0:
+			el->el_infile = fp;
+			el->el_infd = fileno(fp);
+			break;
+		case 1:
+			el->el_outfile = fp;
+			break;
+		case 2:
+			el->el_errfile = fp;
+			break;
+		default:
+			rv = -1;
+			break;
+		}
+		break;
+	}
+
 	default:
 		rv = -1;
 		break;
 	}
 
-	va_end(va);
+	va_end(ap);
 	return (rv);
 }
 
@@ -286,90 +317,71 @@
  *	retrieve the editline parameters
  */
 public int
-el_get(EditLine *el, int op, void *ret)
+el_get(EditLine *el, int op, ...)
 {
+	va_list ap;
 	int rv;
 
-	if (el == NULL || ret == NULL)
-		return (-1);
+	if (el == NULL)
+		return -1;
+
+	va_start(ap, op);
+
 	switch (op) {
 	case EL_PROMPT:
 	case EL_RPROMPT:
-		rv = prompt_get(el, (void *) &ret, op);
+		rv = prompt_get(el, va_arg(ap, el_pfunc_t *), op);
 		break;
 
 	case EL_EDITOR:
-		rv = map_get_editor(el, (void *) &ret);
+		rv = map_get_editor(el, va_arg(ap, const char **));
 		break;
 
 	case EL_SIGNAL:
-		*((int *) ret) = (el->el_flags & HANDLE_SIGNALS);
+		*va_arg(ap, int *) = (el->el_flags & HANDLE_SIGNALS);
 		rv = 0;
 		break;
 
 	case EL_EDITMODE:
-		*((int *) ret) = (!(el->el_flags & EDIT_DISABLED));
+		*va_arg(ap, int *) = !(el->el_flags & EDIT_DISABLED);
 		rv = 0;
 		break;
 
 	case EL_TERMINAL:
-		term_get(el, (const char **)ret);
+		term_get(el, va_arg(ap, const char **));
 		rv = 0;
 		break;
 
-#if 0				/* XXX */
-	case EL_BIND:
-	case EL_TELLTC:
-	case EL_SETTC:
-	case EL_ECHOTC:
-	case EL_SETTY:
+	case EL_GETTC:
 	{
-		const char *argv[20];
+		static char name[] = "gettc";
+		char *argv[20];
 		int i;
 
  		for (i = 1; i < sizeof(argv) / sizeof(argv[0]); i++)
-			if ((argv[i] = va_arg(va, char *)) == NULL)
+			if ((argv[i] = va_arg(ap, char *)) == NULL)
 				break;
 
 		switch (op) {
-		case EL_BIND:
-			argv[0] = "bind";
-			rv = map_bind(el, i, argv);
-			break;
-
-		case EL_TELLTC:
-			argv[0] = "telltc";
-			rv = term_telltc(el, i, argv);
-			break;
-
-		case EL_SETTC:
-			argv[0] = "settc";
-			rv = term_settc(el, i, argv);
-			break;
-
-		case EL_ECHOTC:
-			argv[0] = "echotc";
-			rv = term_echotc(el, i, argv);
-			break;
-
-		case EL_SETTY:
-			argv[0] = "setty";
-			rv = tty_stty(el, i, argv);
+		case EL_GETTC:
+			argv[0] = name;
+			rv = term_gettc(el, i, argv);
 			break;
 
 		default:
 			rv = -1;
-			EL_ABORT((el->errfile, "Bad op %d\n", op));
+			EL_ABORT((el->el_errfile, "Bad op %d\n", op));
 			break;
 		}
 		break;
 	}
 
+#if 0 /* XXX */
 	case EL_ADDFN:
 	{
-		char *name = va_arg(va, char *);
-		char *help = va_arg(va, char *);
-		el_func_t func = va_arg(va, el_func_t);
+		char *name = va_arg(ap, char *);
+		char *help = va_arg(ap, char *);
+		el_func_t func = va_arg(ap, el_func_t);
 
 		rv = map_addfunc(el, name, help, func);
 		break;
@@ -377,31 +389,57 @@
 
 	case EL_HIST:
 		{
-			hist_fun_t func = va_arg(va, hist_fun_t);
-			ptr_t ptr = va_arg(va, char *);
+			hist_fun_t func = va_arg(ap, hist_fun_t);
+			ptr_t ptr = va_arg(ap, char *);
 			rv = hist_set(el, func, ptr);
 		}
 		break;
 #endif /* XXX */
 
 	case EL_GETCFN:
-		*((el_rfunc_t *)ret) = el_read_getfn(el);
+		*va_arg(ap, el_rfunc_t *) = el_read_getfn(el);
 		rv = 0;
 		break;
 
 	case EL_CLIENTDATA:
-		*((void **)ret) = el->el_data;
+		*va_arg(ap, void **) = el->el_data;
 		rv = 0;
 		break;
 
 	case EL_UNBUFFERED:
-		*((int *) ret) = (!(el->el_flags & UNBUFFERED));
+		*va_arg(ap, int *) = (!(el->el_flags & UNBUFFERED));
 		rv = 0;
 		break;
 
+	case EL_GETFP:
+	{
+		int what;
+		FILE **fpp;
+
+		what = va_arg(ap, int);
+		fpp = va_arg(ap, FILE **);
+		rv = 0;
+		switch (what) {
+		case 0:
+			*fpp = el->el_infile;
+			break;
+		case 1:
+			*fpp = el->el_outfile;
+			break;
+		case 2:
+			*fpp = el->el_errfile;
+			break;
+		default:
+			rv = -1;
+			break;
+		}
+		break;
+	}
 	default:
 		rv = -1;
+		break;
 	}
+	va_end(ap);
 
 	return (rv);
 }
Index: lib/libedit/el.h
===================================================================
RCS file: /home/dcvs/src/lib/libedit/el.h,v
retrieving revision 1.2
diff -u -r1.2 el.h
--- lib/libedit/el.h	13 Nov 2005 11:58:30 -0000	1.2
+++ lib/libedit/el.h	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)el.h	8.1 (Berkeley) 6/4/93
- * $NetBSD: el.h,v 1.16 2003/10/18 23:48:42 christos Exp $
+ * $NetBSD: el.h,v 1.17 2006/12/15 22:13:33 christos Exp $
  * $DragonFly: src/lib/libedit/el.h,v 1.2 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -110,6 +110,7 @@
 
 struct editline {
 	char		 *el_prog;	/* the program name		*/
+	FILE		 *el_infile;	/* Stdio stuff			*/
 	FILE		 *el_outfile;	/* Stdio stuff			*/
 	FILE		 *el_errfile;	/* Stdio stuff			*/
 	int		  el_infd;	/* Input file descriptor	*/
Index: lib/libedit/emacs.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/emacs.c,v
retrieving revision 1.5
diff -u -r1.5 emacs.c
--- lib/libedit/emacs.c	13 Nov 2005 11:58:30 -0000	1.5
+++ lib/libedit/emacs.c	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)emacs.c  8.1 (Berkeley) 6/4/93
- * $NetBSD: emacs.c,v 1.19 2004/10/28 21:14:52 dsl Exp $
+ * $NetBSD: emacs.c,v 1.21 2006/03/06 21:11:56 christos Exp $
  * $DragonFly: src/lib/libedit/emacs.c,v 1.5 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -47,15 +47,14 @@
  */
 protected el_action_t
 /*ARGSUSED*/
-em_delete_or_list(EditLine *el, int c __attribute__((__unused__)))
+em_delete_or_list(EditLine *el, int c)
 {
 
 	if (el->el_line.cursor == el->el_line.lastchar) {
 					/* if I'm at the end */
 		if (el->el_line.cursor == el->el_line.buffer) {
 					/* and the beginning */
-			term_overwrite(el, STReof, 4);	/* then do a EOF */
-			term__flush();
+			term_writec(el, c);	/* then do an EOF */
 			return (CC_EOF);
 		} else {
 			/*
Index: lib/libedit/filecomplete.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/filecomplete.c,v
retrieving revision 1.1
diff -u -r1.1 filecomplete.c
--- lib/libedit/filecomplete.c	13 Nov 2005 11:58:30 -0000	1.1
+++ lib/libedit/filecomplete.c	28 Apr 2007 17:52:08 -0000
@@ -13,11 +13,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the NetBSD
- *	Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * 3. Neither the name of The NetBSD Foundation nor the names of its
  *    contributors may be used to endorse or promote products derived
  *
@@ -33,7 +29,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $NetBSD: filecomplete.c,v 1.7 2005/06/11 18:18:59 christos Exp $
+ * $NetBSD: filecomplete.c,v 1.10 2006/11/09 16:58:38 christos Exp $
  * $DragonFly: src/lib/libedit/filecomplete.c,v 1.1 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -412,6 +408,7 @@
 	const char *ctemp;
 	size_t len;
 	int what_to_do = '\t';
+	int retval = CC_NORM;
 
 	if (el->el_state.lastcmd == el->el_state.thiscmd)
 		what_to_do = '?';
@@ -434,7 +431,11 @@
 		ctemp--;
 
 	len = li->cursor - ctemp;
+#if defined(__SSP__) || defined(__SSP_ALL__)
+	temp = malloc(len + 1);
+#else
 	temp = alloca(len + 1);
+#endif
 	(void)strncpy(temp, ctemp, len);
 	temp[len] = '\0';
 
@@ -452,16 +453,17 @@
 	} else
 		matches = 0;
 	if (!attempted_completion_function || 
-	    (over != NULL && *over && !matches))
+	    (over != NULL && !*over && !matches))
 		matches = completion_matches(temp, complet_func);
 
 	if (over != NULL)
 		*over = 0;
 
 	if (matches) {
-		int i, retval = CC_REFRESH;
+		int i;
 		int matches_num, maxlen, match_len, match_display=1;
 
+		retval = CC_REFRESH;
 		/*
 		 * Only replace the completed string with common part of
 		 * possible matches if there is possible completion.
@@ -533,11 +535,13 @@
 		/* free elements of array and the array itself */
 		for (i = 0; matches[i]; i++)
 			free(matches[i]);
-		free(matches), matches = NULL;
-
-		return (retval);
+		free(matches);
+		matches = NULL;
 	}
-	return (CC_NORM);
+#if defined(__SSP__) || defined(__SSP_ALL__)
+	free(temp);
+#endif
+	return retval;
 }
 
 /*
Index: lib/libedit/filecomplete.h
===================================================================
RCS file: /home/dcvs/src/lib/libedit/filecomplete.h,v
retrieving revision 1.1
diff -u -r1.1 filecomplete.h
--- lib/libedit/filecomplete.h	13 Nov 2005 11:58:30 -0000	1.1
+++ lib/libedit/filecomplete.h	28 Apr 2007 17:52:08 -0000
@@ -13,11 +13,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the NetBSD
- *	Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * 3. Neither the name of The NetBSD Foundation nor the names of its
  *    contributors may be used to endorse or promote products derived
  *    from this software without specific prior written permission.
  *
@@ -33,7 +29,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $NetBSD: filecomplete.h,v 1.4 2005/06/11 18:18:59 christos Exp $
+ * $NetBSD: filecomplete.h,v 1.5 2006/08/21 12:45:30 christos Exp $
  * $DragonFly: src/lib/libedit/filecomplete.h,v 1.1 2005/11/13 11:58:30 corecode Exp $
  */
 #ifndef _FILECOMPLETE_H_
Index: lib/libedit/history.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/history.c,v
retrieving revision 1.6
diff -u -r1.6 history.c
--- lib/libedit/history.c	13 Nov 2005 11:58:30 -0000	1.6
+++ lib/libedit/history.c	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)history.c	8.1 (Berkeley) 6/4/93
- * $NetBSD: history.c,v 1.29 2005/07/06 21:13:02 christos Exp $
+ * $NetBSD: history.c,v 1.32 2006/09/28 13:52:51 christos Exp $
  * $DragonFly: src/lib/libedit/history.c,v 1.6 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -67,6 +67,7 @@
 	history_gfun_t h_prev;	/* Get the previous element	 */
 	history_gfun_t h_curr;	/* Get the current element	 */
 	history_sfun_t h_set;	/* Set the current element	 */
+	history_sfun_t h_del;	/* Set the given element	 */
 	history_vfun_t h_clear;	/* Clear the history list	 */
 	history_efun_t h_enter;	/* Add an element		 */
 	history_efun_t h_add;	/* Append to an element		 */
@@ -81,6 +82,7 @@
 #define	HCLEAR(h, ev)		(*(h)->h_clear)((h)->h_ref, ev)
 #define	HENTER(h, ev, str)	(*(h)->h_enter)((h)->h_ref, ev, str)
 #define	HADD(h, ev, str)	(*(h)->h_add)((h)->h_ref, ev, str)
+#define	HDEL(h, ev, n)		(*(h)->h_del)((h)->h_ref, ev, n)
 
 #define	h_strdup(a)	strdup(a)
 #define	h_malloc(a)	malloc(a)
@@ -128,16 +130,18 @@
 #define H_UNIQUE	1	/* Store only unique elements	*/
 } history_t;
 
-private int history_def_first(ptr_t, HistEvent *);
-private int history_def_last(ptr_t, HistEvent *);
 private int history_def_next(ptr_t, HistEvent *);
+private int history_def_first(ptr_t, HistEvent *);
 private int history_def_prev(ptr_t, HistEvent *);
+private int history_def_last(ptr_t, HistEvent *);
 private int history_def_curr(ptr_t, HistEvent *);
-private int history_def_set(ptr_t, HistEvent *, const int n);
+private int history_def_set(ptr_t, HistEvent *, const int);
+private void history_def_clear(ptr_t, HistEvent *);
 private int history_def_enter(ptr_t, HistEvent *, const char *);
 private int history_def_add(ptr_t, HistEvent *, const char *);
+private int history_def_del(ptr_t, HistEvent *, const int);
+
 private int history_def_init(ptr_t *, HistEvent *, int);
-private void history_def_clear(ptr_t, HistEvent *);
 private int history_def_insert(history_t *, HistEvent *, const char *);
 private void history_def_delete(history_t *, HistEvent *, hentry_t *);
 
@@ -359,6 +363,24 @@
 }
 
 
+/* history_def_del():
+ *	Delete element hp of the h list
+ */
+/* ARGSUSED */
+private int
+history_def_del(ptr_t p, HistEvent *ev __attribute__((__unused__)),
+    const int num)
+{
+	history_t *h = (history_t *) p;
+	if (history_def_set(h, ev, num) != 0)
+		return (-1);
+	ev->str = strdup(h->cursor->ev.str);
+	ev->num = h->cursor->ev.num;
+	history_def_delete(h, ev, h->cursor);
+	return (0);
+}
+
+
 /* history_def_delete():
  *	Delete element hp of the h list
  */
@@ -370,6 +392,8 @@
 	HistEventPrivate *evp = (void *)&hp->ev;
 	if (hp == &h->list)
 		abort();
+	if (h->cursor == hp)
+		h->cursor = hp->prev;
 	hp->prev->next = hp->next;
 	hp->next->prev = hp->prev;
 	h_free((ptr_t) evp->str);
@@ -503,6 +527,7 @@
 	h->h_clear = history_def_clear;
 	h->h_enter = history_def_enter;
 	h->h_add = history_def_add;
+	h->h_del = history_def_del;
 
 	return (h);
 }
@@ -518,6 +543,7 @@
 
 	if (h->h_next == history_def_next)
 		history_def_clear(h->h_ref, &ev);
+	h_free(h->h_ref);
 	h_free(h);
 }
 
@@ -604,7 +630,7 @@
 	if (nh->h_first == NULL || nh->h_next == NULL || nh->h_last == NULL ||
 	    nh->h_prev == NULL || nh->h_curr == NULL || nh->h_set == NULL ||
 	    nh->h_enter == NULL || nh->h_add == NULL || nh->h_clear == NULL ||
-	    nh->h_ref == NULL) {
+	    nh->h_del == NULL || nh->h_ref == NULL) {
 		if (h->h_next != history_def_next) {
 			history_def_init(&h->h_ref, &ev, 0);
 			h->h_first = history_def_first;
@@ -616,6 +642,7 @@
 			h->h_clear = history_def_clear;
 			h->h_enter = history_def_enter;
 			h->h_add = history_def_add;
+			h->h_del = history_def_del;
 		}
 		return (-1);
 	}
@@ -632,6 +659,7 @@
 	h->h_clear = nh->h_clear;
 	h->h_enter = nh->h_enter;
 	h->h_add = nh->h_add;
+	h->h_del = nh->h_del;
 
 	return (0);
 }
@@ -848,6 +876,10 @@
 		retval = HADD(h, ev, str);
 		break;
 
+	case H_DEL:
+		retval = HDEL(h, ev, va_arg(va, const int));
+		break;
+
 	case H_ENTER:
 		str = va_arg(va, const char *);
 		if ((retval = HENTER(h, ev, str)) != -1)
@@ -932,6 +964,7 @@
 		hf.h_clear = va_arg(va, history_vfun_t);
 		hf.h_enter = va_arg(va, history_efun_t);
 		hf.h_add = va_arg(va, history_efun_t);
+		hf.h_del = va_arg(va, history_sfun_t);
 
 		if ((retval = history_set_fun(h, &hf)) == -1)
 			he_seterrev(ev, _HE_PARAM_MISSING);
Index: lib/libedit/key.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/key.c,v
retrieving revision 1.5
diff -u -r1.5 key.c
--- lib/libedit/key.c	13 Nov 2005 11:58:30 -0000	1.5
+++ lib/libedit/key.c	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)key.c	8.1 (Berkeley) 6/4/93
- * $NetBSD: key.c,v 1.16 2005/07/06 21:13:02 christos Exp $
+ * $NetBSD: key.c,v 1.19 2006/03/23 20:22:51 christos Exp $
  * $DragonFly: src/lib/libedit/key.c,v 1.5 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -41,7 +41,7 @@
  *	  the extended-key map.
  *
  *      An extended-key (key) is a sequence of keystrokes introduced
- *	with an sequence introducer and consisting of an arbitrary
+ *	with a sequence introducer and consisting of an arbitrary
  *	number of characters.  This module maintains a map (the el->el_key.map)
  *	to convert these extended-key sequences into input strs
  *	(XK_STR), editor functions (XK_CMD), or unix commands (XK_EXE).
@@ -86,7 +86,6 @@
 private int		 node_lookup(EditLine *, const char *, key_node_t *,
     int);
 private int		 node_enum(EditLine *, key_node_t *, int);
-private int		 key__decode_char(char *, int, int);
 
 #define	KEY_BUFSIZ	EL_BUFSIZ
 
@@ -444,7 +443,7 @@
 
 
 /* node__get():
- *	Returns pointer to an key_node_t for ch.
+ *	Returns pointer to a key_node_t for ch.
  */
 private key_node_t *
 node__get(int ch)
@@ -492,7 +491,7 @@
 		/* If match put this char into el->el_key.buf.  Recurse */
 		if (ptr->ch == *str) {
 			/* match found */
-			ncnt = key__decode_char(el->el_key.buf, cnt,
+			ncnt = key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt,
 			    (unsigned char) ptr->ch);
 			if (ptr->next != NULL)
 				/* not yet at leaf */
@@ -546,7 +545,8 @@
 		return (-1);
 	}
 	/* put this char at end of str */
-	ncnt = key__decode_char(el->el_key.buf, cnt, (unsigned char) ptr->ch);
+	ncnt = key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt,
+	    (unsigned char)ptr->ch);
 	if (ptr->next == NULL) {
 		/* print this key and function */
 		el->el_key.buf[ncnt + 1] = '"';
@@ -577,9 +577,10 @@
 		switch (ntype) {
 		case XK_STR:
 		case XK_EXE:
-			(void) fprintf(el->el_outfile, fmt, key,
-			    key__decode_str(val->str, unparsbuf,
-				ntype == XK_STR ? "\"\"" : "[]"));
+			(void) key__decode_str(val->str, unparsbuf,
+			    sizeof(unparsbuf), 
+			    ntype == XK_STR ? "\"\"" : "[]");
+			(void) fprintf(el->el_outfile, fmt, key, unparsbuf);
 			break;
 		case XK_CMD:
 			for (fp = el->el_map.help; fp->name; fp++)
@@ -604,83 +605,97 @@
 }
 
 
+#define ADDC(c) \
+	if (b < eb) \
+		*b++ = c; \
+	else \
+		b++
 /* key__decode_char():
  *	Put a printable form of char in buf.
  */
-private int
-key__decode_char(char *buf, int cnt, int ch)
+protected int
+key__decode_char(char *buf, int cnt, int off, int ch)
 {
+	char *sb = buf + off;
+	char *eb = buf + cnt;
+	char *b = sb;
 	if (ch == 0) {
-		buf[cnt++] = '^';
-		buf[cnt] = '@';
-		return (cnt);
+		ADDC('^');
+		ADDC('@');
+		return b - sb;
 	}
 	if (iscntrl(ch)) {
-		buf[cnt++] = '^';
+		ADDC('^');
 		if (ch == '\177')
-			buf[cnt] = '?';
+			ADDC('?');
 		else
-			buf[cnt] = ch | 0100;
+			ADDC(ch | 0100);
 	} else if (ch == '^') {
-		buf[cnt++] = '\\';
-		buf[cnt] = '^';
+		ADDC('\\');
+		ADDC('^');
 	} else if (ch == '\\') {
-		buf[cnt++] = '\\';
-		buf[cnt] = '\\';
+		ADDC('\\');
+		ADDC('\\');
 	} else if (ch == ' ' || (isprint(ch) && !isspace(ch))) {
-		buf[cnt] = ch;
+		ADDC(ch);
 	} else {
-		buf[cnt++] = '\\';
-		buf[cnt++] = (((unsigned int) ch >> 6) & 7) + '0';
-		buf[cnt++] = (((unsigned int) ch >> 3) & 7) + '0';
-		buf[cnt] = (ch & 7) + '0';
+		ADDC('\\');
+		ADDC((((unsigned int) ch >> 6) & 7) + '0');
+		ADDC((((unsigned int) ch >> 3) & 7) + '0');
+		ADDC((ch & 7) + '0');
 	}
-	return (cnt);
+	return b - sb;
 }
 
 
 /* key__decode_str():
  *	Make a printable version of the ey
  */
-protected char *
-key__decode_str(const char *str, char *buf, const char *sep)
+protected int
+key__decode_str(const char *str, char *buf, int len, const char *sep)
 {
-	char *b;
+	char *b = buf, *eb = b + len;
 	const char *p;
 
 	b = buf;
-	if (sep[0] != '\0')
-		*b++ = sep[0];
-	if (*str == 0) {
-		*b++ = '^';
-		*b++ = '@';
-		if (sep[0] != '\0' && sep[1] != '\0')
-			*b++ = sep[1];
-		*b++ = 0;
-		return (buf);
+	if (sep[0] != '\0') {
+		ADDC(sep[0]);
+	}
+	if (*str == '\0') {
+		ADDC('^');
+		ADDC('@');
+		if (sep[0] != '\0' && sep[1] != '\0') {
+			ADDC(sep[1]);
+		}
+		goto done;
 	}
 	for (p = str; *p != 0; p++) {
 		if (iscntrl((unsigned char) *p)) {
-			*b++ = '^';
-			if (*p == '\177')
-				*b++ = '?';
-			else
-				*b++ = *p | 0100;
+			ADDC('^');
+			if (*p == '\177') {
+				ADDC('?');
+			} else {
+				ADDC(*p | 0100);
+			}
 		} else if (*p == '^' || *p == '\\') {
-			*b++ = '\\';
-			*b++ = *p;
+			ADDC('\\');
+			ADDC(*p);
 		} else if (*p == ' ' || (isprint((unsigned char) *p) &&
 			!isspace((unsigned char) *p))) {
-			*b++ = *p;
+			ADDC(*p);
 		} else {
-			*b++ = '\\';
-			*b++ = (((unsigned int) *p >> 6) & 7) + '0';
-			*b++ = (((unsigned int) *p >> 3) & 7) + '0';
-			*b++ = (*p & 7) + '0';
+			ADDC('\\');
+			ADDC((((unsigned int) *p >> 6) & 7) + '0');
+			ADDC((((unsigned int) *p >> 3) & 7) + '0');
+			ADDC((*p & 7) + '0');
 		}
 	}
-	if (sep[0] != '\0' && sep[1] != '\0')
-		*b++ = sep[1];
-	*b++ = 0;
-	return (buf);		/* should check for overflow */
+	if (sep[0] != '\0' && sep[1] != '\0') {
+		ADDC(sep[1]);
+	}
+done:
+	ADDC('\0');
+	if (b - buf >= len)
+	    buf[len - 1] = '\0';
+	return b - buf;
 }
Index: lib/libedit/key.h
===================================================================
RCS file: /home/dcvs/src/lib/libedit/key.h,v
retrieving revision 1.4
diff -u -r1.4 key.h
--- lib/libedit/key.h	13 Nov 2005 11:58:30 -0000	1.4
+++ lib/libedit/key.h	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)key.h	8.1 (Berkeley) 6/4/93
- * $NetBSD: key.h,v 1.8 2003/08/07 16:44:32 agc Exp $
+ * $NetBSD: key.h,v 1.10 2006/03/23 20:22:51 christos Exp $
  * $DragonFly: src/lib/libedit/key.h,v 1.4 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -74,6 +74,8 @@
 protected void		 key_print(EditLine *, const char *);
 protected void	         key_kprint(EditLine *, const char *, key_value_t *,
     int);
-protected char		*key__decode_str(const char *, char *, const char *);
+protected int		 key__decode_str(const char *, char *, int,
+    const char *);
+protected int		 key__decode_char(char *, int, int, int);
 
 #endif /* _h_el_key */
Index: lib/libedit/makelist
===================================================================
RCS file: /home/dcvs/src/lib/libedit/makelist,v
retrieving revision 1.4
diff -u -r1.4 makelist
--- lib/libedit/makelist	13 Nov 2005 11:58:30 -0000	1.4
+++ lib/libedit/makelist	28 Apr 2007 17:52:08 -0000
@@ -31,7 +31,7 @@
 # SUCH DAMAGE.
 #
 # @(#)makelist	5.3 (Berkeley) 6/4/93
-# $NetBSD: makelist,v 1.9 2005/05/16 13:14:43 lukem Exp $
+# $NetBSD: makelist,v 1.11 2005/10/22 16:45:03 christos Exp $
 # $DragonFly: src/lib/libedit/makelist,v 1.4 2005/11/13 11:58:30 corecode Exp $
 
 # makelist.sh: Automatically generate header files...
@@ -119,7 +119,6 @@
 	    }
 	}
 	END {
-	    printf("    { NULL, 0, NULL }\n");
 	    printf("};\n");
 	    printf("\nprotected const el_bindings_t* help__get()");
 	    printf("{ return el_func_help; }\n");
@@ -142,7 +141,7 @@
 #
 -fh)
     cat $FILES | $AWK '/el_action_t/ { print $3 }' | \
-    sort | tr '[a-z]' '[A-Z]' | $AWK '
+    sort | tr '[:lower:]' '[:upper:]' | $AWK '
 	BEGIN {
 	    printf("/* Automatically generated file, do not edit */\n");
 	    printf("#ifndef _h_fcns_c\n#define _h_fcns_c\n");
Index: lib/libedit/map.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/map.c,v
retrieving revision 1.6
diff -u -r1.6 map.c
--- lib/libedit/map.c	13 Nov 2005 11:58:30 -0000	1.6
+++ lib/libedit/map.c	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)map.c	8.1 (Berkeley) 6/4/93
- * $NetBSD: map.c,v 1.20 2004/08/13 12:10:39 mycroft Exp $
+ * $NetBSD: map.c,v 1.24 2006/04/09 01:36:51 christos Exp $
  * $DragonFly: src/lib/libedit/map.c,v 1.6 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -1120,11 +1120,12 @@
 map_print_key(EditLine *el, el_action_t *map, const char *in)
 {
 	char outbuf[EL_BUFSIZ];
-	el_bindings_t *bp;
+	el_bindings_t *bp, *ep;
 
 	if (in[0] == '\0' || in[1] == '\0') {
-		(void) key__decode_str(in, outbuf, "");
-		for (bp = el->el_map.help; bp->name != NULL; bp++)
+		(void) key__decode_str(in, outbuf, sizeof(outbuf), "");
+		ep = &el->el_map.help[el->el_map.nfunc];
+		for (bp = el->el_map.help; bp < ep; bp++)
 			if (bp->func == map[(unsigned char) *in]) {
 				(void) fprintf(el->el_outfile,
 				    "%s\t->\t%s\n", outbuf, bp->name);
@@ -1141,7 +1142,7 @@
 private void
 map_print_some_keys(EditLine *el, el_action_t *map, int first, int last)
 {
-	el_bindings_t *bp;
+	el_bindings_t *bp, *ep;
 	char firstbuf[2], lastbuf[2];
 	char unparsbuf[EL_BUFSIZ], extrabuf[EL_BUFSIZ];
 
@@ -1150,39 +1151,47 @@
 	lastbuf[0] = last;
 	lastbuf[1] = 0;
 	if (map[first] == ED_UNASSIGNED) {
-		if (first == last)
+		if (first == last) {
+			(void) key__decode_str(firstbuf, unparsbuf, 
+			    sizeof(unparsbuf), STRQQ);
 			(void) fprintf(el->el_outfile,
-			    "%-15s->  is undefined\n",
-			    key__decode_str(firstbuf, unparsbuf, STRQQ));
+			    "%-15s->  is undefined\n", unparsbuf);
+		}
 		return;
 	}
-	for (bp = el->el_map.help; bp->name != NULL; bp++) {
+	ep = &el->el_map.help[el->el_map.nfunc];
+	for (bp = el->el_map.help; bp < ep; bp++) {
 		if (bp->func == map[first]) {
 			if (first == last) {
+				(void) key__decode_str(firstbuf, unparsbuf, 
+				    sizeof(unparsbuf), STRQQ);
 				(void) fprintf(el->el_outfile, "%-15s->  %s\n",
-				    key__decode_str(firstbuf, unparsbuf, STRQQ),
-				    bp->name);
+				    unparsbuf, bp->name);
 			} else {
+				(void) key__decode_str(firstbuf, unparsbuf, 
+				    sizeof(unparsbuf), STRQQ);
+				(void) key__decode_str(lastbuf, extrabuf, 
+				    sizeof(extrabuf), STRQQ);
 				(void) fprintf(el->el_outfile,
 				    "%-4s to %-7s->  %s\n",
-				    key__decode_str(firstbuf, unparsbuf, STRQQ),
-				    key__decode_str(lastbuf, extrabuf, STRQQ),
-				    bp->name);
+				    unparsbuf, extrabuf, bp->name);
 			}
 			return;
 		}
 	}
 #ifdef MAP_DEBUG
 	if (map == el->el_map.key) {
+		(void) key__decode_str(firstbuf, unparsbuf, 
+		    sizeof(unparsbuf), STRQQ);
 		(void) fprintf(el->el_outfile,
-		    "BUG!!! %s isn't bound to anything.\n",
-		    key__decode_str(firstbuf, unparsbuf, STRQQ));
+		    "BUG!!! %s isn't bound to anything.\n", unparsbuf);
 		(void) fprintf(el->el_outfile, "el->el_map.key[%d] == %d\n",
 		    first, el->el_map.key[first]);
 	} else {
+		(void) key__decode_str(firstbuf, unparsbuf, 
+		    sizeof(unparsbuf), STRQQ);
 		(void) fprintf(el->el_outfile,
-		    "BUG!!! %s isn't bound to anything.\n",
-		    key__decode_str(firstbuf, unparsbuf, STRQQ));
+		    "BUG!!! %s isn't bound to anything.\n", unparsbuf);
 		(void) fprintf(el->el_outfile, "el->el_map.alt[%d] == %d\n",
 		    first, el->el_map.alt[first]);
 	}
@@ -1239,7 +1248,7 @@
 	char outbuf[EL_BUFSIZ];
 	const char *in = NULL;
 	char *out = NULL;
-	el_bindings_t *bp;
+	el_bindings_t *bp, *ep;
 	int cmd;
 	int key;
 
@@ -1281,8 +1290,8 @@
 				return (0);
 
 			case 'l':
-				for (bp = el->el_map.help; bp->name != NULL;
-				    bp++)
+				ep = &el->el_map.help[el->el_map.nfunc];
+				for (bp = el->el_map.help; bp < ep; bp++)
 					(void) fprintf(el->el_outfile,
 					    "%s\n\t%s\n",
 					    bp->name, bp->description);
@@ -1369,7 +1378,7 @@
 		break;
 
 	default:
-		EL_ABORT((el->el_errfile, "Bad XK_ type\n", ntype));
+		EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype));
 		break;
 	}
 	return (0);
@@ -1383,7 +1392,7 @@
 map_addfunc(EditLine *el, const char *name, const char *help, el_func_t func)
 {
 	void *p;
-	int nf = el->el_map.nfunc + 2;
+	int nf = el->el_map.nfunc + 1;
 
 	if (name == NULL || help == NULL || func == NULL)
 		return (-1);
@@ -1402,7 +1411,6 @@
 	el->el_map.help[nf].name = name;
 	el->el_map.help[nf].func = nf;
 	el->el_map.help[nf].description = help;
-	el->el_map.help[++nf].name = NULL;
 	el->el_map.nfunc++;
 
 	return (0);
Index: lib/libedit/read.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/read.c,v
retrieving revision 1.4
diff -u -r1.4 read.c
--- lib/libedit/read.c	13 Nov 2005 11:58:30 -0000	1.4
+++ lib/libedit/read.c	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)read.c	8.1 (Berkeley) 6/4/93
- * $NetBSD: read.c,v 1.36 2005/06/01 11:37:52 lukem Exp $
+ * $NetBSD: read.c,v 1.40 2007/03/01 21:41:45 christos Exp $
  * $DragonFly: src/lib/libedit/read.c,v 1.4 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -52,6 +52,7 @@
 private int	read_preread(EditLine *);
 private int	read_char(EditLine *, char *);
 private int	read_getcmd(EditLine *, el_action_t *, char *);
+private void	read_pop(c_macro_t *);
 
 /* read_init():
  *	Initialize the read stuff
@@ -296,6 +297,19 @@
 	return (num_read);
 }
 
+/* read_pop():
+ *	Pop a macro from the stack
+ */
+private void
+read_pop(c_macro_t *ma)
+{
+	int i;
+
+	el_free(ma->macro[0]);
+	for (i = ma->level--; i > 0; i--)
+		ma->macro[i - 1] = ma->macro[i];
+	ma->offset = 0;
+}
 
 /* el_getc():
  *	Read a character
@@ -312,20 +326,22 @@
 			if (!read_preread(el))
 				break;
 		}
+
 		if (ma->level < 0)
 			break;
 
-		if (ma->macro[ma->level][ma->offset] == '\0') {
-			el_free(ma->macro[ma->level--]);
-			ma->offset = 0;
+		if (ma->macro[0][ma->offset] == '\0') {
+			read_pop(ma);
 			continue;
 		}
-		*cp = ma->macro[ma->level][ma->offset++] & 0377;
-		if (ma->macro[ma->level][ma->offset] == '\0') {
+
+		*cp = ma->macro[0][ma->offset++] & 0377;
+
+		if (ma->macro[0][ma->offset] == '\0') {
 			/* Needed for QuoteMode On */
-			el_free(ma->macro[ma->level--]);
-			ma->offset = 0;
+			read_pop(ma);
 		}
+
 		return (1);
 	}
 
@@ -359,7 +375,7 @@
 	   we have the wrong size. */
 	el_resize(el);
 	re_clear_display(el);	/* reset the display stuff */
-	ch_reset(el);
+	ch_reset(el, 0);
 	re_refresh(el);		/* print the prompt */
 
 	if (el->el_flags & UNBUFFERED)
@@ -572,7 +588,7 @@
 #endif /* DEBUG_READ */
 			/* put (real) cursor in a known place */
 			re_clear_display(el);	/* reset the display stuff */
-			ch_reset(el);	/* reset the input pointers */
+			ch_reset(el, 1);	/* reset the input pointers */
 			re_refresh(el);	/* print the prompt again */
 			break;
 
Index: lib/libedit/read.h
===================================================================
RCS file: /home/dcvs/src/lib/libedit/read.h,v
retrieving revision 1.1
diff -u -r1.1 read.h
--- lib/libedit/read.h	13 Nov 2005 11:58:30 -0000	1.1
+++ lib/libedit/read.h	28 Apr 2007 17:52:08 -0000
@@ -13,11 +13,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *        This product includes software developed by the NetBSD
- *        Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * 3. Neither the name of The NetBSD Foundation nor the names of its
  *    contributors may be used to endorse or promote products derived
  *    from this software without specific prior written permission.
  *
@@ -33,7 +29,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $NetBSD: read.h,v 1.4 2004/02/27 14:52:18 christos Exp $
+ * $NetBSD: read.h,v 1.5 2006/08/21 12:45:30 christos Exp $
  * $DragonFly: src/lib/libedit/read.h,v 1.1 2005/11/13 11:58:30 corecode Exp $
  */
 
Index: lib/libedit/readline.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/readline.c,v
retrieving revision 1.1
diff -u -r1.1 readline.c
--- lib/libedit/readline.c	13 Nov 2005 11:58:30 -0000	1.1
+++ lib/libedit/readline.c	28 Apr 2007 17:52:08 -0000
@@ -13,11 +13,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the NetBSD
- *	Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * 3. Neither the name of The NetBSD Foundation nor the names of its
  *    contributors may be used to endorse or promote products derived
  *    from this software without specific prior written permission.
  *
@@ -33,7 +29,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $NetBSD: readline.c,v 1.57 2005/06/11 18:18:59 christos Exp $
+ * $NetBSD: readline.c,v 1.70 2006/11/24 00:01:17 christos Exp $
  * $DragonFly: src/lib/libedit/readline.c,v 1.1 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -51,6 +47,7 @@
 #include <limits.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <setjmp.h>
 #ifdef HAVE_VIS_H
 #include <vis.h>
 #else
@@ -65,6 +62,9 @@
 #include "readline/readline.h"
 #include "filecomplete.h"
 
+void rl_prep_terminal(int);
+void rl_deprep_terminal(void);
+
 /* for rl_complete() */
 #define TAB		'\r'
 
@@ -87,6 +87,9 @@
 VCPFunction *rl_linefunc = NULL;
 int rl_done = 0;
 VFunction *rl_event_hook = NULL;
+KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
+    emacs_meta_keymap,
+    emacs_ctlx_keymap;
 
 int history_base = 1;		/* probably never subject to change */
 int history_length = 0;
@@ -112,11 +115,13 @@
 int rl_filename_completion_desired = 0;
 int rl_ignore_completion_duplicates = 0;
 int rl_catch_signals = 1;
+int readline_echoing_p = 1;
+int _rl_print_completions_horizontally = 0;
 VFunction *rl_redisplay_function = NULL;
 Function *rl_startup_hook = NULL;
 VFunction *rl_completion_display_matches_hook = NULL;
-VFunction *rl_prep_term_function = NULL;
-VFunction *rl_deprep_term_function = NULL;
+VFunction *rl_prep_term_function = (VFunction *)rl_prep_terminal;
+VFunction *rl_deprep_term_function = (VFunction *)rl_deprep_terminal;
 
 /*
  * The current prompt string.
@@ -153,11 +158,13 @@
 static History *h = NULL;
 static EditLine *e = NULL;
 static Function *map[256];
+static jmp_buf topbuf;
 
 /* internal functions */
 static unsigned char	 _el_rl_complete(EditLine *, int);
 static unsigned char	 _el_rl_tstp(EditLine *, int);
 static char		*_get_prompt(EditLine *);
+static int		 _getc_function(EditLine *, char *);
 static HIST_ENTRY	*_move_history(int);
 static int		 _history_expand_command(const char *, size_t, size_t,
     char **);
@@ -196,6 +203,23 @@
 
 
 /*
+ * read one key from user defined input function
+ */
+static int
+/*ARGSUSED*/
+_getc_function(EditLine *el, char *c)
+{
+	int i;
+
+	i = (*rl_getc_function)(NULL, 0);
+	if (i == -1)
+		return 0;
+	*c = i;
+	return 1;
+}
+
+
+/*
  * READLINE compatibility stuff
  */
 
@@ -240,6 +264,10 @@
 	max_input_history = INT_MAX;
 	el_set(e, EL_HIST, history, h);
 
+	/* setup getc function if valid */
+	if (rl_getc_function)
+		el_set(e, EL_GETCFN, _getc_function);
+
 	/* for proper prompt printing in readline() */
 	rl_prompt = strdup("");
 	if (rl_prompt == NULL) {
@@ -299,9 +327,10 @@
  * trailing newline (if there is any)
  */
 char *
-readline(const char *prompt)
+readline(const char *p)
 {
 	HistEvent ev;
+	const char * volatile prompt = p;
 	int count;
 	const char *ret;
 	char *buf;
@@ -312,6 +341,8 @@
 
 	rl_done = 0;
 
+	(void)setjmp(topbuf);
+
 	/* update prompt accordingly to what has been passed */
 	if (!prompt)
 		prompt = "";
@@ -704,6 +735,7 @@
 				what = realloc(from, size);
 				if (what == NULL) {
 					free(from);
+					free(tmp);
 					return 0;
 				}
 				len = 0;
@@ -716,6 +748,7 @@
 								(size <<= 1));
 						if (nwhat == NULL) {
 							free(what);
+							free(tmp);
 							return 0;
 						}
 						what = nwhat;
@@ -728,10 +761,13 @@
 					free(what);
 					if (search) {
 						from = strdup(search);
-						if (from == NULL)
+						if (from == NULL) {
+							free(tmp);
 							return 0;
+						}
 					} else {
 						from = NULL;
 						return (-1);
 					}
 				}
@@ -743,6 +779,7 @@
 				with = realloc(to, size);
 				if (with == NULL) {
 					free(to);
+					free(tmp);
 					return -1;
 				}
 				len = 0;
@@ -754,6 +791,7 @@
 						nwith = realloc(with, size);
 						if (nwith == NULL) {
 							free(with);
+							free(tmp);
 							return -1;
 						}
 						with = nwith;
@@ -822,12 +860,14 @@
 			return 0;
 	}
 
-#define ADD_STRING(what, len)						\
+#define ADD_STRING(what, len, fr)					\
 	{								\
 		if (idx + len + 1 > size) {				\
 			char *nresult = realloc(result, (size += len + 1));\
 			if (nresult == NULL) {				\
 				free(*output);				\
+				if (/*CONSTCOND*/fr)			\
+					free(tmp);			\
 				return 0;				\
 			}						\
 			result = nresult;				\
@@ -839,6 +879,7 @@
 
 	result = NULL;
 	size = idx = 0;
+	tmp = NULL;
 	for (i = 0; str[i];) {
 		int qchar, loop_again;
 		size_t len, start, j;
@@ -876,13 +917,11 @@
 			goto loop;
 		}
 		len = i - start;
-		tmp = &str[start];
-		ADD_STRING(tmp, len);
+		ADD_STRING(&str[start], len, 0);
 
 		if (str[i] == '\0' || str[i] != history_expansion_char) {
 			len = j - i;
-			tmp = &str[i];
-			ADD_STRING(tmp, len);
+			ADD_STRING(&str[i], len, 0);
 			if (start == 0)
 				ret = 0;
 			else
@@ -892,8 +931,11 @@
 		ret = _history_expand_command (str, i, (j - i), &tmp);
 		if (ret > 0 && tmp) {
 			len = strlen(tmp);
-			ADD_STRING(tmp, len);
+			ADD_STRING(tmp, len, 1);
+		}
+		if (tmp) {
 			free(tmp);
+			tmp = NULL;
 		}
 		i = j;
 	}
@@ -1081,7 +1123,7 @@
 
 	if (h == NULL || e == NULL)
 		rl_initialize();
-	return (history(h, &ev, H_LOAD, filename));
+	return (history(h, &ev, H_LOAD, filename) == -1);
 }
 
 
@@ -1095,7 +1137,7 @@
 
 	if (h == NULL || e == NULL)
 		rl_initialize();
-	return (history(h, &ev, H_SAVE, filename));
+	return (history(h, &ev, H_SAVE, filename) == -1);
 }
 
 
@@ -1157,6 +1199,28 @@
 
 
 /*
+ * remove the specified entry from the history list and return it.
+ */
+HIST_ENTRY *
+remove_history(int num)
+{
+	static HIST_ENTRY she;
+	HistEvent ev;
+
+	if (h == NULL || e == NULL)
+		rl_initialize();
+
+	if (history(h, &ev, H_DEL, num) != 0)
+		return NULL;
+
+	she.line = ev.str;
+	she.data = NULL;
+
+	return &she;
+}
+
+
+/*
  * clear the history list - delete all entries
  */
 void
@@ -1605,7 +1669,7 @@
 
 	if (buf == NULL || count-- <= 0)
 		return;
-	if (count == 0 && buf[0] == CTRL('d'))
+	if (count == 0 && buf[0] == e->el_tty.t_c[TS_IO][C_EOF])
 		done = 1;
 	if (buf[count] == '\n' || buf[count] == '\r')
 		done = 2;
@@ -1645,7 +1709,7 @@
 rl_redisplay(void)
 {
 	char a[2];
-	a[0] = CTRL('r');
+	a[0] = e->el_tty.t_c[TS_IO][C_REPRINT];
 	a[1] = '\0';
 	el_push(e, a);
 }
@@ -1669,7 +1733,7 @@
 }
 
 void
-rl_deprep_terminal()
+rl_deprep_terminal(void)
 {
 	el_set(e, EL_PREP_TERM, 0);
 }
@@ -1764,3 +1828,82 @@
 	rl_point = li->cursor - li->buffer;
 	rl_end = li->lastchar - li->buffer;
 }
+
+void
+rl_get_screen_size(int *rows, int *cols)
+{
+	if (rows)
+		el_get(e, EL_GETTC, "li", rows);
+	if (cols)
+		el_get(e, EL_GETTC, "co", cols);
+}
+
+void
+rl_set_screen_size(int rows, int cols)
+{
+	char buf[64];
+	(void)snprintf(buf, sizeof(buf), "%d", rows);
+	el_set(e, EL_SETTC, "li", buf);
+	(void)snprintf(buf, sizeof(buf), "%d", cols);
+	el_set(e, EL_SETTC, "co", buf);
+}
+
+char *
+rl_filename_completion_function (const char *text, int state)
+{
+	return fn_filename_completion_function(text, state);
+}
+
+int
+_rl_abort_internal(void)
+{
+	el_beep(e);
+	longjmp(topbuf, 1);
+	/*NOTREACHED*/
+}
+
+int
+_rl_qsort_string_compare(char **s1, char **s2)
+{
+	return strcoll(*s1, *s2);
+}
+
+int
+/*ARGSUSED*/
+rl_kill_text(int from, int to)
+{
+	return 0;
+}
+
+Keymap
+rl_make_bare_keymap(void)
+{
+	return NULL;
+}
+
+Keymap
+rl_get_keymap(void)
+{
+	return NULL;
+}
+
+void
+/*ARGSUSED*/
+rl_set_keymap(Keymap k)
+{
+}
+
+int
+/*ARGSUSED*/
+rl_generic_bind(int type, const char * keyseq, const char * data, Keymap k)
+{
+	return 0;
+}
+
+int
+/*ARGSUSED*/
+rl_bind_key_in_map(int key, Function *fun, Keymap k)
+{
+	return 0;
+}
+
Index: lib/libedit/refresh.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/refresh.c,v
retrieving revision 1.5
diff -u -r1.5 refresh.c
--- lib/libedit/refresh.c	13 Nov 2005 11:58:30 -0000	1.5
+++ lib/libedit/refresh.c	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)refresh.c	8.1 (Berkeley) 6/4/93
- * $NetBSD: refresh.c,v 1.26 2003/08/07 16:44:33 agc Exp $
+ * $NetBSD: refresh.c,v 1.27 2005/11/09 22:11:10 christos Exp $
  * $DragonFly: src/lib/libedit/refresh.c,v 1.5 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -51,6 +51,7 @@
 private void	re_insert (EditLine *, char *, int, int, char *, int);
 private void	re_delete(EditLine *, char *, int, int, int);
 private void	re_fastputc(EditLine *, int);
+private void	re_clear_eol(EditLine *, int, int, int);
 private void	re__strncopy(char *, char *, size_t);
 private void	re__copy_and_pad(char *, const char *, size_t);
 
@@ -342,7 +343,7 @@
 	ELRE_DEBUG(1,
 	    (__F, "re_insert() starting: %d at %d max %d, d == \"%s\"\n",
 	    num, dat, dlen, d));
-	ELRE_DEBUG(1, (__F, "s == \"%s\"n", s));
+	ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s));
 
 	/* open up the space for num chars */
 	if (num > 0) {
@@ -355,7 +356,7 @@
 	ELRE_DEBUG(1, (__F,
 		"re_insert() after insert: %d at %d max %d, d == \"%s\"\n",
 		num, dat, dlen, d));
-	ELRE_DEBUG(1, (__F, "s == \"%s\"n", s));
+	ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s));
 
 	/* copy the characters */
 	for (a = d + dat; (a < d + dlen) && (num > 0); num--)
@@ -364,7 +365,7 @@
 	ELRE_DEBUG(1,
 	    (__F, "re_insert() after copy: %d at %d max %d, %s == \"%s\"\n",
 	    num, dat, dlen, d, s));
-	ELRE_DEBUG(1, (__F, "s == \"%s\"n", s));
+	ELRE_DEBUG(1, (__F, "s == \"%s\"\n", s));
 }
 
 
@@ -413,6 +414,32 @@
 		*a++ = *b++;
 }
 
+/* re_clear_eol():
+ *	Find the number of characters we need to clear till the end of line
+ *	in order to make sure that we have cleared the previous contents of
+ *	the line. fx and sx is the number of characters inserted or deleted
+ *	int the first or second diff, diff is the difference between the
+ * 	number of characters between the new and old line.
+ */
+private void
+re_clear_eol(EditLine *el, int fx, int sx, int diff)
+{
+
+	ELRE_DEBUG(1, (__F, "re_clear_eol sx %d, fx %d, diff %d\n",
+	    sx, fx, diff));
+
+	if (fx < 0)
+		fx = -fx;
+	if (sx < 0)
+		sx = -sx;
+	if (fx > diff)
+		diff = fx;
+	if (sx > diff)
+		diff = sx;
+
+	ELRE_DEBUG(1, (__F, "re_clear_eol %d\n", diff));
+	term_clear_EOL(el, diff);
+}
 
 /*****************************************************************
     re_update_line() is based on finding the middle difference of each line
@@ -628,7 +655,7 @@
 	fx = (nsb - nfd) - (osb - ofd);
 	sx = (nls - nse) - (ols - ose);
 
-	ELRE_DEBUG(1, (__F, "\n"));
+	ELRE_DEBUG(1, (__F, "fx %d, sx %d\n", fx, sx));
 	ELRE_DEBUG(1, (__F, "ofd %d, osb %d, ose %d, ols %d, oe %d\n",
 		ofd - old, osb - old, ose - old, ols - old, oe - old));
 	ELRE_DEBUG(1, (__F, "nfd %d, nsb %d, nse %d, nls %d, ne %d\n",
@@ -777,9 +804,7 @@
 		         * write (nsb-nfd) chars of new starting at nfd
 		         */
 			term_overwrite(el, nfd, (nsb - nfd));
-			ELRE_DEBUG(1, (__F,
-			    "cleareol %d\n", (oe - old) - (ne - new)));
-			term_clear_EOL(el, (oe - old) - (ne - new));
+			re_clear_eol(el, fx, sx, (oe - old) - (ne - new));
 			/*
 		         * Done
 		         */
@@ -820,10 +845,7 @@
 			ELRE_DEBUG(1, (__F,
 			    "but with nothing left to save\r\n"));
 			term_overwrite(el, nse, (nls - nse));
-			ELRE_DEBUG(1, (__F,
-			    "cleareol %d\n", (oe - old) - (ne - new)));
-			if ((oe - old) - (ne - new) != 0)
-				term_clear_EOL(el, (oe - old) - (ne - new));
+			re_clear_eol(el, fx, sx, (oe - old) - (ne - new));
 		}
 	}
 	/*
Index: lib/libedit/term.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/term.c,v
retrieving revision 1.4
diff -u -r1.4 term.c
--- lib/libedit/term.c	13 Nov 2005 11:58:30 -0000	1.4
+++ lib/libedit/term.c	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)term.c	8.2 (Berkeley) 4/30/95
- * $NetBSD: term.c,v 1.40 2004/05/22 23:21:28 christos Exp $
+ * $NetBSD: term.c,v 1.46 2006/11/24 00:01:17 christos Exp $
  * $DragonFly: src/lib/libedit/term.c,v 1.4 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -393,7 +393,8 @@
          * New string is shorter; no need to allocate space
          */
 	if (clen <= tlen) {
-		(void) strcpy(*str, cap);	/* XXX strcpy is safe */
+		if (*str)
+			(void) strcpy(*str, cap);	/* XXX strcpy is safe */
 		return;
 	}
 	/*
@@ -467,8 +468,12 @@
 		return (-1);
 	for (i = 0; i < c->v; i++) {
 		b[i] = (char *) el_malloc((size_t) (sizeof(char) * (c->h + 1)));
-		if (b[i] == NULL)
+		if (b[i] == NULL) {
+			while (--i >= 0)
+				el_free((ptr_t) b[i]);
+			el_free((ptr_t) b);
 			return (-1);
+		}
 	}
 	b[c->v] = NULL;
 	el->el_display = b;
@@ -478,8 +483,12 @@
 		return (-1);
 	for (i = 0; i < c->v; i++) {
 		b[i] = (char *) el_malloc((size_t) (sizeof(char) * (c->h + 1)));
-		if (b[i] == NULL)
+		if (b[i] == NULL) {
+			while (--i >= 0)
+				el_free((ptr_t) b[i]);
+			el_free((ptr_t) b);
 			return (-1);
+		}
 	}
 	b[c->v] = NULL;
 	el->el_vdisplay = b;
@@ -939,7 +948,7 @@
 		Val(T_co) = tgetnum("co");
 		Val(T_li) = tgetnum("li");
 		for (t = tstr; t->name != NULL; t++) {
-			/* XXX: some systems tgetstr needs non const */
+			/* XXX: some systems' tgetstr needs non const */
 			term_alloc(el, t, tgetstr(strchr(t->name, *t->name),
 			    &area));
 		}
@@ -1245,6 +1254,19 @@
 	(void) fflush(term_outfile);
 }
 
+/* term_writec():
+ *	Write the given character out, in a human readable form
+ */
+protected void
+term_writec(EditLine *el, int c)
+{
+	char buf[8];
+	int cnt = key__decode_char(buf, sizeof(buf), 0, c);
+	buf[cnt] = '\0';
+	term_overwrite(el, buf, cnt);
+	term__flush();
+}
+
 
 /* term_telltc():
  *	Print the current termcap characteristics
@@ -1272,11 +1294,17 @@
 		(void) fprintf(el->el_outfile, "\tIt %s magic margins\n",
 		    EL_HAS_MAGIC_MARGINS ? "has" : "does not have");
 
-	for (t = tstr, ts = el->el_term.t_str; t->name != NULL; t++, ts++)
+	for (t = tstr, ts = el->el_term.t_str; t->name != NULL; t++, ts++) {
+		const char *ub;
+		if (*ts && **ts) {
+		    (void) key__decode_str(*ts, upbuf, sizeof(upbuf), "");
+		    ub = upbuf;
+		} else {
+		    ub = "(empty)";
+		}
 		(void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n",
-		    t->long_name,
-		    t->name, *ts && **ts ?
-		    key__decode_str(*ts, upbuf, "") : "(empty)");
+		    t->long_name, t->name, ub);
+	}
 	(void) fputc('\n', el->el_outfile);
 	return (0);
 }
@@ -1295,7 +1323,7 @@
 	const char *what, *how;
 
 	if (argv == NULL || argv[1] == NULL || argv[2] == NULL)
-		return (-1);
+		return -1;
 
 	what = argv[1];
 	how = argv[2];
@@ -1310,7 +1338,7 @@
 	if (ts->name != NULL) {
 		term_alloc(el, ts, how);
 		term_setflags(el);
-		return (0);
+		return 0;
 	}
 	/*
          * Do the numeric ones second
@@ -1319,46 +1347,100 @@
 		if (strcmp(tv->name, what) == 0)
 			break;
 
-	if (tv->name != NULL) {
-		if (tv == &tval[T_pt] || tv == &tval[T_km] ||
-		    tv == &tval[T_am] || tv == &tval[T_xn]) {
-			if (strcmp(how, "yes") == 0)
-				el->el_term.t_val[tv - tval] = 1;
-			else if (strcmp(how, "no") == 0)
-				el->el_term.t_val[tv - tval] = 0;
-			else {
-				(void) fprintf(el->el_errfile,
-				    "settc: Bad value `%s'.\n", how);
-				return (-1);
-			}
-			term_setflags(el);
-			if (term_change_size(el, Val(T_li), Val(T_co)) == -1)
-				return (-1);
-			return (0);
-		} else {
-			long i;
-			char *ep;
+	if (tv->name != NULL)
+		return -1;
 
-			i = strtol(how, &ep, 10);
-			if (*ep != '\0') {
-				(void) fprintf(el->el_errfile,
-				    "settc: Bad value `%s'.\n", how);
-				return (-1);
-			}
-			el->el_term.t_val[tv - tval] = (int) i;
-			el->el_term.t_size.v = Val(T_co);
-			el->el_term.t_size.h = Val(T_li);
-			if (tv == &tval[T_co] || tv == &tval[T_li])
-				if (term_change_size(el, Val(T_li), Val(T_co))
-				    == -1)
-					return (-1);
-			return (0);
+	if (tv == &tval[T_pt] || tv == &tval[T_km] ||
+	    tv == &tval[T_am] || tv == &tval[T_xn]) {
+		if (strcmp(how, "yes") == 0)
+			el->el_term.t_val[tv - tval] = 1;
+		else if (strcmp(how, "no") == 0)
+			el->el_term.t_val[tv - tval] = 0;
+		else {
+			(void) fprintf(el->el_errfile,
+			    "%s: Bad value `%s'.\n", argv[0], how);
+			return -1;
+		}
+		term_setflags(el);
+		if (term_change_size(el, Val(T_li), Val(T_co)) == -1)
+			return -1;
+		return 0;
+	} else {
+		long i;
+		char *ep;
+
+		i = strtol(how, &ep, 10);
+		if (*ep != '\0') {
+			(void) fprintf(el->el_errfile,
+			    "%s: Bad value `%s'.\n", argv[0], how);
+			return -1;
 		}
+		el->el_term.t_val[tv - tval] = (int) i;
+		el->el_term.t_size.v = Val(T_co);
+		el->el_term.t_size.h = Val(T_li);
+		if (tv == &tval[T_co] || tv == &tval[T_li])
+			if (term_change_size(el, Val(T_li), Val(T_co))
+			    == -1)
+				return -1;
+		return 0;
 	}
-	return (-1);
 }
 
 
+/* term_gettc():
+ *	Get the current terminal characteristics
+ */
+protected int
+/*ARGSUSED*/
+term_gettc(EditLine *el, int argc __attribute__((__unused__)), char **argv)
+{
+	const struct termcapstr *ts;
+	const struct termcapval *tv;
+	char *what;
+	void *how;
+
+	if (argv == NULL || argv[1] == NULL || argv[2] == NULL)
+		return (-1);
+
+	what = argv[1];
+	how = argv[2];
+
+	/*
+         * Do the strings first
+         */
+	for (ts = tstr; ts->name != NULL; ts++)
+		if (strcmp(ts->name, what) == 0)
+			break;
+
+	if (ts->name != NULL) {
+		*(char **)how = el->el_term.t_str[ts - tstr];
+		return 0;
+	}
+	/*
+         * Do the numeric ones second
+         */
+	for (tv = tval; tv->name != NULL; tv++)
+		if (strcmp(tv->name, what) == 0)
+			break;
+
+	if (tv->name == NULL)
+		return -1;
+
+	if (tv == &tval[T_pt] || tv == &tval[T_km] ||
+	    tv == &tval[T_am] || tv == &tval[T_xn]) {
+		static char yes[] = "yes";
+		static char no[] = "no";
+		if (el->el_term.t_val[tv - tval])
+			*(char **)how = yes;
+		else
+			*(char **)how = no;
+		return 0;
+	} else {
+		*(int *)how = el->el_term.t_val[tv - tval];
+		return 0;
+	}
+}
+
 /* term_echotc():
  *	Print the termcap string out with variable substitution
  */
@@ -1444,7 +1526,7 @@
 			break;
 		}
 	if (t->name == NULL) {
-		/* XXX: some systems tgetstr needs non const */
+		/* XXX: some systems' tgetstr needs non const */
 		scap = tgetstr(strchr(*argv, **argv), &area);
 	}
 	if (!scap || scap[0] == '\0') {
Index: lib/libedit/term.h
===================================================================
RCS file: /home/dcvs/src/lib/libedit/term.h,v
retrieving revision 1.4
diff -u -r1.4 term.h
--- lib/libedit/term.h	13 Nov 2005 11:58:30 -0000	1.4
+++ lib/libedit/term.h	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)term.h	8.1 (Berkeley) 6/4/93
- * $NetBSD: term.h,v 1.16 2005/03/15 00:10:40 christos Exp $
+ * $NetBSD: term.h,v 1.18 2006/11/24 00:01:17 christos Exp $
  * $DragonFly: src/lib/libedit/term.h,v 1.4 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -100,8 +100,10 @@
 protected void	term_get(EditLine *, const char **);
 protected int	term_set(EditLine *, const char *);
 protected int	term_settc(EditLine *, int, const char **);
+protected int	term_gettc(EditLine *, int, char **);
 protected int	term_telltc(EditLine *, int, const char **);
 protected int	term_echotc(EditLine *, int, const char **);
+protected void	term_writec(EditLine *, int);
 protected int	term__putc(int);
 protected void	term__flush(void);
 
Index: lib/libedit/tty.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/tty.c,v
retrieving revision 1.4
diff -u -r1.4 tty.c
--- lib/libedit/tty.c	13 Nov 2005 11:58:30 -0000	1.4
+++ lib/libedit/tty.c	28 Apr 2007 17:52:08 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)tty.c	8.1 (Berkeley) 6/4/93
- * $NetBSD: tty.c,v 1.23 2005/06/01 11:37:52 lukem Exp $
+ * $NetBSD: tty.c,v 1.25 2006/03/18 09:09:41 christos Exp $
  * $DragonFly: src/lib/libedit/tty.c,v 1.4 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -524,8 +524,11 @@
 #endif /* DEBUG_TTY */
 			return (-1);
 		}
-	} else
+	}
+#ifdef notdef
+	else
 		tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]);
+#endif
 
 	el->el_tty.t_ed.c_iflag &= ~el->el_tty.t_t[ED_IO][MD_INP].t_clrmask;
 	el->el_tty.t_ed.c_iflag |= el->el_tty.t_t[ED_IO][MD_INP].t_setmask;
@@ -1195,10 +1198,14 @@
 				st = len =
 				    strlen(el->el_tty.t_t[z][m->m_type].t_name);
 			}
-			x = (el->el_tty.t_t[z][i].t_setmask & m->m_value)
-			    ?  '+' : '\0';
-			x = (el->el_tty.t_t[z][i].t_clrmask & m->m_value)
-			    ? '-' : x;
+			if (i != -1) {
+			    x = (el->el_tty.t_t[z][i].t_setmask & m->m_value)
+				?  '+' : '\0';
+			    x = (el->el_tty.t_t[z][i].t_clrmask & m->m_value)
+				? '-' : x;
+			} else {
+			    x = '\0';
+			}
 
 			if (x != '\0' || aflag) {
 
Index: lib/libedit/vi.c
===================================================================
RCS file: /home/dcvs/src/lib/libedit/vi.c,v
retrieving revision 1.6
diff -u -r1.6 vi.c
--- lib/libedit/vi.c	13 Nov 2005 11:58:30 -0000	1.6
+++ lib/libedit/vi.c	28 Apr 2007 20:28:46 -0000
@@ -30,7 +30,7 @@
  * SUCH DAMAGE.
  *
  * @(#)vi.c	8.1 (Berkeley) 6/4/93
- * $NetBSD: vi.c,v 1.21 2005/04/25 01:06:03 matt Exp $
+ * $NetBSD: vi.c,v 1.27 2006/10/22 07:48:13 mrg Exp $$
  * $DragonFly: src/lib/libedit/vi.c,v 1.6 2005/11/13 11:58:30 corecode Exp $
  */
 
@@ -65,8 +65,10 @@
 			    el->el_line.lastchar - el->el_line.buffer);
 		el->el_chared.c_vcmd.action = NOP;
 		el->el_chared.c_vcmd.pos = 0;
-		el->el_line.lastchar = el->el_line.buffer;
-		el->el_line.cursor = el->el_line.buffer;
+		if (!(c & YANK)) {
+			el->el_line.lastchar = el->el_line.buffer;
+			el->el_line.cursor = el->el_line.buffer;
+		}
 		if (c & INSERT)
 			el->el_map.current = el->el_map.key;
 
@@ -83,7 +85,6 @@
 private el_action_t
 cv_paste(EditLine *el, int c)
 {
-	char *ptr;
 	c_kill_t *k = &el->el_chared.c_kill;
 	int len = k->last - k->buf;
 
@@ -97,12 +98,12 @@
 
 	if (!c && el->el_line.cursor < el->el_line.lastchar)
 		el->el_line.cursor++;
-	ptr = el->el_line.cursor;
 
 	c_insert(el, len);
 	if (el->el_line.cursor + len > el->el_line.lastchar)
 		return (CC_ERROR);
-	(void) memcpy(ptr, k->buf, len +0u);
+	(void) memcpy(el->el_line.cursor, k->buf, len +0u);
+
 	return (CC_REFRESH);
 }
 
@@ -593,13 +594,12 @@
  */
 protected el_action_t
 /*ARGSUSED*/
-vi_list_or_eof(EditLine *el, int c __attribute__((__unused__)))
+vi_list_or_eof(EditLine *el, int c)
 {
 
 	if (el->el_line.cursor == el->el_line.lastchar) {
 		if (el->el_line.cursor == el->el_line.buffer) {
-			term_overwrite(el, STReof, 4);	/* then do a EOF */
-			term__flush();
+			term_writec(el, c);	/* then do a EOF */
 			return (CC_EOF);
 		} else {
 			/*
@@ -889,7 +889,7 @@
 
 /* vi_comment_out():
  *	Vi comment out current command
- *	[c]
+ *	[#]
  */
 protected el_action_t
 /*ARGSUSED*/
@@ -906,9 +906,12 @@
 /* vi_alias():
  *	Vi include shell alias
  *	[@]
- * NB: posix impiles that we should enter insert mode, however
+ * NB: posix implies that we should enter insert mode, however
  * this is against historical precedent...
  */
+#ifdef __weak_extern
+extern char *get_alias_text(const char *) __weak_extern(get_alias_text);
+#endif
 protected el_action_t
 /*ARGSUSED*/
 vi_alias(EditLine *el, int c)
@@ -916,8 +919,6 @@
 #ifdef __weak_extern
 	char alias_name[3];
 	char *alias_text;
-	extern char *get_alias_text(const char *);
-	__weak_extern(get_alias_text);
 
 	if (get_alias_text == 0) {
 		return CC_ERROR;
Index: lib/libedit/TEST/Makefile
===================================================================
RCS file: /home/dcvs/src/lib/libedit/TEST/Makefile,v
retrieving revision 1.1
diff -u -r1.1 Makefile
--- lib/libedit/TEST/Makefile	13 Nov 2005 11:58:30 -0000	1.1
+++ lib/libedit/TEST/Makefile	28 Apr 2007 17:52:08 -0000
@@ -3,12 +3,12 @@
 
 NOMAN=1
 PROG=test
-CPPFLAGS=-I${.CURDIR}/..
+CFLAGS=-I${.CURDIR}/..
 LDADD+=-ledit -ltermcap
 DPADD+=${LIBEDIT} ${LIBTERMCAP}
 
 .ifdef DEBUG
-CPPFLAGS+=-DDEBUG
+CFLAGS+=-DDEBUG
 .endif
 
 .include <bsd.prog.mk>
Index: lib/libedit/readline/readline.h
===================================================================
RCS file: /home/dcvs/src/lib/libedit/readline/readline.h,v
retrieving revision 1.1
diff -u -r1.1 readline.h
--- lib/libedit/readline/readline.h	13 Nov 2005 11:58:30 -0000	1.1
+++ lib/libedit/readline/readline.h	28 Apr 2007 17:52:08 -0000
@@ -13,11 +13,7 @@
  * 2. Redistributions in binary form must reproduce the above copyright
  *    notice, this list of conditions and the following disclaimer in the
  *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *	This product includes software developed by the NetBSD
- *	Foundation, Inc. and its contributors.
- * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * 3. Neither the name of The NetBSD Foundation nor the names of its
  *    contributors may be used to endorse or promote products derived
  *    from this software without specific prior written permission.
  *
@@ -33,7 +29,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $NetBSD: readline.h,v 1.16 2005/06/11 18:18:59 christos Exp $
+ * $NetBSD: readline.h,v 1.19 2006/11/24 00:01:17 christos Exp $
  * $DragonFly: src/lib/libedit/readline/readline.h,v 1.1 2005/11/13 11:58:30 corecode Exp $
  */
 #ifndef _READLINE_H_
@@ -128,6 +124,8 @@
 extern VFunction	*rl_completion_display_matches_hook;
 extern VFunction	*rl_prep_term_function;
 extern VFunction	*rl_deprep_term_function;
+extern int		readline_echoing_p;
+extern int		_rl_print_completions_horizontally;
 
 /* supported functions */
 char		*readline(const char *);
@@ -142,6 +140,7 @@
 int		 where_history(void);
 HIST_ENTRY	*current_history(void);
 HIST_ENTRY	*history_get(int);
+HIST_ENTRY	*remove_history(int);
 int		 history_total_bytes(void);
 int		 history_set_pos(int);
 HIST_ENTRY	*previous_history(void);
@@ -180,11 +179,18 @@
 int		 rl_variable_bind(const char *, const char *);
 void		 rl_stuff_char(int);
 int		 rl_add_defun(const char *, Function *, int);
+void		 rl_get_screen_size(int *, int *);
+void		 rl_set_screen_size(int, int);
+char 		*rl_filename_completion_function (const char *, int);
+int		 _rl_abort_internal(void);
+int		 _rl_qsort_string_compare(char **, char **);
 
 /*
  * The following are not implemented
  */
+int		 rl_kill_text(int, int);
 Keymap		 rl_get_keymap(void);
+void		 rl_set_keymap(Keymap);
 Keymap		 rl_make_bare_keymap(void);
 int		 rl_generic_bind(int, const char *, const char *, Keymap);
 int		 rl_bind_key_in_map(int, Function *, Keymap);
Attachment:
pgp00002.pgp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pgp00002.pgp
Type: application/octet-stream
Size: 189 bytes
Desc: "Description: PGP signature"
URL: <http://lists.dragonflybsd.org/pipermail/submit/attachments/20070428/cf601a40/attachment-0018.obj>


More information about the Submit mailing list