Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Sep 2017 15:57:58 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org
Subject:   svn commit: r323545 - in vendor/NetBSD/libedit/dist: . TEST readline
Message-ID:  <201709131557.v8DFvwXv094063@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Wed Sep 13 15:57:58 2017
New Revision: 323545
URL: https://svnweb.freebsd.org/changeset/base/323545

Log:
  Import libedit 2017-09-05
  
  Obtained from:	NetBSD

Added:
  vendor/NetBSD/libedit/dist/editline.7   (contents, props changed)
  vendor/NetBSD/libedit/dist/historyn.c   (contents, props changed)
  vendor/NetBSD/libedit/dist/literal.c   (contents, props changed)
  vendor/NetBSD/libedit/dist/literal.h   (contents, props changed)
  vendor/NetBSD/libedit/dist/tokenizern.c   (contents, props changed)
Modified:
  vendor/NetBSD/libedit/dist/Makefile
  vendor/NetBSD/libedit/dist/TEST/Makefile
  vendor/NetBSD/libedit/dist/chared.c
  vendor/NetBSD/libedit/dist/chared.h
  vendor/NetBSD/libedit/dist/chartype.c
  vendor/NetBSD/libedit/dist/chartype.h
  vendor/NetBSD/libedit/dist/common.c
  vendor/NetBSD/libedit/dist/config.h
  vendor/NetBSD/libedit/dist/editline.3
  vendor/NetBSD/libedit/dist/editrc.5
  vendor/NetBSD/libedit/dist/el.c
  vendor/NetBSD/libedit/dist/el.h
  vendor/NetBSD/libedit/dist/eln.c
  vendor/NetBSD/libedit/dist/emacs.c
  vendor/NetBSD/libedit/dist/filecomplete.c
  vendor/NetBSD/libedit/dist/filecomplete.h
  vendor/NetBSD/libedit/dist/hist.c
  vendor/NetBSD/libedit/dist/hist.h
  vendor/NetBSD/libedit/dist/histedit.h
  vendor/NetBSD/libedit/dist/history.c
  vendor/NetBSD/libedit/dist/keymacro.c
  vendor/NetBSD/libedit/dist/keymacro.h
  vendor/NetBSD/libedit/dist/makelist
  vendor/NetBSD/libedit/dist/map.c
  vendor/NetBSD/libedit/dist/map.h
  vendor/NetBSD/libedit/dist/parse.c
  vendor/NetBSD/libedit/dist/parse.h
  vendor/NetBSD/libedit/dist/prompt.c
  vendor/NetBSD/libedit/dist/prompt.h
  vendor/NetBSD/libedit/dist/read.c
  vendor/NetBSD/libedit/dist/read.h
  vendor/NetBSD/libedit/dist/readline.c
  vendor/NetBSD/libedit/dist/readline/readline.h
  vendor/NetBSD/libedit/dist/refresh.c
  vendor/NetBSD/libedit/dist/refresh.h
  vendor/NetBSD/libedit/dist/search.c
  vendor/NetBSD/libedit/dist/search.h
  vendor/NetBSD/libedit/dist/sig.c
  vendor/NetBSD/libedit/dist/sig.h
  vendor/NetBSD/libedit/dist/sys.h
  vendor/NetBSD/libedit/dist/terminal.c
  vendor/NetBSD/libedit/dist/terminal.h
  vendor/NetBSD/libedit/dist/tokenizer.c
  vendor/NetBSD/libedit/dist/tty.c
  vendor/NetBSD/libedit/dist/tty.h
  vendor/NetBSD/libedit/dist/vi.c

Modified: vendor/NetBSD/libedit/dist/Makefile
==============================================================================
--- vendor/NetBSD/libedit/dist/Makefile	Wed Sep 13 15:44:54 2017	(r323544)
+++ vendor/NetBSD/libedit/dist/Makefile	Wed Sep 13 15:57:58 2017	(r323545)
@@ -1,9 +1,8 @@
-#	$NetBSD: Makefile,v 1.56 2016/03/02 19:24:20 christos Exp $
+#	$NetBSD: Makefile,v 1.65 2017/06/30 20:26:52 kre Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/4/93
 
 USE_SHLIBDIR=	yes
 
-WIDECHAR ?= yes
 WARNS?=	5
 LIB=	edit
 
@@ -15,55 +14,80 @@ COPTS+=	-Wunused-parameter
 CWARNFLAGS.gcc+=	-Wconversion
 CWARNFLAGS.clang+=	-Wno-cast-qual
 
-OSRCS=	chared.c common.c el.c eln.c emacs.c fcns.c filecomplete.c help.c \
-	hist.c keymacro.c map.c chartype.c \
-	parse.c prompt.c read.c refresh.c search.c sig.c terminal.c tty.c vi.c
+SRCS =	chared.c chartype.c common.c el.c eln.c emacs.c filecomplete.c \
+	hist.c history.c historyn.c keymacro.c literal.c map.c \
+	parse.c prompt.c read.c readline.c refresh.c search.c sig.c \
+	terminal.c tokenizer.c tokenizern.c tty.c vi.c
 
-MAN=	editline.3 editrc.5
+MAN=	editline.3 editrc.5 editline.7
 
-MLINKS=	editline.3 el_init.3 editline.3 el_end.3 editline.3 el_reset.3 \
-	editline.3 el_gets.3 editline.3 el_getc.3 editline.3 el_push.3 \
-	editline.3 el_parse.3 editline.3 el_set.3 editline.3 el_get.3 \
-	editline.3 el_source.3 editline.3 el_resize.3 editline.3 el_line.3 \
-	editline.3 el_insertstr.3 editline.3 el_deletestr.3 \
-	editline.3 history_init.3 editline.3 history_end.3 \
-	editline.3 history.3 \
-	editline.3 tok_init.3 editline.3 tok_end.3 editline.3 tok_reset.3 \
-	editline.3 tok_line.3 editline.3 tok_str.3
+MLINKS= \
+editline.3 el_deletestr.3 \
+editline.3 el_end.3 \
+editline.3 el_get.3 \
+editline.3 el_getc.3 \
+editline.3 el_gets.3 \
+editline.3 el_init.3 \
+editline.3 el_init_fd.3 \
+editline.3 el_insertstr.3 \
+editline.3 el_line.3 \
+editline.3 el_parse.3 \
+editline.3 el_push.3 \
+editline.3 el_reset.3 \
+editline.3 el_resize.3 \
+editline.3 el_set.3 \
+editline.3 el_source.3 \
+editline.3 history.3 \
+editline.3 history_end.3 \
+editline.3 history_init.3 \
+editline.3 tok_end.3 \
+editline.3 tok_init.3 \
+editline.3 tok_line.3 \
+editline.3 tok_reset.3 \
+editline.3 tok_str.3
 
-# For speed and debugging
-#SRCS=   ${OSRCS} readline.c tokenizer.c history.c
-# For protection
-SRCS=	editline.c readline.c tokenizer.c history.c
+MLINKS+= \
+editline.3 el_wdeletestr.3 \
+editline.3 el_wget.3 \
+editline.3 el_wgetc.3 \
+editline.3 el_wgets.3 \
+editline.3 el_winsertstr.3 \
+editline.3 el_wline.3 \
+editline.3 el_wparse.3 \
+editline.3 el_wpush.3 \
+editline.3 el_wset.3 \
+editline.3 history_w.3 \
+editline.3 history_wend.3 \
+editline.3 history_winit.3 \
+editline.3 tok_wend.3 \
+editline.3 tok_winit.3 \
+editline.3 tok_wline.3 \
+editline.3 tok_wreset.3 \
+editline.3 tok_wstr.3
 
-.if ${WIDECHAR} == "yes"
-SRCS += tokenizern.c historyn.c
-CLEANFILES+=tokenizern.c.tmp tokenizern.c historyn.c.tmp historyn.c
-CPPFLAGS+=-DWIDECHAR
-.endif
-
 LIBEDITDIR?=${.CURDIR}
 
 INCS= histedit.h
 INCSDIR=/usr/include
 
-CLEANFILES+=editline.c
-CLEANFILES+=common.h.tmp editline.c.tmp emacs.h.tmp fcns.c.tmp fcns.h.tmp
-CLEANFILES+=help.c.tmp help.h.tmp vi.h.tmp tc1.o tc1
-CLEANFILES+=tokenizern.c.tmp tokenizern.c tokenizerw.c.tmp tokenizerw.c
+CLEANFILES+=common.h.tmp emacs.h.tmp fcns.h.tmp func.h.tmp
+CLEANFILES+=help.h.tmp vi.h.tmp tc1.o tc1 .depend
+
 CPPFLAGS+=-I. -I${LIBEDITDIR}
 CPPFLAGS+=-I. -I${.CURDIR}
-#CPPFLAGS+=-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
+#CPPFLAGS+=-DDEBUG_TTY -DDEBUG_KEY -DDEBUG -DDEBUG_REFRESH
 #CPPFLAGS+=-DDEBUG_PASTE -DDEBUG_EDIT
 
 AHDR=vi.h emacs.h common.h
 ASRC=${LIBEDITDIR}/vi.c ${LIBEDITDIR}/emacs.c ${LIBEDITDIR}/common.c
 
-DPSRCS+=	${AHDR} fcns.h help.h fcns.c help.c
-CLEANFILES+=	${AHDR} fcns.h help.h fcns.c help.c
+DPSRCS+=	${AHDR} fcns.h func.h help.h
+CLEANFILES+=	${AHDR} fcns.h func.h help.h
 
 SUBDIR=	readline
 
+.depend: ${AHDR} fcns.h func.h help.h
+
 vi.h: vi.c makelist Makefile
 	${_MKTARGET_CREATE}
 	${HOST_SH} ${LIBEDITDIR}/makelist -h ${LIBEDITDIR}/vi.c \
@@ -87,36 +111,16 @@ fcns.h: ${AHDR} makelist Makefile
 	${HOST_SH} ${LIBEDITDIR}/makelist -fh ${AHDR} > ${.TARGET}.tmp && \
 	    mv ${.TARGET}.tmp ${.TARGET}
 
-fcns.c: ${AHDR} fcns.h help.h makelist Makefile
+func.h: ${AHDR} makelist Makefile
 	${_MKTARGET_CREATE}
 	${HOST_SH} ${LIBEDITDIR}/makelist -fc ${AHDR} > ${.TARGET}.tmp && \
 	    mv ${.TARGET}.tmp ${.TARGET}
 
-help.c: ${ASRC} makelist Makefile
-	${_MKTARGET_CREATE}
-	${HOST_SH} ${LIBEDITDIR}/makelist -bc ${ASRC} > ${.TARGET}.tmp && \
-	    mv ${.TARGET}.tmp ${.TARGET}
-
 help.h: ${ASRC} makelist Makefile
 	${_MKTARGET_CREATE}
 	${HOST_SH} ${LIBEDITDIR}/makelist -bh ${ASRC} > ${.TARGET}.tmp && \
 	    mv ${.TARGET}.tmp ${.TARGET}
 
-editline.c: ${OSRCS} makelist Makefile
-	${_MKTARGET_CREATE}
-	${HOST_SH} ${LIBEDITDIR}/makelist -e ${OSRCS:T} > ${.TARGET}.tmp && \
-	    mv ${.TARGET}.tmp ${.TARGET}
-
-tokenizern.c: makelist Makefile
-	${_MKTARGET_CREATE}
-	${HOST_SH} ${LIBEDITDIR}/makelist -n tokenizer.c > ${.TARGET}.tmp && \
-	    mv ${.TARGET}.tmp ${.TARGET}
-
-historyn.c: makelist Makefile
-	${_MKTARGET_CREATE}
-	${HOST_SH} ${LIBEDITDIR}/makelist -n history.c > ${.TARGET}.tmp && \
-	    mv ${.TARGET}.tmp ${.TARGET}
-
 tc1.o:	${LIBEDITDIR}/TEST/tc1.c
 
 tc1:	libedit.a tc1.o
@@ -129,6 +133,7 @@ tc1:	libedit.a tc1.o
 # XXX
 .if defined(HAVE_GCC)
 COPTS.editline.c+=	-Wno-cast-qual
+COPTS.literal.c+=	-Wno-sign-conversion
 COPTS.tokenizer.c+=	-Wno-cast-qual
 COPTS.tokenizern.c+=	-Wno-cast-qual
 .endif

Modified: vendor/NetBSD/libedit/dist/TEST/Makefile
==============================================================================
--- vendor/NetBSD/libedit/dist/TEST/Makefile	Wed Sep 13 15:44:54 2017	(r323544)
+++ vendor/NetBSD/libedit/dist/TEST/Makefile	Wed Sep 13 15:57:58 2017	(r323545)
@@ -1,16 +1,10 @@
-# $NetBSD: Makefile,v 1.6 2016/02/15 21:38:07 christos Exp $
+# $NetBSD: Makefile,v 1.7 2016/03/23 22:27:48 christos Exp $
 
-WIDECHAR ?= yes
-
 NOMAN=1
 PROG=wtc1
 CPPFLAGS=-I${.CURDIR}/..
 LDADD+=-ledit -ltermlib
 DPADD+=${LIBEDIT} ${LIBTERMLIB}
-
-.if "${WIDECHAR}" == "yes"
-CPPFLAGS+=-DWIDECHAR
-.endif
 
 .ifdef DEBUG
 CPPFLAGS+=-DDEBUG

Modified: vendor/NetBSD/libedit/dist/chared.c
==============================================================================
--- vendor/NetBSD/libedit/dist/chared.c	Wed Sep 13 15:44:54 2017	(r323544)
+++ vendor/NetBSD/libedit/dist/chared.c	Wed Sep 13 15:57:58 2017	(r323545)
@@ -1,4 +1,4 @@
-/*	$NetBSD: chared.c,v 1.49 2016/02/24 14:29:21 christos Exp $	*/
+/*	$NetBSD: chared.c,v 1.56 2016/05/22 19:44:26 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)chared.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: chared.c,v 1.49 2016/02/24 14:29:21 christos Exp $");
+__RCSID("$NetBSD: chared.c,v 1.56 2016/05/22 19:44:26 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
@@ -50,16 +50,15 @@ __RCSID("$NetBSD: chared.c,v 1.49 2016/02/24 14:29:21 
 
 #include "el.h"
 #include "common.h"
+#include "fcns.h"
 
-private void ch__clearmacro (EditLine *);
-
 /* value to leave unused in line buffer */
 #define	EL_LEAVE	2
 
 /* cv_undo():
  *	Handle state for the vi undo command
  */
-protected void
+libedit_private void
 cv_undo(EditLine *el)
 {
 	c_undo_t *vu = &el->el_chared.c_undo;
@@ -83,8 +82,8 @@ cv_undo(EditLine *el)
 /* cv_yank():
  *	Save yank/delete data for paste
  */
-protected void
-cv_yank(EditLine *el, const Char *ptr, int size)
+libedit_private void
+cv_yank(EditLine *el, const wchar_t *ptr, int size)
 {
 	c_kill_t *k = &el->el_chared.c_kill;
 
@@ -96,10 +95,10 @@ cv_yank(EditLine *el, const Char *ptr, int size)
 /* c_insert():
  *	Insert num characters
  */
-protected void
+libedit_private void
 c_insert(EditLine *el, int num)
 {
-	Char *cp;
+	wchar_t *cp;
 
 	if (el->el_line.lastchar + num >= el->el_line.limit) {
 		if (!ch_enlargebufs(el, (size_t)num))
@@ -118,7 +117,7 @@ c_insert(EditLine *el, int num)
 /* c_delafter():
  *	Delete num characters after the cursor
  */
-protected void
+libedit_private void
 c_delafter(EditLine *el, int num)
 {
 
@@ -131,7 +130,7 @@ c_delafter(EditLine *el, int num)
 	}
 
 	if (num > 0) {
-		Char *cp;
+		wchar_t *cp;
 
 		for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++)
 			*cp = cp[num];
@@ -144,10 +143,10 @@ c_delafter(EditLine *el, int num)
 /* c_delafter1():
  *	Delete the character after the cursor, do not yank
  */
-protected void
+libedit_private void
 c_delafter1(EditLine *el)
 {
-	Char *cp;
+	wchar_t *cp;
 
 	for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++)
 		*cp = cp[1];
@@ -159,7 +158,7 @@ c_delafter1(EditLine *el)
 /* c_delbefore():
  *	Delete num characters before the cursor
  */
-protected void
+libedit_private void
 c_delbefore(EditLine *el, int num)
 {
 
@@ -172,7 +171,7 @@ c_delbefore(EditLine *el, int num)
 	}
 
 	if (num > 0) {
-		Char *cp;
+		wchar_t *cp;
 
 		for (cp = el->el_line.cursor - num;
 		    cp <= el->el_line.lastchar;
@@ -187,10 +186,10 @@ c_delbefore(EditLine *el, int num)
 /* c_delbefore1():
  *	Delete the character before the cursor, do not yank
  */
-protected void
+libedit_private void
 c_delbefore1(EditLine *el)
 {
-	Char *cp;
+	wchar_t *cp;
 
 	for (cp = el->el_line.cursor - 1; cp <= el->el_line.lastchar; cp++)
 		*cp = cp[1];
@@ -202,22 +201,22 @@ c_delbefore1(EditLine *el)
 /* ce__isword():
  *	Return if p is part of a word according to emacs
  */
-protected int
+libedit_private int
 ce__isword(wint_t p)
 {
-	return Isalnum(p) || Strchr(STR("*?_-.[]~="), p) != NULL;
+	return iswalnum(p) || wcschr(L"*?_-.[]~=", p) != NULL;
 }
 
 
 /* cv__isword():
  *	Return if p is part of a word according to vi
  */
-protected int
+libedit_private int
 cv__isword(wint_t p)
 {
-	if (Isalnum(p) || p == '_')
+	if (iswalnum(p) || p == L'_')
 		return 1;
-	if (Isgraph(p))
+	if (iswgraph(p))
 		return 2;
 	return 0;
 }
@@ -226,18 +225,18 @@ cv__isword(wint_t p)
 /* cv__isWord():
  *	Return if p is part of a big word according to vi
  */
-protected int
+libedit_private int
 cv__isWord(wint_t p)
 {
-	return !Isspace(p);
+	return !iswspace(p);
 }
 
 
 /* c__prev_word():
  *	Find the previous word
  */
-protected Char *
-c__prev_word(Char *p, Char *low, int n, int (*wtest)(wint_t))
+libedit_private wchar_t *
+c__prev_word(wchar_t *p, wchar_t *low, int n, int (*wtest)(wint_t))
 {
 	p--;
 
@@ -260,8 +259,8 @@ c__prev_word(Char *p, Char *low, int n, int (*wtest)(w
 /* c__next_word():
  *	Find the next word
  */
-protected Char *
-c__next_word(Char *p, Char *high, int n, int (*wtest)(wint_t))
+libedit_private wchar_t *
+c__next_word(wchar_t *p, wchar_t *high, int n, int (*wtest)(wint_t))
 {
 	while (n--) {
 		while ((p < high) && !(*wtest)(*p))
@@ -278,8 +277,9 @@ c__next_word(Char *p, Char *high, int n, int (*wtest)(
 /* cv_next_word():
  *	Find the next word vi style
  */
-protected Char *
-cv_next_word(EditLine *el, Char *p, Char *high, int n, int (*wtest)(wint_t))
+libedit_private wchar_t *
+cv_next_word(EditLine *el, wchar_t *p, wchar_t *high, int n,
+    int (*wtest)(wint_t))
 {
 	int test;
 
@@ -292,7 +292,7 @@ cv_next_word(EditLine *el, Char *p, Char *high, int n,
 		 * trailing whitespace! This is not what 'w' does..
 		 */
 		if (n || el->el_chared.c_vcmd.action != (DELETE|INSERT))
-			while ((p < high) && Isspace(*p))
+			while ((p < high) && iswspace(*p))
 				p++;
 	}
 
@@ -307,14 +307,14 @@ cv_next_word(EditLine *el, Char *p, Char *high, int n,
 /* cv_prev_word():
  *	Find the previous word vi style
  */
-protected Char *
-cv_prev_word(Char *p, Char *low, int n, int (*wtest)(wint_t))
+libedit_private wchar_t *
+cv_prev_word(wchar_t *p, wchar_t *low, int n, int (*wtest)(wint_t))
 {
 	int test;
 
 	p--;
 	while (n--) {
-		while ((p > low) && Isspace(*p))
+		while ((p > low) && iswspace(*p))
 			p--;
 		test = (*wtest)(*p);
 		while ((p >= low) && (*wtest)(*p) == test)
@@ -333,7 +333,7 @@ cv_prev_word(Char *p, Char *low, int n, int (*wtest)(w
 /* cv_delfini():
  *	Finish vi delete action
  */
-protected void
+libedit_private void
 cv_delfini(EditLine *el)
 {
 	int size;
@@ -371,15 +371,15 @@ cv_delfini(EditLine *el)
 /* cv__endword():
  *	Go to the end of this word according to vi
  */
-protected Char *
-cv__endword(Char *p, Char *high, int n, int (*wtest)(wint_t))
+libedit_private wchar_t *
+cv__endword(wchar_t *p, wchar_t *high, int n, int (*wtest)(wint_t))
 {
 	int test;
 
 	p++;
 
 	while (n--) {
-		while ((p < high) && Isspace(*p))
+		while ((p < high) && iswspace(*p))
 			p++;
 
 		test = (*wtest)(*p);
@@ -393,11 +393,9 @@ cv__endword(Char *p, Char *high, int n, int (*wtest)(w
 /* ch_init():
  *	Initialize the character editor
  */
-protected int
+libedit_private int
 ch_init(EditLine *el)
 {
-	c_macro_t *ma = &el->el_chared.c_macro;
-
 	el->el_line.buffer		= el_malloc(EL_BUFSIZ *
 	    sizeof(*el->el_line.buffer));
 	if (el->el_line.buffer == NULL)
@@ -449,19 +447,14 @@ ch_init(EditLine *el)
 	el->el_state.argument		= 1;
 	el->el_state.lastcmd		= ED_UNASSIGNED;
 
-	ma->level	= -1;
-	ma->offset	= 0;
-	ma->macro	= el_malloc(EL_MAXMACRO * sizeof(*ma->macro));
-	if (ma->macro == NULL)
-		return -1;
 	return 0;
 }
 
 /* ch_reset():
  *	Reset the character editor
  */
-protected void
-ch_reset(EditLine *el, int mclear)
+libedit_private void
+ch_reset(EditLine *el)
 {
 	el->el_line.cursor		= el->el_line.buffer;
 	el->el_line.lastchar		= el->el_line.buffer;
@@ -483,28 +476,17 @@ ch_reset(EditLine *el, int mclear)
 	el->el_state.lastcmd		= ED_UNASSIGNED;
 
 	el->el_history.eventno		= 0;
-
-	if (mclear)
-		ch__clearmacro(el);
 }
 
-private void
-ch__clearmacro(EditLine *el)
-{
-	c_macro_t *ma = &el->el_chared.c_macro;
-	while (ma->level >= 0)
-		el_free(ma->macro[ma->level--]);
-}
-
 /* ch_enlargebufs():
  *	Enlarge line buffer to be able to hold twice as much characters.
  *	Returns 1 if successful, 0 if not.
  */
-protected int
+libedit_private int
 ch_enlargebufs(EditLine *el, size_t addlen)
 {
 	size_t sz, newsz;
-	Char *newbuffer, *oldbuf, *oldkbuf;
+	wchar_t *newbuffer, *oldbuf, *oldkbuf;
 
 	sz = (size_t)(el->el_line.limit - el->el_line.buffer + EL_LEAVE);
 	newsz = sz * 2;
@@ -589,7 +571,7 @@ ch_enlargebufs(EditLine *el, size_t addlen)
 /* ch_end():
  *	Free the data structures used by the editor
  */
-protected void
+libedit_private void
 ch_end(EditLine *el)
 {
 	el_free(el->el_line.buffer);
@@ -604,21 +586,19 @@ ch_end(EditLine *el)
 	el->el_chared.c_redo.cmd = ED_UNASSIGNED;
 	el_free(el->el_chared.c_kill.buf);
 	el->el_chared.c_kill.buf = NULL;
-	ch_reset(el, 1);
-	el_free(el->el_chared.c_macro.macro);
-	el->el_chared.c_macro.macro = NULL;
+	ch_reset(el);
 }
 
 
 /* el_insertstr():
  *	Insert string at cursorI
  */
-public int
-FUN(el,insertstr)(EditLine *el, const Char *s)
+int
+el_winsertstr(EditLine *el, const wchar_t *s)
 {
 	size_t len;
 
-	if (s == NULL || (len = Strlen(s)) == 0)
+	if (s == NULL || (len = wcslen(s)) == 0)
 		return -1;
 	if (el->el_line.lastchar + len >= el->el_line.limit) {
 		if (!ch_enlargebufs(el, len))
@@ -635,7 +615,7 @@ FUN(el,insertstr)(EditLine *el, const Char *s)
 /* el_deletestr():
  *	Delete num characters before the cursor
  */
-public void
+void
 el_deletestr(EditLine *el, int n)
 {
 	if (n <= 0)
@@ -653,7 +633,7 @@ el_deletestr(EditLine *el, int n)
 /* el_cursor():
  *	Move the cursor to the left or the right of the current position
  */
-public int
+int
 el_cursor(EditLine *el, int n)
 {
 	if (n == 0)
@@ -672,15 +652,14 @@ out:
 /* c_gets():
  *	Get a string
  */
-protected int
-c_gets(EditLine *el, Char *buf, const Char *prompt)
+libedit_private int
+c_gets(EditLine *el, wchar_t *buf, const wchar_t *prompt)
 {
-	wchar_t wch;
 	ssize_t len;
-	Char *cp = el->el_line.buffer, ch;
+	wchar_t *cp = el->el_line.buffer, ch;
 
 	if (prompt) {
-		len = (ssize_t)Strlen(prompt);
+		len = (ssize_t)wcslen(prompt);
 		(void)memcpy(cp, prompt, (size_t)len * sizeof(*cp));
 		cp += len;
 	}
@@ -692,12 +671,11 @@ c_gets(EditLine *el, Char *buf, const Char *prompt)
 		el->el_line.lastchar = cp + 1;
 		re_refresh(el);
 
-		if (el_wgetc(el, &wch) != 1) {
+		if (el_wgetc(el, &ch) != 1) {
 			ed_end_of_file(el, 0);
 			len = -1;
 			break;
 		}
-		ch = (Char)wch;
 
 		switch (ch) {
 
@@ -739,10 +717,10 @@ c_gets(EditLine *el, Char *buf, const Char *prompt)
 /* c_hpos():
  *	Return the current horizontal position of the cursor
  */
-protected int
+libedit_private int
 c_hpos(EditLine *el)
 {
-	Char *ptr;
+	wchar_t *ptr;
 
 	/*
 	 * Find how many characters till the beginning of this line.
@@ -758,7 +736,7 @@ c_hpos(EditLine *el)
 	}
 }
 
-protected int
+libedit_private int
 ch_resizefun(EditLine *el, el_zfunc_t f, void *a)
 {
 	el->el_chared.c_resizefun = f;
@@ -766,7 +744,7 @@ ch_resizefun(EditLine *el, el_zfunc_t f, void *a)
 	return 0;
 }
 
-protected int
+libedit_private int
 ch_aliasfun(EditLine *el, el_afunc_t f, void *a)
 {
 	el->el_chared.c_aliasfun = f;

Modified: vendor/NetBSD/libedit/dist/chared.h
==============================================================================
--- vendor/NetBSD/libedit/dist/chared.h	Wed Sep 13 15:44:54 2017	(r323544)
+++ vendor/NetBSD/libedit/dist/chared.h	Wed Sep 13 15:57:58 2017	(r323545)
@@ -1,4 +1,4 @@
-/*	$NetBSD: chared.h,v 1.27 2016/02/16 22:53:14 christos Exp $	*/
+/*	$NetBSD: chared.h,v 1.30 2016/05/22 19:44:26 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -40,8 +40,6 @@
 #ifndef _h_el_chared
 #define	_h_el_chared
 
-#define	EL_MAXMACRO	10
-
 /*
  * 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
@@ -54,29 +52,22 @@
  */
 #define	VI_MOVE
 
-
-typedef struct c_macro_t {
-	int	  level;
-	int	  offset;
-	Char	**macro;
-} c_macro_t;
-
 /*
  * Undo information for vi - no undo in emacs (yet)
  */
 typedef struct c_undo_t {
 	ssize_t	 len;			/* length of saved line */
 	int	 cursor;		/* position of saved cursor */
-	Char	*buf;			/* full saved text */
+	wchar_t	*buf;			/* full saved text */
 } c_undo_t;
 
 /* redo for vi */
 typedef struct c_redo_t {
-	Char	*buf;			/* redo insert key sequence */
-	Char	*pos;
-	Char	*lim;
+	wchar_t	*buf;			/* redo insert key sequence */
+	wchar_t	*pos;
+	wchar_t	*lim;
 	el_action_t	cmd;		/* command to redo */
-	Char	ch;			/* char that invoked it */
+	wchar_t	ch;			/* char that invoked it */
 	int	count;
 	int	action;			/* from cv_action() */
 } c_redo_t;
@@ -86,16 +77,16 @@ typedef struct c_redo_t {
  */
 typedef struct c_vcmd_t {
 	int	 action;
-	Char	*pos;
+	wchar_t	*pos;
 } c_vcmd_t;
 
 /*
  * Kill buffer for emacs
  */
 typedef struct c_kill_t {
-	Char	*buf;
-	Char	*last;
-	Char	*mark;
+	wchar_t	*buf;
+	wchar_t	*last;
+	wchar_t	*mark;
 } c_kill_t;
 
 typedef void (*el_zfunc_t)(EditLine *, void *);
@@ -110,7 +101,6 @@ typedef struct el_chared_t {
 	c_kill_t	c_kill;
 	c_redo_t	c_redo;
 	c_vcmd_t	c_vcmd;
-	c_macro_t	c_macro;
 	el_zfunc_t	c_resizefun;
 	el_afunc_t	c_aliasfun;
 	void *		c_resizearg;
@@ -135,30 +125,31 @@ typedef struct el_chared_t {
 #define	MODE_REPLACE_1	2
 
 
-protected int	 cv__isword(wint_t);
-protected int	 cv__isWord(wint_t);
-protected void	 cv_delfini(EditLine *);
-protected Char	*cv__endword(Char *, Char *, int, int (*)(wint_t));
-protected int	 ce__isword(wint_t);
-protected void	 cv_undo(EditLine *);
-protected void	 cv_yank(EditLine *, const Char *, int);
-protected Char	*cv_next_word(EditLine*, Char *, Char *, int, int (*)(wint_t));
-protected Char	*cv_prev_word(Char *, Char *, int, int (*)(wint_t));
-protected Char	*c__next_word(Char *, Char *, int, int (*)(wint_t));
-protected Char	*c__prev_word(Char *, Char *, int, int (*)(wint_t));
-protected void	 c_insert(EditLine *, int);
-protected void	 c_delbefore(EditLine *, int);
-protected void	 c_delbefore1(EditLine *);
-protected void	 c_delafter(EditLine *, int);
-protected void	 c_delafter1(EditLine *);
-protected int	 c_gets(EditLine *, Char *, const Char *);
-protected int	 c_hpos(EditLine *);
+libedit_private int	 cv__isword(wint_t);
+libedit_private int	 cv__isWord(wint_t);
+libedit_private void	 cv_delfini(EditLine *);
+libedit_private wchar_t *cv__endword(wchar_t *, wchar_t *, int, int (*)(wint_t));
+libedit_private int	 ce__isword(wint_t);
+libedit_private void	 cv_undo(EditLine *);
+libedit_private void	 cv_yank(EditLine *, const wchar_t *, int);
+libedit_private wchar_t *cv_next_word(EditLine*, wchar_t *, wchar_t *, int,
+			int (*)(wint_t));
+libedit_private wchar_t *cv_prev_word(wchar_t *, wchar_t *, int, int (*)(wint_t));
+libedit_private wchar_t *c__next_word(wchar_t *, wchar_t *, int, int (*)(wint_t));
+libedit_private wchar_t *c__prev_word(wchar_t *, wchar_t *, int, int (*)(wint_t));
+libedit_private void	 c_insert(EditLine *, int);
+libedit_private void	 c_delbefore(EditLine *, int);
+libedit_private void	 c_delbefore1(EditLine *);
+libedit_private void	 c_delafter(EditLine *, int);
+libedit_private void	 c_delafter1(EditLine *);
+libedit_private int	 c_gets(EditLine *, wchar_t *, const wchar_t *);
+libedit_private int	 c_hpos(EditLine *);
 
-protected int	 ch_init(EditLine *);
-protected void	 ch_reset(EditLine *, int);
-protected int	 ch_resizefun(EditLine *, el_zfunc_t, void *);
-protected int	 ch_aliasfun(EditLine *, el_afunc_t, void *);
-protected int	 ch_enlargebufs(EditLine *, size_t);
-protected void	 ch_end(EditLine *);
+libedit_private int	 ch_init(EditLine *);
+libedit_private void	 ch_reset(EditLine *);
+libedit_private int	 ch_resizefun(EditLine *, el_zfunc_t, void *);
+libedit_private int	 ch_aliasfun(EditLine *, el_afunc_t, void *);
+libedit_private int	 ch_enlargebufs(EditLine *, size_t);
+libedit_private void	 ch_end(EditLine *);
 
 #endif /* _h_el_chared */

Modified: vendor/NetBSD/libedit/dist/chartype.c
==============================================================================
--- vendor/NetBSD/libedit/dist/chartype.c	Wed Sep 13 15:44:54 2017	(r323544)
+++ vendor/NetBSD/libedit/dist/chartype.c	Wed Sep 13 15:57:58 2017	(r323545)
@@ -1,4 +1,4 @@
-/*	$NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $	*/
+/*	$NetBSD: chartype.c,v 1.31 2017/01/09 02:54:18 christos Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $");
+__RCSID("$NetBSD: chartype.c,v 1.31 2017/01/09 02:54:18 christos Exp $");
 #endif /* not lint && not SCCSID */
 
 #include <ctype.h>
@@ -42,8 +42,10 @@ __RCSID("$NetBSD: chartype.c,v 1.23 2016/02/28 23:02:2
 
 #define CT_BUFSIZ ((size_t)1024)
 
-#ifdef WIDECHAR
-protected int
+static int ct_conv_cbuff_resize(ct_buffer_t *, size_t);
+static int ct_conv_wbuff_resize(ct_buffer_t *, size_t);
+
+static int
 ct_conv_cbuff_resize(ct_buffer_t *conv, size_t csize)
 {
 	void *p;
@@ -64,7 +66,7 @@ ct_conv_cbuff_resize(ct_buffer_t *conv, size_t csize)
 	return 0;
 }
 
-protected int
+static int
 ct_conv_wbuff_resize(ct_buffer_t *conv, size_t wsize)
 {
 	void *p;
@@ -86,8 +88,8 @@ ct_conv_wbuff_resize(ct_buffer_t *conv, size_t wsize)
 }
 
 
-public char *
-ct_encode_string(const Char *s, ct_buffer_t *conv)
+char *
+ct_encode_string(const wchar_t *s, ct_buffer_t *conv)
 {
 	char *dst;
 	ssize_t used;
@@ -116,7 +118,7 @@ ct_encode_string(const Char *s, ct_buffer_t *conv)
 	return conv->cbuff;
 }
 
-public Char *
+wchar_t *
 ct_decode_string(const char *s, ct_buffer_t *conv)
 {
 	size_t len;
@@ -124,7 +126,7 @@ ct_decode_string(const char *s, ct_buffer_t *conv)
 	if (!s)
 		return NULL;
 
-	len = ct_mbstowcs(NULL, s, (size_t)0);
+	len = mbstowcs(NULL, s, (size_t)0);
 	if (len == (size_t)-1)
 		return NULL;
 
@@ -132,18 +134,18 @@ ct_decode_string(const char *s, ct_buffer_t *conv)
 		if (ct_conv_wbuff_resize(conv, len + CT_BUFSIZ) == -1)
 			return NULL;
 
-	ct_mbstowcs(conv->wbuff, s, conv->wsize);
+	mbstowcs(conv->wbuff, s, conv->wsize);
 	return conv->wbuff;
 }
 
 
-protected Char **
+libedit_private wchar_t **
 ct_decode_argv(int argc, const char *argv[], ct_buffer_t *conv)
 {
 	size_t bufspace;
 	int i;
-	Char *p;
-	Char **wargv;
+	wchar_t *p;
+	wchar_t **wargv;
 	ssize_t bytes;
 
 	/* Make sure we have enough space in the conversion buffer to store all
@@ -154,7 +156,7 @@ ct_decode_argv(int argc, const char *argv[], ct_buffer
 		if (ct_conv_wbuff_resize(conv, bufspace + CT_BUFSIZ) == -1)
 			return NULL;
 
-	wargv = el_malloc((size_t)argc * sizeof(*wargv));
+	wargv = el_malloc((size_t)(argc + 1) * sizeof(*wargv));
 
 	for (i = 0, p = conv->wbuff; i < argc; ++i) {
 		if (!argv[i]) {   /* don't pass null pointers to mbstowcs */
@@ -172,13 +174,14 @@ ct_decode_argv(int argc, const char *argv[], ct_buffer
 		bufspace -= (size_t)bytes;
 		p += bytes;
 	}
+	wargv[i] = NULL;
 
 	return wargv;
 }
 
 
-protected size_t
-ct_enc_width(Char c)
+libedit_private size_t
+ct_enc_width(wchar_t c)
 {
 	/* UTF-8 encoding specific values */
 	if (c < 0x80)
@@ -193,96 +196,66 @@ ct_enc_width(Char c)
 		return 0; /* not a valid codepoint */
 }
 
-protected ssize_t
-ct_encode_char(char *dst, size_t len, Char c)
+libedit_private ssize_t
+ct_encode_char(char *dst, size_t len, wchar_t c)
 {
 	ssize_t l = 0;
 	if (len < ct_enc_width(c))
 		return -1;
-	l = ct_wctomb(dst, c);
+	l = wctomb(dst, c);
 
 	if (l < 0) {
-		ct_wctomb_reset;
+		wctomb(NULL, L'\0');
 		l = 0;
 	}
 	return l;
 }
 
-size_t
-ct_mbrtowc(wchar_t *wc, const char *s, size_t n)
+libedit_private const wchar_t *
+ct_visual_string(const wchar_t *s, ct_buffer_t *conv)
 {
-	mbstate_t mbs;
-	/* This only works because UTF-8 is stateless */
-	memset(&mbs, 0, sizeof(mbs));
-	return mbrtowc(wc, s, n, &mbs);
-}
+	wchar_t *dst;
+	ssize_t used;
 
-#else
-
-size_t
-ct_mbrtowc(wchar_t *wc, const char *s, size_t n)
-	if (s == NULL)
-		return 0;
-	if (n == 0)
-		return (size_t)-2;
-	if (wc != NULL)
-		*wc = *s;
-	return *s != '\0';
-}
-#endif
-
-protected const Char *
-ct_visual_string(const Char *s)
-{
-	static Char *buff = NULL;
-	static size_t buffsize = 0;
-	void *p;
-	Char *dst;
-	ssize_t used = 0;
-
 	if (!s)
 		return NULL;
-	if (!buff) {
-	    buffsize = CT_BUFSIZ;
-	    buff = el_malloc(buffsize * sizeof(*buff));
-	}
-	dst = buff;
+
+	if (ct_conv_wbuff_resize(conv, CT_BUFSIZ) == -1)
+		return NULL;
+
+	used = 0;
+	dst = conv->wbuff;
 	while (*s) {
-		used = ct_visual_char(dst, buffsize - (size_t)(dst - buff), *s);
-		if (used == -1) { /* failed to encode, need more buffer space */
-			used = dst - buff;
-			buffsize += CT_BUFSIZ;
-			p = el_realloc(buff, buffsize * sizeof(*buff));
-			if (p == NULL)
-				goto out;
-			buff = p;
-			dst = buff + used;
-			/* don't increment s here - we want to retry it! */
+		used = ct_visual_char(dst,
+		    conv->wsize - (size_t)(dst - conv->wbuff), *s);
+		if (used != -1) {
+			++s;
+			dst += used;
+			continue;
 		}
-		else
-		    ++s;
-		dst += used;
+
+		/* failed to encode, need more buffer space */
+		used = dst - conv->wbuff;
+		if (ct_conv_wbuff_resize(conv, conv->wsize + CT_BUFSIZ) == -1)
+			return NULL;
+		dst = conv->wbuff + used;
 	}
-	if (dst >= (buff + buffsize)) { /* sigh */
-		buffsize += 1;
-		p = el_realloc(buff, buffsize * sizeof(*buff));
-		if (p == NULL)
-			goto out;
-		buff = p;
-		dst = buff + buffsize - 1;
+
+	if (dst >= (conv->wbuff + conv->wsize)) { /* sigh */
+		used = dst - conv->wbuff;
+		if (ct_conv_wbuff_resize(conv, conv->wsize + CT_BUFSIZ) == -1)
+			return NULL;
+		dst = conv->wbuff + used;
 	}
-	*dst = 0;
-	return buff;
-out:
-	el_free(buff);
-	buffsize = 0;
-	return NULL;
+

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709131557.v8DFvwXv094063>