From owner-svn-src-all@freebsd.org Mon Feb 20 03:34:01 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A15AECE3731; Mon, 20 Feb 2017 03:34:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5F1DC1C4C; Mon, 20 Feb 2017 03:34:01 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v1K3Y0dM056611; Mon, 20 Feb 2017 03:34:00 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1K3XxOO056595; Mon, 20 Feb 2017 03:33:59 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201702200333.v1K3XxOO056595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 20 Feb 2017 03:33:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r313981 - in stable/11/lib/libedit: . TEST edit/readline X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Feb 2017 03:34:01 -0000 Author: pfg Date: Mon Feb 20 03:33:59 2017 New Revision: 313981 URL: https://svnweb.freebsd.org/changeset/base/313981 Log: MFC r312997, r313002: Re-import libedit 2016-02-27 and update libedit with changes from NetBSD's 2016-03-21. Obtained from: NetBSD Modified: stable/11/lib/libedit/Makefile stable/11/lib/libedit/TEST/rl1.c stable/11/lib/libedit/TEST/tc1.c stable/11/lib/libedit/TEST/wtc1.c stable/11/lib/libedit/chared.c stable/11/lib/libedit/chared.h stable/11/lib/libedit/chartype.c stable/11/lib/libedit/chartype.h stable/11/lib/libedit/common.c stable/11/lib/libedit/config.h stable/11/lib/libedit/edit/readline/readline.h stable/11/lib/libedit/editline.3 stable/11/lib/libedit/el.c stable/11/lib/libedit/el.h stable/11/lib/libedit/eln.c stable/11/lib/libedit/emacs.c stable/11/lib/libedit/filecomplete.c stable/11/lib/libedit/hist.c stable/11/lib/libedit/hist.h stable/11/lib/libedit/histedit.h stable/11/lib/libedit/history.c stable/11/lib/libedit/keymacro.c stable/11/lib/libedit/makelist stable/11/lib/libedit/map.c stable/11/lib/libedit/parse.c stable/11/lib/libedit/prompt.c stable/11/lib/libedit/prompt.h stable/11/lib/libedit/read.c stable/11/lib/libedit/read.h stable/11/lib/libedit/readline.c stable/11/lib/libedit/refresh.c stable/11/lib/libedit/refresh.h stable/11/lib/libedit/search.c stable/11/lib/libedit/search.h stable/11/lib/libedit/sig.c stable/11/lib/libedit/sig.h stable/11/lib/libedit/sys.h stable/11/lib/libedit/terminal.c stable/11/lib/libedit/terminal.h stable/11/lib/libedit/tokenizer.c stable/11/lib/libedit/tty.c stable/11/lib/libedit/tty.h stable/11/lib/libedit/vi.c Modified: stable/11/lib/libedit/Makefile ============================================================================== --- stable/11/lib/libedit/Makefile Mon Feb 20 03:26:19 2017 (r313980) +++ stable/11/lib/libedit/Makefile Mon Feb 20 03:33:59 2017 (r313981) @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.37 2009/01/18 12:17:49 lukem Exp $ +# $NetBSD: Makefile,v 1.56 2016/03/02 19:24:20 christos Exp $ # @(#)Makefile 8.1 (Berkeley) 6/4/93 # $FreeBSD$ @@ -7,7 +7,7 @@ LIB= edit SHLIB_MAJOR= 7 SHLIBDIR?= /lib -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 @@ -35,12 +35,11 @@ CLEANFILES+= common.h editline.c emacs.h INCS= histedit.h -OSRCS+= eln.c SRCS+= tokenizern.c historyn.c CLEANFILES+= tokenizern.c historyn.c CFLAGS+= -I. -I${.CURDIR} -I${.CURDIR}/edit -DWIDECHAR -CFLAGS+= #-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH -CFLAGS+= #-DDEBUG_PASTE -DDEBUG_EDIT +#CFLAGS+= -DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH +#CFLAGS+= -DDEBUG_PASTE -DDEBUG_EDIT WARNS?= 1 Modified: stable/11/lib/libedit/TEST/rl1.c ============================================================================== --- stable/11/lib/libedit/TEST/rl1.c Mon Feb 20 03:26:19 2017 (r313980) +++ stable/11/lib/libedit/TEST/rl1.c Mon Feb 20 03:33:59 2017 (r313981) @@ -1,4 +1,4 @@ -/* $NetBSD: rl1.c,v 1.1 2010/09/16 20:08:51 christos Exp $ */ +/* $NetBSD: rl1.c,v 1.2 2016/02/29 00:54:19 christos Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: rl1.c,v 1.1 2010/09/16 20:08:51 christos Exp $"); +__RCSID("$NetBSD: rl1.c,v 1.2 2016/02/29 00:54:19 christos Exp $"); #endif /* not lint */ __FBSDID("$FreeBSD$"); Modified: stable/11/lib/libedit/TEST/tc1.c ============================================================================== --- stable/11/lib/libedit/TEST/tc1.c Mon Feb 20 03:26:19 2017 (r313980) +++ stable/11/lib/libedit/TEST/tc1.c Mon Feb 20 03:33:59 2017 (r313981) @@ -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,7 +42,7 @@ __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 */ __FBSDID("$FreeBSD$"); @@ -50,15 +50,15 @@ __FBSDID("$FreeBSD$"); /* * test.c: A little test program */ -#include -#include -#include #include #include -#include -#include #include #include +#include +#include +#include +#include +#include #include "histedit.h" @@ -158,7 +158,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: stable/11/lib/libedit/TEST/wtc1.c ============================================================================== --- stable/11/lib/libedit/TEST/wtc1.c Mon Feb 20 03:26:19 2017 (r313980) +++ stable/11/lib/libedit/TEST/wtc1.c Mon Feb 20 03:33:59 2017 (r313981) @@ -5,13 +5,16 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include -#include -#include #include +#include #include #include +#include +#include +#include +#include +#include #include "../histedit.h" Modified: stable/11/lib/libedit/chared.c ============================================================================== --- stable/11/lib/libedit/chared.c Mon Feb 20 03:26:19 2017 (r313980) +++ stable/11/lib/libedit/chared.c Mon Feb 20 03:33:59 2017 (r313981) @@ -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,7 +37,7 @@ #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 */ #include @@ -46,8 +46,12 @@ __FBSDID("$FreeBSD$"); /* * chared.c: Character editor utilities */ +#include #include +#include + #include "el.h" +#include "common.h" private void ch__clearmacro (EditLine *); @@ -201,7 +205,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; } @@ -211,7 +215,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; @@ -225,7 +229,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); } @@ -235,7 +239,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--; @@ -259,7 +263,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)) @@ -277,7 +281,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; @@ -306,7 +310,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; @@ -370,7 +374,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; @@ -524,7 +528,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; @@ -573,7 +577,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; @@ -673,9 +677,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); @@ -690,26 +694,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: stable/11/lib/libedit/chared.h ============================================================================== --- stable/11/lib/libedit/chared.h Mon Feb 20 03:26:19 2017 (r313980) +++ stable/11/lib/libedit/chared.h Mon Feb 20 03:33:59 2017 (r313981) @@ -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 @@ -41,11 +41,6 @@ #ifndef _h_el_chared #define _h_el_chared -#include -#include - -#include "histedit.h" - #define EL_MAXMACRO 10 /* @@ -140,24 +135,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: stable/11/lib/libedit/chartype.c ============================================================================== --- stable/11/lib/libedit/chartype.c Mon Feb 20 03:26:19 2017 (r313980) +++ stable/11/lib/libedit/chartype.c Mon Feb 20 03:33:59 2017 (r313981) @@ -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. @@ -31,13 +31,16 @@ */ #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 __FBSDID("$FreeBSD$"); -#include "el.h" +#include #include +#include + +#include "el.h" #define CT_BUFSIZ ((size_t)1024) @@ -68,7 +71,7 @@ ct_conv_wbuff_resize(ct_buffer_t *conv, { void *p; - if (wsize <= conv->wsize) + if (wsize <= conv->wsize) return 0; conv->wsize = wsize; @@ -206,6 +209,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 * @@ -329,7 +354,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: stable/11/lib/libedit/chartype.h ============================================================================== --- stable/11/lib/libedit/chartype.h Mon Feb 20 03:26:19 2017 (r313980) +++ stable/11/lib/libedit/chartype.h Mon Feb 20 03:33:59 2017 (r313981) @@ -1,4 +1,4 @@ -/* $NetBSD: chartype.h,v 1.15 2015/05/17 13:14:41 christos Exp $ */ +/* $NetBSD: chartype.h,v 1.25 2016/03/07 00:05:20 christos Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -32,7 +32,6 @@ #define _h_chartype_f - #ifdef WIDECHAR /* Ideally we should also test the value of the define to see if it @@ -55,21 +54,19 @@ #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 FSTARSTR "%.*ls" +#define STR(x) L ## x #define UC(c) c #define Isalpha(x) iswalpha(x) #define Isalnum(x) iswalnum(x) @@ -110,21 +107,19 @@ 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 FSTARSTR "%.*s" +#define STR(x) x #define UC(c) (unsigned char)(c) #define Isalpha(x) isalpha((unsigned char)x) @@ -213,7 +208,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) @@ -245,5 +240,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: stable/11/lib/libedit/common.c ============================================================================== --- stable/11/lib/libedit/common.c Mon Feb 20 03:26:19 2017 (r313980) +++ stable/11/lib/libedit/common.c Mon Feb 20 03:33:59 2017 (r313981) @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.29 2012/03/24 20:08:43 christos Exp $ */ +/* $NetBSD: common.c,v 1.40 2016/03/02 19:24:20 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #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.40 2016/03/02 19:24:20 christos Exp $"); #endif #endif /* not lint && not SCCSID */ #include @@ -46,7 +46,13 @@ __FBSDID("$FreeBSD$"); /* * common.c: Common Editor functions */ +#include +#include + #include "el.h" +#include "common.h" +#include "parse.h" +#include "vi.h" /* ed_end_of_file(): * Indicate end of file @@ -54,7 +60,7 @@ __FBSDID("$FreeBSD$"); */ 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); @@ -68,7 +74,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; @@ -87,14 +93,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); } @@ -111,7 +117,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; @@ -139,12 +145,13 @@ 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 - (void) fprintf(el->el_errlfile, - "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", + (void) fprintf(el->el_errfile, + "\nD(b: %p(" FSTR ") c: %p(" FSTR ") last: %p(" FSTR + ") limit: %p(" FSTR ")\n", EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar, EL.lastchar, EL.limit, EL.limit); #endif @@ -186,7 +193,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; @@ -207,7 +214,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; @@ -230,7 +237,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; @@ -253,7 +260,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) { @@ -266,7 +273,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; @@ -279,7 +286,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; @@ -308,7 +315,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) @@ -334,7 +341,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) { @@ -358,14 +365,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); @@ -378,7 +383,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)) @@ -406,7 +411,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)) @@ -432,7 +437,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; @@ -449,8 +454,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; @@ -463,8 +468,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; @@ -477,8 +482,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; @@ -491,8 +496,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; @@ -505,8 +510,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; @@ -519,8 +524,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; @@ -533,8 +538,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; @@ -547,7 +552,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); @@ -563,7 +568,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) @@ -583,7 +588,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 */ @@ -598,8 +603,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; @@ -612,7 +617,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); @@ -626,8 +631,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; @@ -640,7 +645,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; @@ -660,7 +665,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 */ @@ -678,7 +682,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; @@ -705,11 +709,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; @@ -748,7 +752,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++; @@ -773,11 +777,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; @@ -827,7 +831,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); @@ -870,7 +874,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); @@ -904,7 +908,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: stable/11/lib/libedit/config.h ============================================================================== --- stable/11/lib/libedit/config.h Mon Feb 20 03:26:19 2017 (r313980) +++ stable/11/lib/libedit/config.h Mon Feb 20 03:33:59 2017 (r313981) @@ -21,8 +21,8 @@ /* Define to 1 if you have the 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 @@ -188,9 +188,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. */ #define HAVE_WORKING_FORK 1 @@ -257,6 +254,9 @@ /* Version number of package */ #define VERSION "3.0" +/* Define to 1 if the system provides the SIZE_MAX constant */ +#define HAVE_SIZE_MAX 1 + /* Define to 1 if you want wide-character code */ /* #undef WIDECHAR */ Modified: stable/11/lib/libedit/edit/readline/readline.h ============================================================================== --- stable/11/lib/libedit/edit/readline/readline.h Mon Feb 20 03:26:19 2017 (r313980) +++ stable/11/lib/libedit/edit/readline/readline.h Mon Feb 20 03:33:59 2017 (r313981) @@ -1,4 +1,4 @@ -/* $NetBSD: readline.h,v 1.37 2015/06/02 15:36:45 christos Exp $ */ +/* $NetBSD: readline.h,v 1.39 2016/02/17 19:47:49 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -55,7 +55,7 @@ typedef void *histdata_t; typedef struct _hist_entry { const char *line; - histdata_t data; + histdata_t data; } HIST_ENTRY; typedef struct _keymap_entry { @@ -89,7 +89,7 @@ typedef KEYMAP_ENTRY *Keymap; #define RUBOUT 0x7f #define ABORT_CHAR CTRL('G') -#define RL_READLINE_VERSION 0x0402 +#define RL_READLINE_VERSION 0x0402 #define RL_PROMPT_START_IGNORE '\1' #define RL_PROMPT_END_IGNORE '\2' @@ -98,7 +98,7 @@ typedef KEYMAP_ENTRY *Keymap; extern "C" { #endif extern const char *rl_library_version; -extern int rl_readline_version; +extern int rl_readline_version; extern char *rl_readline_name; extern FILE *rl_instream; extern FILE *rl_outstream; @@ -199,10 +199,10 @@ int rl_add_defun(const char *, rl_comm HISTORY_STATE *history_get_history_state(void); void rl_get_screen_size(int *, int *); void rl_set_screen_size(int, int); -char *rl_filename_completion_function (const char *, int); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***