[Midnightbsd-cvs] src [10848] trunk/lib/libedit: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Tue Jun 12 20:46:33 EDT 2018


Revision: 10848
          http://svnweb.midnightbsd.org/src/?rev=10848
Author:   laffer1
Date:     2018-06-12 20:46:33 -0400 (Tue, 12 Jun 2018)
Log Message:
-----------
sync with freebsd

Modified Paths:
--------------
    trunk/lib/libedit/Makefile
    trunk/lib/libedit/chared.c
    trunk/lib/libedit/chared.h
    trunk/lib/libedit/chartype.h
    trunk/lib/libedit/common.c
    trunk/lib/libedit/edit/readline/Makefile
    trunk/lib/libedit/edit/readline/history.h
    trunk/lib/libedit/edit/readline/readline.h
    trunk/lib/libedit/edit/readline/tilde.h
    trunk/lib/libedit/editline.3
    trunk/lib/libedit/editrc.5
    trunk/lib/libedit/el.c
    trunk/lib/libedit/el.h
    trunk/lib/libedit/emacs.c
    trunk/lib/libedit/filecomplete.c
    trunk/lib/libedit/filecomplete.h
    trunk/lib/libedit/hist.c
    trunk/lib/libedit/hist.h
    trunk/lib/libedit/histedit.h
    trunk/lib/libedit/history.c
    trunk/lib/libedit/key.c
    trunk/lib/libedit/key.h
    trunk/lib/libedit/makelist
    trunk/lib/libedit/map.c
    trunk/lib/libedit/map.h
    trunk/lib/libedit/parse.c
    trunk/lib/libedit/parse.h
    trunk/lib/libedit/prompt.c
    trunk/lib/libedit/prompt.h
    trunk/lib/libedit/read.c
    trunk/lib/libedit/read.h
    trunk/lib/libedit/readline.c
    trunk/lib/libedit/refresh.c
    trunk/lib/libedit/refresh.h
    trunk/lib/libedit/search.c
    trunk/lib/libedit/search.h
    trunk/lib/libedit/sig.c
    trunk/lib/libedit/sig.h
    trunk/lib/libedit/sys.h
    trunk/lib/libedit/term.c
    trunk/lib/libedit/term.h
    trunk/lib/libedit/tokenizer.c
    trunk/lib/libedit/tty.c

Property Changed:
----------------
    trunk/lib/libedit/editline.3
    trunk/lib/libedit/editrc.5
    trunk/lib/libedit/makelist

Modified: trunk/lib/libedit/Makefile
===================================================================
--- trunk/lib/libedit/Makefile	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/Makefile	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,6 +1,7 @@
-#	$NetBSD: Makefile,v 1.34 2005/05/28 12:02:53 lukem Exp $
+# $MidnightBSD$
+#	$NetBSD: Makefile,v 1.37 2009/01/18 12:17:49 lukem Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
-# $MidnightBSD$
+# $FreeBSD: stable/10/lib/libedit/Makefile 268782 2014-07-17 02:14:25Z pfg $
 
 LIB=	edit
 SHLIB_MAJOR=	7
@@ -70,9 +71,9 @@
 editline.o editline.po editline.So editline.ln:	\
 	common.h emacs.h fcns.c fcns.h help.c help.h vi.h
 
-test.o: ${.CURDIR}/TEST/test.c
+tc1.o: ${.CURDIR}/TEST/tc1.c
 
-test: test.o libedit.a ${DPADD} ${LIBTERMCAP}
+test: tc1.o libedit.a ${DPADD} ${LIBTERMCAP}
 	${CC} ${CFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD}
 
 .include <bsd.lib.mk>

Modified: trunk/lib/libedit/chared.c
===================================================================
--- trunk/lib/libedit/chared.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/chared.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)chared.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/chared.c 238178 2012-07-06 19:30:50Z pfg $");
 
 /*
  * chared.c: Character editor utilities

Modified: trunk/lib/libedit/chared.h
===================================================================
--- trunk/lib/libedit/chared.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/chared.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -30,8 +31,8 @@
  * SUCH DAMAGE.
  *
  *	@(#)chared.h	8.1 (Berkeley) 6/4/93
- *	$NetBSD: chared.h,v 1.17 2006/03/06 21:11:56 christos Exp $
- * $MidnightBSD$
+ *	$NetBSD: chared.h,v 1.18 2009/02/15 21:55:23 christos Exp $
+ * $FreeBSD: stable/10/lib/libedit/chared.h 238178 2012-07-06 19:30:50Z pfg $
  */
 
 /*

Modified: trunk/lib/libedit/chartype.h
===================================================================
--- trunk/lib/libedit/chartype.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/chartype.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*	$NetBSD: chartype.h,v 1.6 2010/04/20 02:01:13 christos Exp $	*/
 
 /*-
@@ -12,13 +13,6 @@
  * 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
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
@@ -32,7 +26,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libedit/chartype.h 263687 2014-03-24 13:48:04Z emaste $
  */
 
 #ifndef _h_chartype_f

Modified: trunk/lib/libedit/common.c
===================================================================
--- trunk/lib/libedit/common.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/common.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -29,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$NetBSD: common.c,v 1.19 2006/03/06 21:11:56 christos Exp $
+ *	$NetBSD: common.c,v 1.23 2009/02/27 04:18:45 msaitoh Exp $
  */
 
 #if !defined(lint) && !defined(SCCSID)
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)common.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/common.c 268782 2014-07-17 02:14:25Z pfg $");
 
 /*
  * common.c: Common Editor functions
@@ -121,7 +122,7 @@
 		*kp++ = *p;
 	el->el_chared.c_kill.last = kp;
 
-	c_delbefore(el, el->el_line.cursor - cp);	/* delete before dot */
+	c_delbefore(el, (int)(el->el_line.cursor - cp));/* delete before dot */
 	el->el_line.cursor = cp;
 	if (el->el_line.cursor < el->el_line.buffer)
 		el->el_line.cursor = el->el_line.buffer; /* bounds check */
@@ -208,9 +209,6 @@
 
 	el->el_line.cursor = el->el_line.lastchar;
 	if (el->el_map.type == MAP_VI) {
-#ifdef VI_MOVE
-		el->el_line.cursor--;
-#endif
 		if (el->el_chared.c_vcmd.action != NOP) {
 			cv_delfini(el);
 			return (CC_REFRESH);

Modified: trunk/lib/libedit/edit/readline/Makefile
===================================================================
--- trunk/lib/libedit/edit/readline/Makefile	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/edit/readline/Makefile	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,5 +1,6 @@
+# $MidnightBSD$
 # Copyright (c) 2011 David E O'Brien
-# $FreeBSD$
+# $FreeBSD: stable/10/lib/libedit/edit/readline/Makefile 234690 2012-04-26 00:51:43Z obrien $
 
 INCS=	readline.h history.h tilde.h
 

Modified: trunk/lib/libedit/edit/readline/history.h
===================================================================
--- trunk/lib/libedit/edit/readline/history.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/edit/readline/history.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2011 David E. O'Brien
  * All rights reserved.
@@ -26,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD$
+ * $FreeBSD: stable/10/lib/libedit/edit/readline/history.h 220370 2011-04-05 18:41:01Z obrien $
  */
 
 #include <edit/readline/readline.h>

Modified: trunk/lib/libedit/edit/readline/readline.h
===================================================================
--- trunk/lib/libedit/edit/readline/readline.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/edit/readline/readline.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*	$NetBSD: readline.h,v 1.31 2010/08/04 20:29:18 christos Exp $	*/
 
 /*-
@@ -28,7 +29,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD$
+ * $FreeBSD: stable/10/lib/libedit/edit/readline/readline.h 228114 2011-11-29 04:50:57Z fjoe $
  */
 #ifndef _READLINE_H_
 #define _READLINE_H_
@@ -200,7 +201,6 @@
 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 **);
 char 	       **rl_completion_matches(const char *, rl_compentry_func_t *);
 void		 rl_forced_update_display(void);
 int		 rl_set_prompt(const char *);

Modified: trunk/lib/libedit/edit/readline/tilde.h
===================================================================
--- trunk/lib/libedit/edit/readline/tilde.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/edit/readline/tilde.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2011 David E. O'Brien
  * All rights reserved.
@@ -26,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD$
+ * $FreeBSD: stable/10/lib/libedit/edit/readline/tilde.h 234690 2012-04-26 00:51:43Z obrien $
  */
 
 #include <edit/readline/readline.h>

Modified: trunk/lib/libedit/editline.3
===================================================================
--- trunk/lib/libedit/editline.3	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/editline.3	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: editline.3,v 1.70 2009/07/05 21:55:24 perry Exp $
 .\"
 .\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
@@ -26,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libedit/editline.3 278411 2015-02-08 22:11:24Z bapt $
 .\"
 .Dd July 5, 2009
 .Dt EDITLINE 3
@@ -526,8 +527,6 @@
 is
 .Dv NULL ,
 try
-.Pa $PWD/.editrc
-then
 .Pa $HOME/.editrc .
 Refer to
 .Xr editrc 5
@@ -684,6 +683,9 @@
 .It Dv H_SAVE , Fa "const char *file"
 Save the history list to
 .Fa file .
+.It Dv H_SAVE_FP , Fa "FILE*"
+Save the history list to the opened
+.Fa FILE* .
 .It Dv H_SETUNIQUE , Fa "int unique"
 Set flag that adjacent identical event strings should not be entered
 into the history.


Property changes on: trunk/lib/libedit/editline.3
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libedit/editrc.5
===================================================================
--- trunk/lib/libedit/editrc.5	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/editrc.5	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\"	$NetBSD: editrc.5,v 1.24 2009/04/11 22:17:52 wiz Exp $
 .\"
 .\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
@@ -26,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/lib/libedit/editrc.5 245325 2013-01-12 09:08:37Z joel $
 .\"
 .Dd October 18, 2003
 .Dt EDITRC 5
@@ -473,6 +474,13 @@
 Editline extended command.
 .El
 .\" End of section automatically generated with makelist
+.Sh FILES
+.Bl -tag -width "~/.editrcXXX"
+.It Pa ~/.editrc
+User configuration file for the
+.Xr editline 3
+library.
+.El
 .Sh SEE ALSO
 .Xr editline 3 ,
 .Xr regex 3 ,


Property changes on: trunk/lib/libedit/editrc.5
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libedit/el.c
===================================================================
--- trunk/lib/libedit/el.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/el.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)el.c	8.2 (Berkeley) 1/3/94";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/el.c 238810 2012-07-26 15:48:07Z pfg $");
 
 /*
  * el.c: EditLine interface functions
@@ -473,31 +474,7 @@
 	return (rv);
 }
 
-/* el_data_get():
- *	Set user private data.
- */
-public void
-el_data_set (el, data)
-    EditLine *el;
-    void *data;
-{
-    el->el_data = data;
 
-    return;
-}
-
-/* el_data_get():
- *	Return user private data.
- */
-public void *
-el_data_get (el)
-    EditLine *el;
-{
-    if (el->el_data)
-	return (el->el_data);
-    return (NULL);
-}
-
 /* el_line():
  *	Return editing info
  */

Modified: trunk/lib/libedit/el.h
===================================================================
--- trunk/lib/libedit/el.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/el.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
  *
  *	@(#)el.h	8.1 (Berkeley) 6/4/93
  *	$NetBSD: el.h,v 1.17 2006/12/15 22:13:33 christos Exp $
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libedit/el.h 238378 2012-07-11 22:20:19Z pfg $
  */
 
 /*

Modified: trunk/lib/libedit/emacs.c
===================================================================
--- trunk/lib/libedit/emacs.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/emacs.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -29,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$NetBSD: emacs.c,v 1.21 2006/03/06 21:11:56 christos Exp $
+ *	$NetBSD: emacs.c,v 1.22 2009/02/15 21:55:23 christos Exp $
  */
 
 #if !defined(lint) && !defined(SCCSID)
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)emacs.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/emacs.c 268782 2014-07-17 02:14:25Z pfg $");
 
 /*
  * emacs.c: Emacs functions
@@ -101,7 +102,7 @@
 		*kp++ = *p;
 	el->el_chared.c_kill.last = kp;
 
-	c_delafter(el, cp - el->el_line.cursor);	/* delete after dot */
+	c_delafter(el, (int)(cp - el->el_line.cursor));	/* delete after dot */
 	if (el->el_line.cursor > el->el_line.lastchar)
 		el->el_line.cursor = el->el_line.lastchar;
 				/* bounds check */
@@ -131,7 +132,8 @@
 	cp = el->el_line.cursor;
 
 	/* open the space, */
-	c_insert(el, el->el_chared.c_kill.last - el->el_chared.c_kill.buf);
+	c_insert(el,
+	    (int)(el->el_chared.c_kill.last - el->el_chared.c_kill.buf));
 	/* copy the chars */
 	for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++)
 		*cp++ = *kp;
@@ -185,7 +187,7 @@
 		while (cp < el->el_chared.c_kill.mark)
 			*kp++ = *cp++;	/* copy it */
 		el->el_chared.c_kill.last = kp;
-		c_delafter(el, cp - el->el_line.cursor);
+		c_delafter(el, (int)(cp - el->el_line.cursor));
 	} else {		/* mark is before cursor */
 		cp = el->el_chared.c_kill.mark;
 		kp = el->el_chared.c_kill.buf;
@@ -192,7 +194,7 @@
 		while (cp < el->el_line.cursor)
 			*kp++ = *cp++;	/* copy it */
 		el->el_chared.c_kill.last = kp;
-		c_delbefore(el, cp - el->el_chared.c_kill.mark);
+		c_delbefore(el, (int)(cp - el->el_chared.c_kill.mark));
 		el->el_line.cursor = el->el_chared.c_kill.mark;
 	}
 	return (CC_REFRESH);
@@ -446,7 +448,7 @@
 	cp = c__prev_word(el->el_line.cursor, el->el_line.buffer,
 	    el->el_state.argument, ce__isword);
 
-	c_insert(el, oldc - cp);
+	c_insert(el, (int)(oldc - cp));
 	for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++)
 		*dp++ = *cp;
 

Modified: trunk/lib/libedit/filecomplete.c
===================================================================
--- trunk/lib/libedit/filecomplete.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/filecomplete.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -30,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/filecomplete.c 209224 2010-06-15 22:23:21Z jilles $");
 
 #include <sys/types.h>
 #include <sys/stat.h>

Modified: trunk/lib/libedit/filecomplete.h
===================================================================
--- trunk/lib/libedit/filecomplete.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/filecomplete.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -26,8 +27,8 @@
  * 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.9 2009/12/30 22:37:40 christos Exp $
- * $MidnightBSD$
+ *	$NetBSD: filecomplete.h,v 1.8 2009/02/16 00:15:45 christos Exp $
+ * $FreeBSD: stable/10/lib/libedit/filecomplete.h 268782 2014-07-17 02:14:25Z pfg $
  */
 #ifndef _FILECOMPLETE_H_
 #define _FILECOMPLETE_H_

Modified: trunk/lib/libedit/hist.c
===================================================================
--- trunk/lib/libedit/hist.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/hist.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)hist.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/hist.c 148834 2005-08-07 20:55:59Z stefanf $");
 
 /*
  * hist.c: History access functions

Modified: trunk/lib/libedit/hist.h
===================================================================
--- trunk/lib/libedit/hist.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/hist.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
  *
  *	@(#)hist.h	8.1 (Berkeley) 6/4/93
  *	$NetBSD: hist.h,v 1.10 2003/08/07 16:44:31 agc Exp $
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libedit/hist.h 278411 2015-02-08 22:11:24Z bapt $
  */
 
 /*
@@ -65,6 +66,7 @@
 #define	HIST_SET(el, num)	HIST_FUN(el, H_SET, num)
 #define	HIST_LOAD(el, fname)	HIST_FUN(el, H_LOAD fname)
 #define	HIST_SAVE(el, fname)	HIST_FUN(el, H_SAVE fname)
+#define	HIST_SAVE_FP(el, fp)	HIST_FUN(el, H_SAVE_FP fp)
 
 protected int		hist_init(EditLine *);
 protected void		hist_end(EditLine *);

Modified: trunk/lib/libedit/histedit.h
===================================================================
--- trunk/lib/libedit/histedit.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/histedit.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -30,8 +31,8 @@
  * SUCH DAMAGE.
  *
  *	@(#)histedit.h	8.2 (Berkeley) 1/3/94
- *	$NetBSD: histedit.h,v 1.32 2007/06/10 20:20:28 christos Exp $
- * $MidnightBSD$
+ *	$NetBSD: histedit.h,v 1.41 2009/09/07 21:24:33 christos Exp $
+ * $FreeBSD: stable/10/lib/libedit/histedit.h 278411 2015-02-08 22:11:24Z bapt $
  */
 
 /*
@@ -154,14 +155,7 @@
  */
 void		 el_resize(EditLine *);
 
-
 /*
- * Set user private data.
- */
-void            el_data_set    __P((EditLine *, void *));
-void *          el_data_get    __P((EditLine *));
-
-/*
  * User-defined function interface.
  */
 const LineInfo	*el_line(EditLine *);
@@ -215,6 +209,7 @@
 #define	H_NEXT_EVDATA	23	/* , const int, histdata_t *);	*/
 #define	H_DELDATA	24	/* , int, histdata_t *);*/
 #define	H_REPLACE	25	/* , const char *, histdata_t);	*/
+#define	H_SAVE_FP	26	/* , FILE*);	*/
 
 
 /*

Modified: trunk/lib/libedit/history.c
===================================================================
--- trunk/lib/libedit/history.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/history.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)history.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/history.c 278411 2015-02-08 22:11:24Z bapt $");
 
 /*
  * hist.c: History access functions
@@ -103,6 +104,7 @@
 private int history_set_fun(History *, History *);
 private int history_load(History *, const char *);
 private int history_save(History *, const char *);
+private int history_save_fp(History *, FILE*);
 private int history_prev_event(History *, HistEvent *, int);
 private int history_next_event(History *, HistEvent *, int);
 private int history_next_string(History *, HistEvent *, const char *);
@@ -773,22 +775,16 @@
 	return (i);
 }
 
-
-/* history_save():
- *	History save function
+/* history_save_fp():
+ *	History save with open FILE*
  */
-private int
-history_save(History *h, const char *fname)
+private int history_save_fp(History *h, FILE* fp)
 {
-	FILE *fp;
 	HistEvent ev;
 	int i = -1, retval;
 	size_t len, max_size;
 	char *ptr;
 
-	if ((fp = fopen(fname, "w")) == NULL)
-		return (-1);
-
 	if (fchmod(fileno(fp), S_IRUSR|S_IWUSR) == -1)
 		goto done;
 	if (fputs(hist_cookie, fp) == EOF)
@@ -816,6 +812,26 @@
 oomem:
 	h_free((ptr_t)ptr);
 done:
+	return (i);
+	
+}
+
+
+/* history_save():
+ *	History save function
+ */
+private int
+history_save(History *h, const char *fname)
+{
+	FILE *fp;
+	int i;
+
+	if ((fp = fopen(fname, "w")) == NULL)
+		return (-1);
+
+	i = history_save_fp(h, fp);
+
+done:
 	(void) fclose(fp);
 	return (i);
 }
@@ -1001,6 +1017,12 @@
 			he_seterrev(ev, _HE_HIST_WRITE);
 		break;
 
+	case H_SAVE_FP:
+		retval = history_save_fp(h, va_arg(va, FILE*));
+		if (retval == -1)
+			he_seterrev(ev, _HE_HIST_WRITE);
+		break;
+
 	case H_PREV_EVENT:
 		retval = history_prev_event(h, ev, va_arg(va, int));
 		break;

Modified: trunk/lib/libedit/key.c
===================================================================
--- trunk/lib/libedit/key.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/key.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)key.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/key.c 237448 2012-06-22 18:01:22Z pfg $");
 
 /*
  * key.c: This module contains the procedures for maintaining

Modified: trunk/lib/libedit/key.h
===================================================================
--- trunk/lib/libedit/key.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/key.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
  *
  *	@(#)key.h	8.1 (Berkeley) 6/4/93
  *	$NetBSD: key.h,v 1.10 2006/03/23 20:22:51 christos Exp $
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libedit/key.h 237448 2012-06-22 18:01:22Z pfg $
  */
 
 /*

Modified: trunk/lib/libedit/makelist
===================================================================
--- trunk/lib/libedit/makelist	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/makelist	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,5 +1,6 @@
 #!/bin/sh -
-#	$NetBSD: makelist,v 1.10 2005/08/08 14:04:49 christos Exp $
+#	$NetBSD: makelist,v 1.11 2005/10/22 16:45:03 christos Exp $
+# $FreeBSD: stable/10/lib/libedit/makelist 238624 2012-07-19 19:15:47Z pfg $
 # $MidnightBSD$
 #
 # Copyright (c) 1992, 1993


Property changes on: trunk/lib/libedit/makelist
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/lib/libedit/map.c
===================================================================
--- trunk/lib/libedit/map.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/map.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)map.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/map.c 277931 2015-01-30 14:22:15Z emaste $");
 
 /*
  * map.c: Editor function definitions
@@ -1395,7 +1396,7 @@
 map_addfunc(EditLine *el, const char *name, const char *help, el_func_t func)
 {
 	void *p;
-	int nf = el->el_map.nfunc + 1;
+	size_t nf = el->el_map.nfunc + 1;
 
 	if (name == NULL || help == NULL || func == NULL)
 		return (-1);

Modified: trunk/lib/libedit/map.h
===================================================================
--- trunk/lib/libedit/map.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/map.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
  *
  *	@(#)map.h	8.1 (Berkeley) 6/4/93
  *	$NetBSD: map.h,v 1.8 2003/08/07 16:44:32 agc Exp $
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libedit/map.h 277931 2015-01-30 14:22:15Z emaste $
  */
 
 /*
@@ -57,7 +58,7 @@
 	int		 type;		/* Emacs or vi			*/
 	el_bindings_t	*help;		/* The help for the editor functions */
 	el_func_t	*func;		/* List of available functions	*/
-	int		 nfunc;		/* The number of functions/help items */
+	size_t		 nfunc;		/* The number of functions/help items */
 } el_map_t;
 
 #define	MAP_EMACS	0

Modified: trunk/lib/libedit/parse.c
===================================================================
--- trunk/lib/libedit/parse.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/parse.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)parse.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/parse.c 277931 2015-01-30 14:22:15Z emaste $");
 
 /*
  * parse.c: parse an editline extended command
@@ -252,10 +253,11 @@
 protected int
 parse_cmd(EditLine *el, const char *cmd)
 {
-	el_bindings_t *b;
+	el_bindings_t *b = el->el_map.help;
+	size_t i;
 
-	for (b = el->el_map.help; b->name != NULL; b++)
-		if (strcmp(b->name, cmd) == 0)
-			return (b->func);
+	for (i = 0; i < el->el_map.nfunc; i++)
+		if (strcmp(b[i].name, cmd) == 0)
+			return (b[i].func);
 	return (-1);
 }

Modified: trunk/lib/libedit/parse.h
===================================================================
--- trunk/lib/libedit/parse.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/parse.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
  *
  *	@(#)parse.h	8.1 (Berkeley) 6/4/93
  *	$NetBSD: parse.h,v 1.6 2005/05/29 04:58:15 lukem Exp $
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libedit/parse.h 148834 2005-08-07 20:55:59Z stefanf $
  */
 
 /*

Modified: trunk/lib/libedit/prompt.c
===================================================================
--- trunk/lib/libedit/prompt.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/prompt.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -29,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$NetBSD: prompt.c,v 1.11 2003/08/07 16:44:32 agc Exp $
+ *	$NetBSD: prompt.c,v 1.14 2009/03/31 17:38:27 christos Exp $
  */
 
 #if !defined(lint) && !defined(SCCSID)
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)prompt.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/prompt.c 268782 2014-07-17 02:14:25Z pfg $");
 
 /*
  * prompt.c: Prompt printing functions

Modified: trunk/lib/libedit/prompt.h
===================================================================
--- trunk/lib/libedit/prompt.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/prompt.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -30,8 +31,8 @@
  * SUCH DAMAGE.
  *
  *	@(#)prompt.h	8.1 (Berkeley) 6/4/93
- *	$NetBSD: prompt.h,v 1.6 2003/08/07 16:44:32 agc Exp $
- * $MidnightBSD$
+ *	$NetBSD: prompt.h,v 1.9 2009/03/31 17:38:27 christos Exp $
+ * $FreeBSD: stable/10/lib/libedit/prompt.h 268782 2014-07-17 02:14:25Z pfg $
  */
 
 /*
@@ -45,8 +46,8 @@
 typedef char * (*el_pfunc_t)(EditLine*);
 
 typedef struct el_prompt_t {
-	el_pfunc_t	p_func;	/* Function to return the prompt	*/
-	coord_t		p_pos;	/* position in the line after prompt	*/
+	el_pfunc_t	p_func;		/* Function to return the prompt */
+	coord_t		p_pos;		/* position in the line after prompt */
 	char		p_ignore;	/* character to start/end literal 
 */
 } el_prompt_t;

Modified: trunk/lib/libedit/read.c
===================================================================
--- trunk/lib/libedit/read.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/read.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)read.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/read.c 277931 2015-01-30 14:22:15Z emaste $");
 
 /*
  * read.c: Clean this junk up! This is horrible code.
@@ -517,7 +518,7 @@
 #endif /* DEBUG_READ */
 			break;
 		}
-		if ((unsigned int)cmdnum >= (unsigned int)el->el_map.nfunc) {	/* BUG CHECK command */
+		if ((size_t)cmdnum >= el->el_map.nfunc) {	/* BUG CHECK command */
 #ifdef DEBUG_EDIT
 			(void) fprintf(el->el_errfile,
 			    "ERROR: illegal command from key 0%o\r\n", ch);

Modified: trunk/lib/libedit/read.h
===================================================================
--- trunk/lib/libedit/read.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/read.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -26,8 +27,8 @@
  * 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.5 2006/08/21 12:45:30 christos Exp $
- * $MidnightBSD$
+ *	$NetBSD: read.h,v 1.6 2008/04/29 06:53:01 martin Exp $
+ * $FreeBSD: stable/10/lib/libedit/read.h 268782 2014-07-17 02:14:25Z pfg $
  */
 
 /*

Modified: trunk/lib/libedit/readline.c
===================================================================
--- trunk/lib/libedit/readline.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/readline.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*	$NetBSD: readline.c,v 1.90 2010/08/04 20:29:18 christos Exp $	*/
 
 /*-
@@ -31,7 +32,7 @@
 
 #include <sys/cdefs.h>
 __RCSID("$NetBSD: readline.c,v 1.90 2010/08/04 20:29:18 christos Exp $");
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/readline.c 277931 2015-01-30 14:22:15Z emaste $");
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -1363,6 +1364,9 @@
 	TYPE(HistEvent) ev;
 	const Char *wline;
 
+	if (line == NULL)
+		return 0;
+
 	if (h == NULL || e == NULL)
 		rl_initialize();
 
@@ -1903,7 +1907,7 @@
 	map[(unsigned char)c] = fun;
 	el_set(e, EL_ADDFN, name, name, rl_bind_wrapper);
 	vis(dest, c, VIS_WHITE|VIS_NOSLASH, 0);
-	el_set(e, EL_BIND, dest, name);
+	el_set(e, EL_BIND, dest, name, NULL);
 	return 0;
 }
 
@@ -2011,7 +2015,7 @@
 	 * The proper return value is undocument, but this is what the
 	 * readline source seems to do.
 	 */
-	return ((el_set(e, EL_BIND, "", var, value) == -1) ? 1 : 0);
+	return ((el_set(e, EL_BIND, "", var, value, NULL) == -1) ? 1 : 0);
 }
 
 void
@@ -2080,9 +2084,9 @@
 rl_get_screen_size(int *rows, int *cols)
 {
 	if (rows)
-		el_get(e, EL_GETTC, "li", rows);
+		el_get(e, EL_GETTC, "li", rows, NULL);
 	if (cols)
-		el_get(e, EL_GETTC, "co", cols);
+		el_get(e, EL_GETTC, "co", cols, NULL);
 }
 
 void
@@ -2090,9 +2094,9 @@
 {
 	char buf[64];
 	(void)snprintf(buf, sizeof(buf), "%d", rows);
-	el_set(e, EL_SETTC, "li", buf);
+	el_set(e, EL_SETTC, "li", buf, NULL);
 	(void)snprintf(buf, sizeof(buf), "%d", cols);
-	el_set(e, EL_SETTC, "co", buf);
+	el_set(e, EL_SETTC, "co", buf, NULL);
 }
 
 char **

Modified: trunk/lib/libedit/refresh.c
===================================================================
--- trunk/lib/libedit/refresh.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/refresh.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)refresh.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/refresh.c 237448 2012-06-22 18:01:22Z pfg $");
 
 /*
  * refresh.c: Lower level screen refreshing functions

Modified: trunk/lib/libedit/refresh.h
===================================================================
--- trunk/lib/libedit/refresh.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/refresh.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
  *
  *	@(#)refresh.h	8.1 (Berkeley) 6/4/93
  *	$NetBSD: refresh.h,v 1.5 2003/08/07 16:44:33 agc Exp $
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libedit/refresh.h 148834 2005-08-07 20:55:59Z stefanf $
  */
 
 /*

Modified: trunk/lib/libedit/search.c
===================================================================
--- trunk/lib/libedit/search.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/search.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)search.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/search.c 237448 2012-06-22 18:01:22Z pfg $");
 
 /*
  * search.c: History and character search functions

Modified: trunk/lib/libedit/search.h
===================================================================
--- trunk/lib/libedit/search.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/search.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -31,7 +32,7 @@
  *
  *	@(#)search.h	8.1 (Berkeley) 6/4/93
  *	$NetBSD: search.h,v 1.8 2003/10/18 23:27:36 christos Exp $
- * $MidnightBSD$
+ * $FreeBSD: stable/10/lib/libedit/search.h 148834 2005-08-07 20:55:59Z stefanf $
  */
 
 /*

Modified: trunk/lib/libedit/sig.c
===================================================================
--- trunk/lib/libedit/sig.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/sig.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)sig.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/sig.c 238378 2012-07-11 22:20:19Z pfg $");
 
 /*
  * sig.c: Signal handling stuff.

Modified: trunk/lib/libedit/sig.h
===================================================================
--- trunk/lib/libedit/sig.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/sig.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -30,8 +31,8 @@
  * SUCH DAMAGE.
  *
  *	@(#)sig.h	8.1 (Berkeley) 6/4/93
- *	$NetBSD: sig.h,v 1.7 2009/02/15 21:25:01 christos Exp $
- * $MidnightBSD$
+ *	$NetBSD: sig.h,v 1.8 2009/02/19 15:20:22 christos Exp $
+ * $FreeBSD: stable/10/lib/libedit/sig.h 238378 2012-07-11 22:20:19Z pfg $
  */
 
 /*

Modified: trunk/lib/libedit/sys.h
===================================================================
--- trunk/lib/libedit/sys.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/sys.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -30,8 +31,8 @@
  * SUCH DAMAGE.
  *
  *	@(#)sys.h	8.1 (Berkeley) 6/4/93
- *	$NetBSD: sys.h,v 1.9 2004/01/17 17:57:40 christos Exp $
- * $MidnightBSD$
+ *	$NetBSD: sys.h,v 1.12 2009/08/31 00:05:43 christos Exp $
+ * $FreeBSD: stable/10/lib/libedit/sys.h 268782 2014-07-17 02:14:25Z pfg $
  */
 
 /*
@@ -70,6 +71,15 @@
 #define	REGEX		/* Use POSIX.2 regular expression functions */
 #undef	REGEXP		/* Use UNIX V8 regular expression functions */
 
+#if defined(__sun)
+extern int tgetent(char *, const char *);
+extern int tgetflag(char *);
+extern int tgetnum(char *);
+extern int tputs(const char *, int, int (*)(int));
+extern char* tgoto(const char*, int, int);
+extern char* tgetstr(char*, char**);
+#endif
+
 #ifdef notdef
 # undef REGEX
 # undef REGEXP

Modified: trunk/lib/libedit/term.c
===================================================================
--- trunk/lib/libedit/term.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/term.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)term.c	8.2 (Berkeley) 4/30/95";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/term.c 238810 2012-07-26 15:48:07Z pfg $");
 
 /*
  * term.c: Editor/termcap-curses interface
@@ -340,8 +341,8 @@
 	if (el->el_term.t_val == NULL)
 		return (-1);
 	(void) memset(el->el_term.t_val, 0, T_val * sizeof(int));
+	(void) term_set(el, NULL);
 	term_init_arrow(el);
-	(void) term_set(el, NULL);
 	return (0);
 }
 

Modified: trunk/lib/libedit/term.h
===================================================================
--- trunk/lib/libedit/term.h	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/term.h	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -30,8 +31,8 @@
  * SUCH DAMAGE.
  *
  *	@(#)term.h	8.1 (Berkeley) 6/4/93
- *	$NetBSD: term.h,v 1.18 2006/11/24 00:01:17 christos Exp $
- * $MidnightBSD$
+ *	$NetBSD: term.h,v 1.20 2009/03/31 17:38:27 christos Exp $
+ * $FreeBSD: stable/10/lib/libedit/term.h 268782 2014-07-17 02:14:25Z pfg $
  */
 
 /*

Modified: trunk/lib/libedit/tokenizer.c
===================================================================
--- trunk/lib/libedit/tokenizer.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/tokenizer.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)tokenizer.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/tokenizer.c 238624 2012-07-19 19:15:47Z pfg $");
 
 /*
  * tokenize.c: Bourne shell like tokenizer

Modified: trunk/lib/libedit/tty.c
===================================================================
--- trunk/lib/libedit/tty.c	2018-06-13 00:44:23 UTC (rev 10847)
+++ trunk/lib/libedit/tty.c	2018-06-13 00:46:33 UTC (rev 10848)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 1992, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -29,7 +30,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *	$NetBSD: tty.c,v 1.25 2006/03/18 09:09:41 christos Exp $
+ *	$NetBSD: tty.c,v 1.31 2009/07/22 15:58:09 christos Exp $
  */
 
 #if !defined(lint) && !defined(SCCSID)
@@ -36,7 +37,7 @@
 static char sccsid[] = "@(#)tty.c	8.1 (Berkeley) 6/4/93";
 #endif /* not lint && not SCCSID */
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libedit/tty.c 268782 2014-07-17 02:14:25Z pfg $");
 
 /*
  * tty.c: tty interface stuff
@@ -443,13 +444,12 @@
 
 
 
-#define	tty_getty(el, td)	tcgetattr((el)->el_infd, (td))
-#define	tty_setty(el, td)	tcsetattr((el)->el_infd, TCSADRAIN, (td))
-
 #define	tty__gettabs(td)	((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1)
 #define	tty__geteightbit(td)	(((td)->c_cflag & CSIZE) == CS8)
 #define	tty__cooked_mode(td)	((td)->c_lflag & ICANON)
 
+private int	tty_getty(EditLine *, struct termios *);
+private int	tty_setty(EditLine *, int, const struct termios *);
 private int	tty__getcharindex(int);
 private void	tty__getchar(struct termios *, unsigned char *);
 private void	tty__setchar(struct termios *, unsigned char *);
@@ -458,7 +458,30 @@
 
 #define	t_qu	t_ts
 
+/* tty_getty():
+ *	Wrapper for tcgetattr to handle EINTR
+ */
+private int
+tty_getty(EditLine *el, struct termios *t)
+{
+	int rv;
+	while ((rv = tcgetattr(el->el_infd, t)) == -1 && errno == EINTR)
+		continue;
+	return rv;
+}
 
+/* tty_setty():
+ *	Wrapper for tcsetattr to handle EINTR
+ */
+private int
+tty_setty(EditLine *el, int action, const struct termios *t)
+{
+	int rv;
+	while ((rv = tcsetattr(el->el_infd, action, t)) == -1 && errno == EINTR)
+		continue;
+	return rv;
+}
+
 /* tty_setup():
  *	Get the tty parameters and initialize the editing state
  */
@@ -996,7 +1019,7 @@
 	if (el->el_tty.t_mode == EX_IO)
 		el->el_tty.t_ex = el->el_tty.t_ts;
 
-	if (tty_setty(el, &el->el_tty.t_ed) == -1) {
+	if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ed) == -1) {
 #ifdef DEBUG_TTY
 		(void) fprintf(el->el_errfile, "tty_rawmode: tty_setty: %s\n",
 		    strerror(errno));
@@ -1021,7 +1044,7 @@
 	if (el->el_flags & EDIT_DISABLED)
 		return (0);
 
-	if (tty_setty(el, &el->el_tty.t_ex) == -1) {
+	if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ex) == -1) {
 #ifdef DEBUG_TTY
 		(void) fprintf(el->el_errfile,
 		    "tty_cookedmode: tty_setty: %s\n",
@@ -1057,7 +1080,7 @@
 	el->el_tty.t_qu.c_lflag &= ~el->el_tty.t_t[QU_IO][MD_LIN].t_clrmask;
 	el->el_tty.t_qu.c_lflag |= el->el_tty.t_t[QU_IO][MD_LIN].t_setmask;
 
-	if (tty_setty(el, &el->el_tty.t_qu) == -1) {
+	if (tty_setty(el, TCSADRAIN, &el->el_tty.t_qu) == -1) {
 #ifdef DEBUG_TTY
 		(void) fprintf(el->el_errfile, "QuoteModeOn: tty_setty: %s\n",
 		    strerror(errno));
@@ -1078,7 +1101,7 @@
 
 	if (el->el_tty.t_mode != QU_IO)
 		return (0);
-	if (tty_setty(el, &el->el_tty.t_ed) == -1) {
+	if (tty_setty(el, TCSADRAIN, &el->el_tty.t_ed) == -1) {
 #ifdef DEBUG_TTY
 		(void) fprintf(el->el_errfile, "QuoteModeOff: tty_setty: %s\n",
 		    strerror(errno));
@@ -1139,7 +1162,7 @@
 
 	if (!argv || !*argv) {
 		int i = -1;
-		int len = 0, st = 0, cu;
+		size_t len = 0, st = 0, cu;
 		for (m = ttymodes; m->m_name; m++) {
 			if (m->m_type != i) {
 				(void) fprintf(el->el_outfile, "%s%s",
@@ -1162,9 +1185,9 @@
 
 				cu = strlen(m->m_name) + (x != '\0') + 1;
 
-				if (len + cu >= el->el_term.t_size.h) {
+				if (len + cu >= (size_t)el->el_term.t_size.h) {
 					(void) fprintf(el->el_outfile, "\n%*s",
-					    st, "");
+					    (int)st, "");
 					len = st + cu;
 				} else
 					len += cu;
@@ -1208,7 +1231,8 @@
 			int c = ffs((int)m->m_value);
 			int v = *++p ? parse__escape((const char **) &p) :
 			    el->el_tty.t_vdisable;
-			assert(c-- != 0);
+			assert(c != 0);
+			c--;
 			c = tty__getcharindex(c);
 			assert(c != -1);
 			tios->c_cc[c] = v;
@@ -1229,6 +1253,17 @@
 			break;
 		}
 	}
+
+	if (el->el_tty.t_mode == z) {
+		if (tty_setty(el, TCSADRAIN, tios) == -1) {
+#ifdef DEBUG_TTY
+			(void) fprintf(el->el_errfile,
+			    "tty_stty: tty_setty: %s\n", strerror(errno));
+#endif /* DEBUG_TTY */
+			return (-1);
+		}
+	}
+
 	return (0);
 }
 



More information about the Midnightbsd-cvs mailing list