* See also NetBSD changelog:
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit
+2017-03-29 Jess Thrysoee
+
+ * version-info: 0:56:0
+
+ * all: sync with upstream source
+
2016-09-03 Jess Thrysoee
* version-info: 0:55:0
# Identity of this package.
PACKAGE_NAME='libedit'
-PACKAGE_TARNAME='libedit-20160903'
+PACKAGE_TARNAME='libedit-20170329'
PACKAGE_VERSION='3.1'
PACKAGE_STRING='libedit 3.1'
PACKAGE_BUGREPORT=''
--localedir=DIR locale-dependent data [DATAROOTDIR/locale]
--mandir=DIR man documentation [DATAROOTDIR/man]
--docdir=DIR documentation root
- [DATAROOTDIR/doc/libedit-20160903]
+ [DATAROOTDIR/doc/libedit-20170329]
--htmldir=DIR html documentation [DOCDIR]
--dvidir=DIR dvi documentation [DOCDIR]
--pdfdir=DIR pdf documentation [DOCDIR]
# Define the identity of the package.
- PACKAGE='libedit-20160903'
+ PACKAGE='libedit-20170329'
VERSION='3.1'
# libtool -version-info
-LT_VERSION=0:55:0
+LT_VERSION=0:56:0
# Check whether --enable-silent-rules was given.
AC_PROG_LIBTOOL
# libtool -version-info
-AC_SUBST(LT_VERSION, [0:55:0])
+AC_SUBST(LT_VERSION, [0:56:0])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-/* $NetBSD: chartype.c,v 1.30 2016/05/09 21:46:56 christos Exp $ */
+/* $NetBSD: chartype.c,v 1.31 2017/01/09 02:54:18 christos Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
*/
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: chartype.c,v 1.30 2016/05/09 21:46:56 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>
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 */
bufspace -= (size_t)bytes;
p += bytes;
}
+ wargv[i] = NULL;
return wargv;
}
-/* $NetBSD: readline.h,v 1.40 2016/08/24 13:10:59 christos Exp $ */
+/* $NetBSD: readline.h,v 1.41 2016/10/28 18:32:35 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
extern char *rl_terminal_name;
extern int rl_already_prompted;
extern char *rl_prompt;
+extern int rl_done;
/*
* The following is not implemented
*/
-/* $NetBSD: filecomplete.c,v 1.43 2016/04/11 00:50:13 christos Exp $ */
+/* $NetBSD: filecomplete.c,v 1.44 2016/10/31 17:46:32 abhinav Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: filecomplete.c,v 1.43 2016/04/11 00:50:13 christos Exp $");
+__RCSID("$NetBSD: filecomplete.c,v 1.44 2016/10/31 17:46:32 abhinav Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
ct_decode_string(matches[0], &el->el_scratch));
}
- if (what_to_do == '?')
- goto display_matches;
if (matches[2] == NULL &&
(matches[1] == NULL || strcmp(matches[0], matches[1]) == 0)) {
el_winsertstr(el,
ct_decode_string((*app_func)(matches[0]),
&el->el_scratch));
- } else if (what_to_do == '!') {
- display_matches:
+ } else if (what_to_do == '!' || what_to_do == '?') {
/*
* More than one match and requested to list possible
* matches.
-/* $NetBSD: hist.c,v 1.29 2016/05/09 21:46:56 christos Exp $ */
+/* $NetBSD: hist.c,v 1.32 2017/03/05 19:23:58 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
#if 0
static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: hist.c,v 1.29 2016/05/09 21:46:56 christos Exp $");
+__RCSID("$NetBSD: hist.c,v 1.32 2017/03/05 19:23:58 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
*/
#include <stdlib.h>
#include <string.h>
+#include <vis.h>
#include "el.h"
{
const wchar_t *hp;
int h;
+ size_t blen, hlen;
if (el->el_history.eventno == 0) { /* if really the current line */
(void) wcsncpy(el->el_line.buffer, el->el_history.buf,
return CC_ERROR;
for (h = 1; h < el->el_history.eventno; h++)
- if ((hp = HIST_NEXT(el)) == NULL) {
- el->el_history.eventno = h;
- return CC_ERROR;
- }
- (void) wcsncpy(el->el_line.buffer, hp,
- (size_t)(el->el_line.limit - el->el_line.buffer));
- el->el_line.buffer[el->el_line.limit - el->el_line.buffer - 1] = '\0';
- el->el_line.lastchar = el->el_line.buffer + wcslen(el->el_line.buffer);
+ if ((hp = HIST_NEXT(el)) == NULL)
+ goto out;
+
+ hlen = wcslen(hp) + 1;
+ blen = (size_t)(el->el_line.limit - el->el_line.buffer);
+ if (hlen > blen && !ch_enlargebufs(el, hlen))
+ goto out;
+
+ memcpy(el->el_line.buffer, hp, hlen * sizeof(*hp));
+ el->el_line.lastchar = el->el_line.buffer + hlen - 1;
if (el->el_line.lastchar > el->el_line.buffer
&& el->el_line.lastchar[-1] == '\n')
el->el_line.cursor = el->el_line.lastchar;
return CC_REFRESH;
+out:
+ el->el_history.eventno = h;
+ return CC_ERROR;
+
}
return -1;
if (argc == 1 || wcscmp(argv[1], L"list") == 0) {
+ size_t maxlen = 0;
+ char *buf = NULL;
+ int hno = 1;
/* List history entries */
- for (str = HIST_LAST(el); str != NULL; str = HIST_PREV(el))
- (void) fprintf(el->el_outfile, "%d %s",
- el->el_history.ev.num, ct_encode_string(str, &el->el_scratch));
+ for (str = HIST_LAST(el); str != NULL; str = HIST_PREV(el)) {
+ char *ptr =
+ ct_encode_string(str, &el->el_scratch);
+ size_t len = strlen(ptr);
+ if (len > 0 && ptr[len - 1] == '\n')
+ ptr[--len] = '\0';
+ len = len * 4 + 1;
+ if (len >= maxlen) {
+ maxlen = len + 1024;
+ char *nbuf = el_realloc(buf, maxlen);
+ if (nbuf == NULL) {
+ el_free(buf);
+ return -1;
+ }
+ buf = nbuf;
+ }
+ strvis(buf, ptr, VIS_NL);
+ (void) fprintf(el->el_outfile, "%d\t%s\n",
+ hno++, buf);
+ }
+ el_free(buf);
return 0;
}
-/* $NetBSD: read.c,v 1.101 2016/05/25 13:01:11 christos Exp $ */
+/* $NetBSD: read.c,v 1.102 2016/12/11 15:47:06 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
#if 0
static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: read.c,v 1.101 2016/05/25 13:01:11 christos Exp $");
+__RCSID("$NetBSD: read.c,v 1.102 2016/12/11 15:47:06 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
read_clearmacros(&el_read->macros);
el_free(el_read->macros.macro);
el_read->macros.macro = NULL;
+ el_free(el_read);
}
/* el_read_setfn():
-/* $NetBSD: readline.c,v 1.138 2016/09/01 13:23:44 mbalmer Exp $ */
+/* $NetBSD: readline.c,v 1.140 2017/01/09 03:09:05 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.138 2016/09/01 13:23:44 mbalmer Exp $");
+__RCSID("$NetBSD: readline.c,v 1.140 2017/01/09 03:09:05 christos Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
{
int i;
- i = (*rl_getc_function)(NULL);
+ i = (*rl_getc_function)(rl_instream);
if (i == -1)
return 0;
*c = (wchar_t)i;
idx++;
}
if (sign)
- num = history_length - num + 1;
+ num = history_length - num + history_base;
if (!(he = history_get(num)))
return NULL;
-/* $NetBSD: vis.c,v 1.71 2016/01/14 20:41:23 christos Exp $ */
+/* $NetBSD: vis.c,v 1.72 2017/02/12 22:37:49 christos Exp $ */
/*-
* Copyright (c) 1989, 1993
#include "config.h"
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: vis.c,v 1.71 2016/01/14 20:41:23 christos Exp $");
+__RCSID("$NetBSD: vis.c,v 1.72 2017/02/12 22:37:49 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#ifdef __FBSDID
__FBSDID("$FreeBSD$");
_DIAGASSERT(mbsrc != NULL || mblength == 0);
_DIAGASSERT(mbextra != NULL);
+ mbslength = (ssize_t)mblength;
+ /*
+ * When inputing a single character, must also read in the
+ * next character for nextc, the look-ahead character.
+ */
+ if (mbslength == 1)
+ mbslength++;
+
/*
* Input (mbsrc) is a char string considered to be multibyte
* characters. The input loop will read this string pulling
/* Allocate space for the wide char strings */
psrc = pdst = extra = NULL;
mdst = NULL;
- if ((psrc = calloc(mblength + 1, sizeof(*psrc))) == NULL)
+ if ((psrc = calloc(mbslength + 1, sizeof(*psrc))) == NULL)
return -1;
- if ((pdst = calloc((4 * mblength) + 1, sizeof(*pdst))) == NULL)
+ if ((pdst = calloc((4 * mbslength) + 1, sizeof(*pdst))) == NULL)
goto out;
if (*mbdstp == NULL) {
- if ((mdst = calloc((4 * mblength) + 1, sizeof(*mdst))) == NULL)
+ if ((mdst = calloc((4 * mbslength) + 1, sizeof(*mdst))) == NULL)
goto out;
*mbdstp = mdst;
}
* stop at NULs because we may be processing a block of data
* that includes NULs.
*/
- mbslength = (ssize_t)mblength;
- /*
- * When inputing a single character, must also read in the
- * next character for nextc, the look-ahead character.
- */
- if (mbslength == 1)
- mbslength++;
while (mbslength > 0) {
/* Convert one multibyte character to wchar_t. */
if (!cerr)
}
len = src - psrc;
src = psrc;
+
/*
* In the single character input case, we will have actually
* processed two characters, c and nextc. Reset len back to