Author: pfg
Date: Mon Jan 30 21:06:07 2017
New Revision: 312996
URL: https://svnweb.freebsd.org/changeset/base/312996

Log:
  Import libedit 2016-02-27
  
  This basically reverts r296500: there are many changes in the latest
  version and this intermediate step lets us save all the work done
  for the previous update.
  
  Obtained from:        NetBSD

Added:
  vendor/NetBSD/libedit/2016-02-27/
     - copied from r296499, vendor/NetBSD/libedit/2016-02-27/
Modified:
  vendor/NetBSD/libedit/dist/Makefile
  vendor/NetBSD/libedit/dist/TEST/Makefile
  vendor/NetBSD/libedit/dist/TEST/rl1.c
  vendor/NetBSD/libedit/dist/TEST/tc1.c
  vendor/NetBSD/libedit/dist/TEST/wtc1.c
  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/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/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/makelist
  vendor/NetBSD/libedit/dist/map.c
  vendor/NetBSD/libedit/dist/parse.c
  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/Makefile
  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 Mon Jan 30 19:49:08 2017        
(r312995)
+++ vendor/NetBSD/libedit/dist/Makefile Mon Jan 30 21:06:07 2017        
(r312996)
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.53 2015/01/29 20:30:02 joerg Exp $
+#      $NetBSD: Makefile,v 1.55 2016/02/24 14:25:38 christos Exp $
 #      @(#)Makefile    8.1 (Berkeley) 6/4/93
 
 USE_SHLIBDIR=  yes
@@ -15,7 +15,7 @@ COPTS+=       -Wunused-parameter
 CWARNFLAGS.gcc+=       -Wconversion
 CWARNFLAGS.clang+=     -Wno-cast-qual
 
-OSRCS= chared.c common.c el.c emacs.c fcns.c filecomplete.c help.c \
+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
 
@@ -37,7 +37,6 @@ MLINKS=       editline.3 el_init.3 editline.3 
 SRCS=  editline.c readline.c tokenizer.c history.c
 
 .if ${WIDECHAR} == "yes"
-OSRCS += eln.c
 SRCS += tokenizern.c historyn.c
 CLEANFILES+=tokenizern.c.tmp tokenizern.c historyn.c.tmp historyn.c
 CPPFLAGS+=-DWIDECHAR
@@ -52,12 +51,12 @@ 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
-CPPFLAGS+=-I. -I${LIBEDITDIR} 
+CPPFLAGS+=-I. -I${LIBEDITDIR}
 CPPFLAGS+=-I. -I${.CURDIR}
 CPPFLAGS+=#-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
 CPPFLAGS+=#-DDEBUG_PASTE -DDEBUG_EDIT
 
-AHDR=vi.h emacs.h common.h 
+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
@@ -120,7 +119,7 @@ historyn.c: makelist Makefile
 
 tc1.o: ${LIBEDITDIR}/TEST/tc1.c
 
-tc1:   libedit.a tc1.o 
+tc1:   libedit.a tc1.o
        ${_MKTARGET_LINK}
        ${CC} ${LDFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD} -ltermlib
 

Modified: vendor/NetBSD/libedit/dist/TEST/Makefile
==============================================================================
--- vendor/NetBSD/libedit/dist/TEST/Makefile    Mon Jan 30 19:49:08 2017        
(r312995)
+++ vendor/NetBSD/libedit/dist/TEST/Makefile    Mon Jan 30 21:06:07 2017        
(r312996)
@@ -1,4 +1,6 @@
-# $NetBSD: Makefile,v 1.5 2010/02/03 15:34:43 roy Exp $
+# $NetBSD: Makefile,v 1.6 2016/02/15 21:38:07 christos Exp $
+
+WIDECHAR ?= yes
 
 NOMAN=1
 PROG=wtc1
@@ -6,6 +8,10 @@ CPPFLAGS=-I${.CURDIR}/..
 LDADD+=-ledit -ltermlib
 DPADD+=${LIBEDIT} ${LIBTERMLIB}
 
+.if "${WIDECHAR}" == "yes"
+CPPFLAGS+=-DWIDECHAR
+.endif
+
 .ifdef DEBUG
 CPPFLAGS+=-DDEBUG
 .endif

Modified: vendor/NetBSD/libedit/dist/TEST/rl1.c
==============================================================================
--- vendor/NetBSD/libedit/dist/TEST/rl1.c       Mon Jan 30 19:49:08 2017        
(r312995)
+++ vendor/NetBSD/libedit/dist/TEST/rl1.c       Mon Jan 30 21:06:07 2017        
(r312996)
@@ -1,4 +1,4 @@
-/*     $NetBSD: rl1.c,v 1.2 2016/02/29 00:54:19 christos Exp $ */
+/*     $NetBSD: rl1.c,v 1.1 2010/09/16 20:08:51 christos Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -15,6 +15,13 @@
  * 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
@@ -31,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: rl1.c,v 1.2 2016/02/29 00:54:19 christos Exp $");
+__RCSID("$NetBSD: rl1.c,v 1.1 2010/09/16 20:08:51 christos Exp $");
 #endif /* not lint  */
 
 /*

Modified: vendor/NetBSD/libedit/dist/TEST/tc1.c
==============================================================================
--- vendor/NetBSD/libedit/dist/TEST/tc1.c       Mon Jan 30 19:49:08 2017        
(r312995)
+++ vendor/NetBSD/libedit/dist/TEST/tc1.c       Mon Jan 30 21:06:07 2017        
(r312996)
@@ -1,4 +1,4 @@
-/*     $NetBSD: tc1.c,v 1.6 2014/06/18 20:12:15 christos Exp $ */
+/*     $NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -42,22 +42,22 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 19
 #if 0
 static char sccsid[] = "@(#)test.c     8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: tc1.c,v 1.6 2014/06/18 20:12:15 christos Exp $");
+__RCSID("$NetBSD: tc1.c,v 1.7 2016/02/17 19:47:49 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
 /*
  * test.c: A little test program
  */
-#include <stdio.h>
-#include <string.h>
-#include <signal.h>
 #include <sys/wait.h>
 #include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
 #include <dirent.h>
 #include <locale.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
 #include "histedit.h"
 
@@ -157,7 +157,7 @@ main(int argc, char *argv[])
                                        /* Add a user-defined function  */
        el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);
 
-                                       /* Bind tab to it               */
+                                       /* Bind tab to it               */
        el_set(el, EL_BIND, "^I", "ed-complete", NULL);
 
        /*

Modified: vendor/NetBSD/libedit/dist/TEST/wtc1.c
==============================================================================
--- vendor/NetBSD/libedit/dist/TEST/wtc1.c      Mon Jan 30 19:49:08 2017        
(r312995)
+++ vendor/NetBSD/libedit/dist/TEST/wtc1.c      Mon Jan 30 21:06:07 2017        
(r312996)
@@ -1,14 +1,14 @@
-#include <stdio.h>
-#include <string.h>
-#include <signal.h>
 #include <sys/wait.h>
-#include <err.h>
 #include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
 #include <dirent.h>
+#include <err.h>
 #include <limits.h>
 #include <locale.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 
 #include "../histedit.h"
 

Modified: vendor/NetBSD/libedit/dist/chared.c
==============================================================================
--- vendor/NetBSD/libedit/dist/chared.c Mon Jan 30 19:49:08 2017        
(r312995)
+++ vendor/NetBSD/libedit/dist/chared.c Mon Jan 30 21:06:07 2017        
(r312996)
@@ -1,4 +1,4 @@
-/*     $NetBSD: chared.c,v 1.40 2014/06/18 18:12:28 christos Exp $     */
+/*     $NetBSD: chared.c,v 1.49 2016/02/24 14:29:21 christos Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,15 +37,19 @@
 #if 0
 static char sccsid[] = "@(#)chared.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: chared.c,v 1.40 2014/06/18 18:12:28 christos Exp $");
+__RCSID("$NetBSD: chared.c,v 1.49 2016/02/24 14:29:21 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
 /*
  * chared.c: Character editor utilities
  */
+#include <ctype.h>
 #include <stdlib.h>
+#include <string.h>
+
 #include "el.h"
+#include "common.h"
 
 private void ch__clearmacro (EditLine *);
 
@@ -199,7 +203,7 @@ c_delbefore1(EditLine *el)
  *     Return if p is part of a word according to emacs
  */
 protected int
-ce__isword(Int p)
+ce__isword(wint_t p)
 {
        return Isalnum(p) || Strchr(STR("*?_-.[]~="), p) != NULL;
 }
@@ -209,7 +213,7 @@ ce__isword(Int p)
  *     Return if p is part of a word according to vi
  */
 protected int
-cv__isword(Int p)
+cv__isword(wint_t p)
 {
        if (Isalnum(p) || p == '_')
                return 1;
@@ -223,7 +227,7 @@ cv__isword(Int p)
  *     Return if p is part of a big word according to vi
  */
 protected int
-cv__isWord(Int p)
+cv__isWord(wint_t p)
 {
        return !Isspace(p);
 }
@@ -233,7 +237,7 @@ cv__isWord(Int p)
  *     Find the previous word
  */
 protected Char *
-c__prev_word(Char *p, Char *low, int n, int (*wtest)(Int))
+c__prev_word(Char *p, Char *low, int n, int (*wtest)(wint_t))
 {
        p--;
 
@@ -257,7 +261,7 @@ c__prev_word(Char *p, Char *low, int n, 
  *     Find the next word
  */
 protected Char *
-c__next_word(Char *p, Char *high, int n, int (*wtest)(Int))
+c__next_word(Char *p, Char *high, int n, int (*wtest)(wint_t))
 {
        while (n--) {
                while ((p < high) && !(*wtest)(*p))
@@ -275,7 +279,7 @@ c__next_word(Char *p, Char *high, int n,
  *     Find the next word vi style
  */
 protected Char *
-cv_next_word(EditLine *el, Char *p, Char *high, int n, int (*wtest)(Int))
+cv_next_word(EditLine *el, Char *p, Char *high, int n, int (*wtest)(wint_t))
 {
        int test;
 
@@ -304,7 +308,7 @@ cv_next_word(EditLine *el, Char *p, Char
  *     Find the previous word vi style
  */
 protected Char *
-cv_prev_word(Char *p, Char *low, int n, int (*wtest)(Int))
+cv_prev_word(Char *p, Char *low, int n, int (*wtest)(wint_t))
 {
        int test;
 
@@ -368,7 +372,7 @@ cv_delfini(EditLine *el)
  *     Go to the end of this word according to vi
  */
 protected Char *
-cv__endword(Char *p, Char *high, int n, int (*wtest)(Int))
+cv__endword(Char *p, Char *high, int n, int (*wtest)(wint_t))
 {
        int test;
 
@@ -522,7 +526,7 @@ ch_enlargebufs(EditLine *el, size_t addl
 
        /* zero the newly added memory, leave old data in */
        (void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer));
-           
+
        oldbuf = el->el_line.buffer;
 
        el->el_line.buffer = newbuffer;
@@ -571,7 +575,7 @@ ch_enlargebufs(EditLine *el, size_t addl
        el->el_chared.c_redo.lim = newbuffer +
                        (el->el_chared.c_redo.lim - el->el_chared.c_redo.buf);
        el->el_chared.c_redo.buf = newbuffer;
-       
+
        if (!hist_enlargebuf(el, sz, newsz))
                return 0;
 
@@ -671,9 +675,9 @@ out:
 protected int
 c_gets(EditLine *el, Char *buf, const Char *prompt)
 {
-       Char ch;
+       wchar_t wch;
        ssize_t len;
-       Char *cp = el->el_line.buffer;
+       Char *cp = el->el_line.buffer, ch;
 
        if (prompt) {
                len = (ssize_t)Strlen(prompt);
@@ -688,26 +692,28 @@ c_gets(EditLine *el, Char *buf, const Ch
                el->el_line.lastchar = cp + 1;
                re_refresh(el);
 
-               if (FUN(el,getc)(el, &ch) != 1) {
+               if (el_wgetc(el, &wch) != 1) {
                        ed_end_of_file(el, 0);
                        len = -1;
                        break;
                }
+               ch = (Char)wch;
 
                switch (ch) {
 
-               case 0010:      /* Delete and backspace */
+               case L'\b':     /* Delete and backspace */
                case 0177:
                        if (len == 0) {
                                len = -1;
                                break;
                        }
+                       len--;
                        cp--;
                        continue;
 
                case 0033:      /* ESC */
-               case '\r':      /* Newline */
-               case '\n':
+               case L'\r':     /* Newline */
+               case L'\n':
                        buf[len] = ch;
                        break;
 

Modified: vendor/NetBSD/libedit/dist/chared.h
==============================================================================
--- vendor/NetBSD/libedit/dist/chared.h Mon Jan 30 19:49:08 2017        
(r312995)
+++ vendor/NetBSD/libedit/dist/chared.h Mon Jan 30 21:06:07 2017        
(r312996)
@@ -1,4 +1,4 @@
-/*     $NetBSD: chared.h,v 1.22 2014/06/18 18:12:28 christos Exp $     */
+/*     $NetBSD: chared.h,v 1.27 2016/02/16 22:53:14 christos Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -40,11 +40,6 @@
 #ifndef _h_el_chared
 #define        _h_el_chared
 
-#include <ctype.h>
-#include <string.h>
-
-#include "histedit.h"
-
 #define        EL_MAXMACRO     10
 
 /*
@@ -139,24 +134,18 @@ typedef struct el_chared_t {
 #define        MODE_REPLACE    1
 #define        MODE_REPLACE_1  2
 
-#include "common.h"
-#include "vi.h"
-#include "emacs.h"
-#include "search.h"
-#include "fcns.h"
-
 
-protected int   cv__isword(Int);
-protected int   cv__isWord(Int);
+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 (*)(Int));
-protected int   ce__isword(Int);
+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 (*)(Int));
-protected Char *cv_prev_word(Char *, Char *, int, int (*)(Int));
-protected Char *c__next_word(Char *, Char *, int, int (*)(Int));
-protected Char *c__prev_word(Char *, Char *, int, int (*)(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 *);

Modified: vendor/NetBSD/libedit/dist/chartype.c
==============================================================================
--- vendor/NetBSD/libedit/dist/chartype.c       Mon Jan 30 19:49:08 2017        
(r312995)
+++ vendor/NetBSD/libedit/dist/chartype.c       Mon Jan 30 21:06:07 2017        
(r312996)
@@ -1,4 +1,4 @@
-/*     $NetBSD: chartype.c,v 1.12 2015/02/22 02:16:19 christos Exp $   */
+/*     $NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $   */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -12,13 +12,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
@@ -38,10 +31,14 @@
  */
 #include "config.h"
 #if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: chartype.c,v 1.12 2015/02/22 02:16:19 christos Exp $");
+__RCSID("$NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $");
 #endif /* not lint && not SCCSID */
-#include "el.h"
+
+#include <ctype.h>
 #include <stdlib.h>
+#include <string.h>
+
+#include "el.h"
 
 #define CT_BUFSIZ ((size_t)1024)
 
@@ -72,7 +69,7 @@ ct_conv_wbuff_resize(ct_buffer_t *conv, 
 {
        void *p;
 
-       if (wsize <= conv->wsize) 
+       if (wsize <= conv->wsize)
                return 0;
 
        conv->wsize = wsize;
@@ -210,6 +207,28 @@ ct_encode_char(char *dst, size_t len, Ch
        }
        return l;
 }
+
+size_t
+ct_mbrtowc(wchar_t *wc, const char *s, size_t n)
+{
+       mbstate_t mbs;
+       /* This only works because UTF-8 is stateless */
+       memset(&mbs, 0, sizeof(mbs));
+       return mbrtowc(wc, s, n, &mbs);
+}
+
+#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 *
@@ -333,7 +352,7 @@ ct_visual_char(Char *dst, size_t len, Ch
                return c > 0xffff ? 8 : 7;
 #else
                *dst++ = '\\';
-#define tooctaldigit(v) ((v) + '0')
+#define tooctaldigit(v) (Char)((v) + '0')
                *dst++ = tooctaldigit(((unsigned int) c >> 6) & 0x7);
                *dst++ = tooctaldigit(((unsigned int) c >> 3) & 0x7);
                *dst++ = tooctaldigit(((unsigned int) c     ) & 0x7);

Modified: vendor/NetBSD/libedit/dist/chartype.h
==============================================================================
--- vendor/NetBSD/libedit/dist/chartype.h       Mon Jan 30 19:49:08 2017        
(r312995)
+++ vendor/NetBSD/libedit/dist/chartype.h       Mon Jan 30 21:06:07 2017        
(r312996)
@@ -1,4 +1,4 @@
-/*     $NetBSD: chartype.h,v 1.15 2015/05/17 13:14:41 christos Exp $   */
+/*     $NetBSD: chartype.h,v 1.23 2016/02/24 17:20:01 christos Exp $   */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -37,7 +37,6 @@
 #define _h_chartype_f
 
 
-
 #ifdef WIDECHAR
 
 /* Ideally we should also test the value of the define to see if it
@@ -60,21 +59,18 @@
 #warning Build environment does not support non-BMP characters
 #endif
 
-#define ct_mbtowc            mbtowc
-#define ct_mbtowc_reset      mbtowc(0,0,(size_t)0)
+#define ct_wctob             wctob
 #define ct_wctomb            wctomb
 #define ct_wctomb_reset      wctomb(0,0)
 #define ct_wcstombs          wcstombs
 #define ct_mbstowcs          mbstowcs
 
 #define Char                   wchar_t
-#define Int                    wint_t
 #define FUN(prefix,rest)       prefix ## _w ## rest
 #define FUNW(type)             type ## _w
 #define TYPE(type)             type ## W
-#define FCHAR                  "%lc"
 #define FSTR                   "%ls"
-#define STR(x)                         L ## x
+#define STR(x)                 L ## x
 #define UC(c)                  c
 #define Isalpha(x)  iswalpha(x)
 #define Isalnum(x)  iswalnum(x)
@@ -115,21 +111,18 @@ Width(wchar_t c)
 
 #else /* NARROW */
 
-#define ct_mbtowc            error
-#define ct_mbtowc_reset      
+#define ct_wctob(w)          ((int)(w))
 #define ct_wctomb            error
-#define ct_wctomb_reset      
+#define ct_wctomb_reset
 #define ct_wcstombs(a, b, c)    (strncpy(a, b, c), strlen(a))
 #define ct_mbstowcs(a, b, c)    (strncpy(a, b, c), strlen(a))
 
 #define Char                   char
-#define Int                    int
 #define FUN(prefix,rest)       prefix ## _ ## rest
 #define FUNW(type)             type
 #define TYPE(type)             type
-#define FCHAR                  "%c"
 #define FSTR                   "%s"
-#define STR(x)                         x
+#define STR(x)                 x
 #define UC(c)                  (unsigned char)(c)
 
 #define Isalpha(x)  isalpha((unsigned char)x)
@@ -218,7 +211,7 @@ protected size_t ct_enc_width(Char);
 #define VISUAL_WIDTH_MAX ((size_t)8)
 
 /* The terminal is thought of in terms of X columns by Y lines. In the cases
- * where a wide character takes up more than one column, the adjacent 
+ * where a wide character takes up more than one column, the adjacent
  * occupied column entries will contain this faux character. */
 #define MB_FILL_CHAR ((Char)-1)
 
@@ -250,5 +243,7 @@ protected const Char *ct_visual_string(c
 protected int ct_chr_class(Char c);
 #endif
 
+size_t ct_mbrtowc(wchar_t *, const char *, size_t);
+
 
 #endif /* _chartype_f */

Modified: vendor/NetBSD/libedit/dist/common.c
==============================================================================
--- vendor/NetBSD/libedit/dist/common.c Mon Jan 30 19:49:08 2017        
(r312995)
+++ vendor/NetBSD/libedit/dist/common.c Mon Jan 30 21:06:07 2017        
(r312996)
@@ -1,4 +1,4 @@
-/*     $NetBSD: common.c,v 1.29 2012/03/24 20:08:43 christos Exp $     */
+/*     $NetBSD: common.c,v 1.39 2016/02/24 14:25:38 christos Exp $     */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,14 +37,20 @@
 #if 0
 static char sccsid[] = "@(#)common.c   8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: common.c,v 1.29 2012/03/24 20:08:43 christos Exp $");
+__RCSID("$NetBSD: common.c,v 1.39 2016/02/24 14:25:38 christos Exp $");
 #endif
 #endif /* not lint && not SCCSID */
 
 /*
  * common.c: Common Editor functions
  */
+#include <ctype.h>
+#include <string.h>
+
 #include "el.h"
+#include "common.h"
+#include "parse.h"
+#include "vi.h"
 
 /* ed_end_of_file():
  *     Indicate end of file
@@ -52,7 +58,7 @@ __RCSID("$NetBSD: common.c,v 1.29 2012/0
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_end_of_file(EditLine *el, Int c __attribute__((__unused__)))
+ed_end_of_file(EditLine *el, wint_t c __attribute__((__unused__)))
 {
 
        re_goto_bottom(el);
@@ -66,7 +72,7 @@ ed_end_of_file(EditLine *el, Int c __att
  *     Insert a character [bound to all insert keys]
  */
 protected el_action_t
-ed_insert(EditLine *el, Int c)
+ed_insert(EditLine *el, wint_t c)
 {
        int count = el->el_state.argument;
 
@@ -85,14 +91,14 @@ ed_insert(EditLine *el, Int c)
                    || el->el_line.cursor >= el->el_line.lastchar)
                        c_insert(el, 1);
 
-               *el->el_line.cursor++ = c;
+               *el->el_line.cursor++ = (Char)c;
                re_fastaddc(el);                /* fast refresh for one char. */
        } else {
                if (el->el_state.inputmode != MODE_REPLACE_1)
                        c_insert(el, el->el_state.argument);
 
                while (count-- && el->el_line.cursor < el->el_line.lastchar)
-                       *el->el_line.cursor++ = c;
+                       *el->el_line.cursor++ = (Char)c;
                re_refresh(el);
        }
 
@@ -109,7 +115,7 @@ ed_insert(EditLine *el, Int c)
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_delete_prev_word(EditLine *el, Int c __attribute__((__unused__)))
+ed_delete_prev_word(EditLine *el, wint_t c __attribute__((__unused__)))
 {
        Char *cp, *p, *kp;
 
@@ -137,7 +143,7 @@ ed_delete_prev_word(EditLine *el, Int c 
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_delete_next_char(EditLine *el, Int c __attribute__((__unused__)))
+ed_delete_next_char(EditLine *el, wint_t c __attribute__((__unused__)))
 {
 #ifdef DEBUG_EDIT
 #define        EL      el->el_line
@@ -184,7 +190,7 @@ ed_delete_next_char(EditLine *el, Int c 
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_kill_line(EditLine *el, Int c __attribute__((__unused__)))
+ed_kill_line(EditLine *el, wint_t c __attribute__((__unused__)))
 {
        Char *kp, *cp;
 
@@ -205,7 +211,7 @@ ed_kill_line(EditLine *el, Int c __attri
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_move_to_end(EditLine *el, Int c __attribute__((__unused__)))
+ed_move_to_end(EditLine *el, wint_t c __attribute__((__unused__)))
 {
 
        el->el_line.cursor = el->el_line.lastchar;
@@ -228,7 +234,7 @@ ed_move_to_end(EditLine *el, Int c __att
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_move_to_beg(EditLine *el, Int c __attribute__((__unused__)))
+ed_move_to_beg(EditLine *el, wint_t c __attribute__((__unused__)))
 {
 
        el->el_line.cursor = el->el_line.buffer;
@@ -251,7 +257,7 @@ ed_move_to_beg(EditLine *el, Int c __att
  *     [^T] [^T]
  */
 protected el_action_t
-ed_transpose_chars(EditLine *el, Int c)
+ed_transpose_chars(EditLine *el, wint_t c)
 {
 
        if (el->el_line.cursor < el->el_line.lastchar) {
@@ -264,7 +270,7 @@ ed_transpose_chars(EditLine *el, Int c)
                /* must have at least two chars entered */
                c = el->el_line.cursor[-2];
                el->el_line.cursor[-2] = el->el_line.cursor[-1];
-               el->el_line.cursor[-1] = c;
+               el->el_line.cursor[-1] = (Char)c;
                return CC_REFRESH;
        } else
                return CC_ERROR;
@@ -277,7 +283,7 @@ ed_transpose_chars(EditLine *el, Int c)
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_next_char(EditLine *el, Int c __attribute__((__unused__)))
+ed_next_char(EditLine *el, wint_t c __attribute__((__unused__)))
 {
        Char *lim = el->el_line.lastchar;
 
@@ -306,7 +312,7 @@ ed_next_char(EditLine *el, Int c __attri
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_prev_word(EditLine *el, Int c __attribute__((__unused__)))
+ed_prev_word(EditLine *el, wint_t c __attribute__((__unused__)))
 {
 
        if (el->el_line.cursor == el->el_line.buffer)
@@ -332,7 +338,7 @@ ed_prev_word(EditLine *el, Int c __attri
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_prev_char(EditLine *el, Int c __attribute__((__unused__)))
+ed_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
 {
 
        if (el->el_line.cursor > el->el_line.buffer) {
@@ -356,14 +362,12 @@ ed_prev_char(EditLine *el, Int c __attri
  *     [^V] [^V]
  */
 protected el_action_t
-ed_quoted_insert(EditLine *el, Int c)
+ed_quoted_insert(EditLine *el, wint_t c)
 {
        int num;
-       Char tc;
 
        tty_quotemode(el);
-       num = FUN(el,getc)(el, &tc);
-       c = tc;
+       num = el_wgetc(el, &c);
        tty_noquotemode(el);
        if (num == 1)
                return ed_insert(el, c);
@@ -376,7 +380,7 @@ ed_quoted_insert(EditLine *el, Int c)
  *     Adds to argument or enters a digit
  */
 protected el_action_t
-ed_digit(EditLine *el, Int c)
+ed_digit(EditLine *el, wint_t c)
 {
 
        if (!Isdigit(c))
@@ -404,7 +408,7 @@ ed_digit(EditLine *el, Int c)
  *     For ESC-n
  */
 protected el_action_t
-ed_argument_digit(EditLine *el, Int c)
+ed_argument_digit(EditLine *el, wint_t c)
 {
 
        if (!Isdigit(c))
@@ -430,7 +434,7 @@ ed_argument_digit(EditLine *el, Int c)
 protected el_action_t
 /*ARGSUSED*/
 ed_unassigned(EditLine *el __attribute__((__unused__)),
-    Int c __attribute__((__unused__)))
+    wint_t c __attribute__((__unused__)))
 {
 
        return CC_ERROR;
@@ -447,8 +451,8 @@ ed_unassigned(EditLine *el __attribute__
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_tty_sigint(EditLine *el __attribute__((__unused__)), 
-             Int c __attribute__((__unused__)))
+ed_tty_sigint(EditLine *el __attribute__((__unused__)),
+             wint_t c __attribute__((__unused__)))
 {
 
        return CC_NORM;
@@ -461,8 +465,8 @@ ed_tty_sigint(EditLine *el __attribute__
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_tty_dsusp(EditLine *el __attribute__((__unused__)), 
-            Int c __attribute__((__unused__)))
+ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
+            wint_t c __attribute__((__unused__)))
 {
 
        return CC_NORM;
@@ -475,8 +479,8 @@ ed_tty_dsusp(EditLine *el __attribute__(
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_tty_flush_output(EditLine *el __attribute__((__unused__)), 
-                   Int c __attribute__((__unused__)))
+ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
+                   wint_t c __attribute__((__unused__)))
 {
 
        return CC_NORM;
@@ -489,8 +493,8 @@ ed_tty_flush_output(EditLine *el __attri
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_tty_sigquit(EditLine *el __attribute__((__unused__)), 
-              Int c __attribute__((__unused__)))
+ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
+              wint_t c __attribute__((__unused__)))
 {
 
        return CC_NORM;
@@ -503,8 +507,8 @@ ed_tty_sigquit(EditLine *el __attribute_
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_tty_sigtstp(EditLine *el __attribute__((__unused__)), 
-              Int c __attribute__((__unused__)))
+ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
+              wint_t c __attribute__((__unused__)))
 {
 
        return CC_NORM;
@@ -517,8 +521,8 @@ ed_tty_sigtstp(EditLine *el __attribute_
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_tty_stop_output(EditLine *el __attribute__((__unused__)), 
-                  Int c __attribute__((__unused__)))
+ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
+                  wint_t c __attribute__((__unused__)))
 {
 
        return CC_NORM;
@@ -531,8 +535,8 @@ ed_tty_stop_output(EditLine *el __attrib
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_tty_start_output(EditLine *el __attribute__((__unused__)), 
-                   Int c __attribute__((__unused__)))
+ed_tty_start_output(EditLine *el __attribute__((__unused__)),
+                   wint_t c __attribute__((__unused__)))
 {
 
        return CC_NORM;
@@ -545,7 +549,7 @@ ed_tty_start_output(EditLine *el __attri
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_newline(EditLine *el, Int c __attribute__((__unused__)))
+ed_newline(EditLine *el, wint_t c __attribute__((__unused__)))
 {
 
        re_goto_bottom(el);
@@ -561,7 +565,7 @@ ed_newline(EditLine *el, Int c __attribu
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_delete_prev_char(EditLine *el, Int c __attribute__((__unused__)))
+ed_delete_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
 {
 
        if (el->el_line.cursor <= el->el_line.buffer)
@@ -581,7 +585,7 @@ ed_delete_prev_char(EditLine *el, Int c 
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_clear_screen(EditLine *el, Int c __attribute__((__unused__)))
+ed_clear_screen(EditLine *el, wint_t c __attribute__((__unused__)))
 {
 
        terminal_clear_screen(el);      /* clear the whole real screen */
@@ -596,8 +600,8 @@ ed_clear_screen(EditLine *el, Int c __at
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_redisplay(EditLine *el __attribute__((__unused__)), 
-            Int c __attribute__((__unused__)))
+ed_redisplay(EditLine *el __attribute__((__unused__)),
+            wint_t c __attribute__((__unused__)))
 {
 
        return CC_REDISPLAY;
@@ -610,7 +614,7 @@ ed_redisplay(EditLine *el __attribute__(
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_start_over(EditLine *el, Int c __attribute__((__unused__)))
+ed_start_over(EditLine *el, wint_t c __attribute__((__unused__)))
 {
 
        ch_reset(el, 0);
@@ -624,8 +628,8 @@ ed_start_over(EditLine *el, Int c __attr
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_sequence_lead_in(EditLine *el __attribute__((__unused__)), 
-                   Int c __attribute__((__unused__)))
+ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
+                   wint_t c __attribute__((__unused__)))
 {
 
        return CC_NORM;
@@ -638,7 +642,7 @@ ed_sequence_lead_in(EditLine *el __attri
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_prev_history(EditLine *el, Int c __attribute__((__unused__)))
+ed_prev_history(EditLine *el, wint_t c __attribute__((__unused__)))
 {
        char beep = 0;
        int sv_event = el->el_history.eventno;
@@ -658,7 +662,6 @@ ed_prev_history(EditLine *el, Int c __at
        if (hist_get(el) == CC_ERROR) {
                if (el->el_map.type == MAP_VI) {
                        el->el_history.eventno = sv_event;
-                       
                }
                beep = 1;
                /* el->el_history.eventno was fixed by first call */
@@ -676,7 +679,7 @@ ed_prev_history(EditLine *el, Int c __at
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_next_history(EditLine *el, Int c __attribute__((__unused__)))
+ed_next_history(EditLine *el, wint_t c __attribute__((__unused__)))
 {
        el_action_t beep = CC_REFRESH, rval;
 
@@ -703,11 +706,11 @@ ed_next_history(EditLine *el, Int c __at
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_search_prev_history(EditLine *el, Int c __attribute__((__unused__)))
+ed_search_prev_history(EditLine *el, wint_t c __attribute__((__unused__)))
 {
        const Char *hp;
        int h;
-       bool_t found = 0;
+       int found = 0;
 
        el->el_chared.c_vcmd.action = NOP;
        el->el_chared.c_undo.len = -1;
@@ -746,7 +749,7 @@ ed_search_prev_history(EditLine *el, Int
                            (el->el_line.lastchar - el->el_line.buffer)) ||
                        hp[el->el_line.lastchar - el->el_line.buffer]) &&
                    c_hmatch(el, hp)) {
-                       found++;
+                       found = 1;
                        break;
                }
                h++;
@@ -771,11 +774,11 @@ ed_search_prev_history(EditLine *el, Int
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_search_next_history(EditLine *el, Int c __attribute__((__unused__)))
+ed_search_next_history(EditLine *el, wint_t c __attribute__((__unused__)))
 {
        const Char *hp;
        int h;
-       bool_t found = 0;
+       int found = 0;
 
        el->el_chared.c_vcmd.action = NOP;
        el->el_chared.c_undo.len = -1;
@@ -825,7 +828,7 @@ ed_search_next_history(EditLine *el, Int
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_prev_line(EditLine *el, Int c __attribute__((__unused__)))
+ed_prev_line(EditLine *el, wint_t c __attribute__((__unused__)))
 {
        Char *ptr;
        int nchars = c_hpos(el);
@@ -868,7 +871,7 @@ ed_prev_line(EditLine *el, Int c __attri
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_next_line(EditLine *el, Int c __attribute__((__unused__)))
+ed_next_line(EditLine *el, wint_t c __attribute__((__unused__)))
 {
        Char *ptr;
        int nchars = c_hpos(el);
@@ -902,7 +905,7 @@ ed_next_line(EditLine *el, Int c __attri
  */
 protected el_action_t
 /*ARGSUSED*/
-ed_command(EditLine *el, Int c __attribute__((__unused__)))
+ed_command(EditLine *el, wint_t c __attribute__((__unused__)))
 {
        Char tmpbuf[EL_BUFSIZ];
        int tmplen;

Modified: vendor/NetBSD/libedit/dist/config.h
==============================================================================
--- vendor/NetBSD/libedit/dist/config.h Mon Jan 30 19:49:08 2017        
(r312995)
+++ vendor/NetBSD/libedit/dist/config.h Mon Jan 30 21:06:07 2017        
(r312996)
@@ -20,8 +20,8 @@
 /* Define to 1 if you have the <fcntl.h> header file. */
 #define HAVE_FCNTL_H 1
 
-/* Define to 1 if you have the `fgetln' function. */
-#define HAVE_FGETLN 1
+/* Define to 1 if you have the `getline' function. */
+#define HAVE_GETLINE 1
 
 /* Define to 1 if you have the `fork' function. */
 #define HAVE_FORK 1
@@ -187,9 +187,6 @@
 /* Define to 1 if you have the `vis' function. */
 #define HAVE_VIS 1
 
-/* Define to 1 if you have the `wcsdup' function. */
-#define HAVE_WCSDUP 1
-
 /* Define to 1 if `fork' works. */

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to