Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106403724
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
37 KB
Referenced Files
None
Subscribers
None
View Options
Index: vendor/NetBSD/libedit/dist/Makefile
===================================================================
--- vendor/NetBSD/libedit/dist/Makefile (revision 296171)
+++ vendor/NetBSD/libedit/dist/Makefile (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/Makefile
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/TEST/Makefile
===================================================================
--- vendor/NetBSD/libedit/dist/TEST/Makefile (revision 296171)
+++ vendor/NetBSD/libedit/dist/TEST/Makefile (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/TEST/Makefile
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/TEST/tc1.c
===================================================================
--- vendor/NetBSD/libedit/dist/TEST/tc1.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/TEST/tc1.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/TEST/tc1.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/TEST/wtc1.c
===================================================================
--- vendor/NetBSD/libedit/dist/TEST/wtc1.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/TEST/wtc1.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/TEST/wtc1.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/chared.c
===================================================================
--- vendor/NetBSD/libedit/dist/chared.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/chared.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/chared.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/chared.h
===================================================================
--- vendor/NetBSD/libedit/dist/chared.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/chared.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/chared.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/chartype.c
===================================================================
--- vendor/NetBSD/libedit/dist/chartype.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/chartype.c (revision 296172)
@@ -1,390 +1,383 @@
-/* $NetBSD: chartype.c,v 1.22 2016/02/24 17:20:01 christos Exp $ */
+/* $NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 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
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
/*
* chartype.c: character classification and meta information
*/
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: chartype.c,v 1.22 2016/02/24 17:20:01 christos Exp $");
+__RCSID("$NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $");
#endif /* not lint && not SCCSID */
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include "el.h"
#define CT_BUFSIZ ((size_t)1024)
#ifdef WIDECHAR
protected int
ct_conv_cbuff_resize(ct_buffer_t *conv, size_t csize)
{
void *p;
if (csize <= conv->csize)
return 0;
conv->csize = csize;
p = el_realloc(conv->cbuff, conv->csize * sizeof(*conv->cbuff));
if (p == NULL) {
conv->csize = 0;
el_free(conv->cbuff);
conv->cbuff = NULL;
return -1;
}
conv->cbuff = p;
return 0;
}
protected int
ct_conv_wbuff_resize(ct_buffer_t *conv, size_t wsize)
{
void *p;
if (wsize <= conv->wsize)
return 0;
conv->wsize = wsize;
p = el_realloc(conv->wbuff, conv->wsize * sizeof(*conv->wbuff));
if (p == NULL) {
conv->wsize = 0;
el_free(conv->wbuff);
conv->wbuff = NULL;
return -1;
}
conv->wbuff = p;
return 0;
}
public char *
ct_encode_string(const Char *s, ct_buffer_t *conv)
{
char *dst;
ssize_t used;
if (!s)
return NULL;
dst = conv->cbuff;
for (;;) {
used = (ssize_t)(dst - conv->cbuff);
if ((conv->csize - (size_t)used) < 5) {
if (ct_conv_cbuff_resize(conv,
conv->csize + CT_BUFSIZ) == -1)
return NULL;
dst = conv->cbuff + used;
}
if (!*s)
break;
used = ct_encode_char(dst, (size_t)5, *s);
if (used == -1) /* failed to encode, need more buffer space */
abort();
++s;
dst += used;
}
*dst = '\0';
return conv->cbuff;
}
public Char *
ct_decode_string(const char *s, ct_buffer_t *conv)
{
size_t len;
if (!s)
return NULL;
len = ct_mbstowcs(NULL, s, (size_t)0);
if (len == (size_t)-1)
return NULL;
if (conv->wsize < ++len)
if (ct_conv_wbuff_resize(conv, len + CT_BUFSIZ) == -1)
return NULL;
ct_mbstowcs(conv->wbuff, s, conv->wsize);
return conv->wbuff;
}
protected Char **
ct_decode_argv(int argc, const char *argv[], ct_buffer_t *conv)
{
size_t bufspace;
int i;
Char *p;
Char **wargv;
ssize_t bytes;
/* Make sure we have enough space in the conversion buffer to store all
* the argv strings. */
for (i = 0, bufspace = 0; i < argc; ++i)
bufspace += argv[i] ? strlen(argv[i]) + 1 : 0;
if (conv->wsize < ++bufspace)
if (ct_conv_wbuff_resize(conv, bufspace + CT_BUFSIZ) == -1)
return NULL;
wargv = el_malloc((size_t)argc * sizeof(*wargv));
for (i = 0, p = conv->wbuff; i < argc; ++i) {
if (!argv[i]) { /* don't pass null pointers to mbstowcs */
wargv[i] = NULL;
continue;
} else {
wargv[i] = p;
bytes = (ssize_t)mbstowcs(p, argv[i], bufspace);
}
if (bytes == -1) {
el_free(wargv);
return NULL;
} else
bytes++; /* include '\0' in the count */
bufspace -= (size_t)bytes;
p += bytes;
}
return wargv;
}
protected size_t
ct_enc_width(Char c)
{
/* UTF-8 encoding specific values */
if (c < 0x80)
return 1;
else if (c < 0x0800)
return 2;
else if (c < 0x10000)
return 3;
else if (c < 0x110000)
return 4;
else
return 0; /* not a valid codepoint */
}
protected ssize_t
ct_encode_char(char *dst, size_t len, Char c)
{
ssize_t l = 0;
if (len < ct_enc_width(c))
return -1;
l = ct_wctomb(dst, c);
if (l < 0) {
ct_wctomb_reset;
l = 0;
}
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 *
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;
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! */
}
else
++s;
dst += 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;
}
*dst = 0;
return buff;
out:
el_free(buff);
buffsize = 0;
return NULL;
}
protected int
ct_visual_width(Char c)
{
int t = ct_chr_class(c);
switch (t) {
case CHTYPE_ASCIICTL:
return 2; /* ^@ ^? etc. */
case CHTYPE_TAB:
return 1; /* Hmm, this really need to be handled outside! */
case CHTYPE_NL:
return 0; /* Should this be 1 instead? */
#ifdef WIDECHAR
case CHTYPE_PRINT:
return wcwidth(c);
case CHTYPE_NONPRINT:
if (c > 0xffff) /* prefer standard 4-byte display over 5-byte */
return 8; /* \U+12345 */
else
return 7; /* \U+1234 */
#else
case CHTYPE_PRINT:
return 1;
case CHTYPE_NONPRINT:
return 4; /* \123 */
#endif
default:
return 0; /* should not happen */
}
}
protected ssize_t
ct_visual_char(Char *dst, size_t len, Char c)
{
int t = ct_chr_class(c);
switch (t) {
case CHTYPE_TAB:
case CHTYPE_NL:
case CHTYPE_ASCIICTL:
if (len < 2)
return -1; /* insufficient space */
*dst++ = '^';
if (c == '\177')
*dst = '?'; /* DEL -> ^? */
else
*dst = c | 0100; /* uncontrolify it */
return 2;
case CHTYPE_PRINT:
if (len < 1)
return -1; /* insufficient space */
*dst = c;
return 1;
case CHTYPE_NONPRINT:
/* we only use single-width glyphs for display,
* so this is right */
if ((ssize_t)len < ct_visual_width(c))
return -1; /* insufficient space */
#ifdef WIDECHAR
*dst++ = '\\';
*dst++ = 'U';
*dst++ = '+';
#define tohexdigit(v) "0123456789ABCDEF"[v]
if (c > 0xffff) /* prefer standard 4-byte display over 5-byte */
*dst++ = tohexdigit(((unsigned int) c >> 16) & 0xf);
*dst++ = tohexdigit(((unsigned int) c >> 12) & 0xf);
*dst++ = tohexdigit(((unsigned int) c >> 8) & 0xf);
*dst++ = tohexdigit(((unsigned int) c >> 4) & 0xf);
*dst = tohexdigit(((unsigned int) c ) & 0xf);
return c > 0xffff ? 8 : 7;
#else
*dst++ = '\\';
#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);
#endif
/*FALLTHROUGH*/
/* these two should be handled outside this function */
default: /* we should never hit the default */
return 0;
}
}
protected int
ct_chr_class(Char c)
{
if (c == '\t')
return CHTYPE_TAB;
else if (c == '\n')
return CHTYPE_NL;
else if (IsASCII(c) && Iscntrl(c))
return CHTYPE_ASCIICTL;
else if (Isprint(c))
return CHTYPE_PRINT;
else
return CHTYPE_NONPRINT;
}
Property changes on: vendor/NetBSD/libedit/dist/chartype.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/chartype.h
===================================================================
--- vendor/NetBSD/libedit/dist/chartype.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/chartype.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/chartype.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/common.c
===================================================================
--- vendor/NetBSD/libedit/dist/common.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/common.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/common.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/config.h
===================================================================
--- vendor/NetBSD/libedit/dist/config.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/config.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/config.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/editline.3
===================================================================
--- vendor/NetBSD/libedit/dist/editline.3 (revision 296171)
+++ vendor/NetBSD/libedit/dist/editline.3 (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/editline.3
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/editrc.5
===================================================================
--- vendor/NetBSD/libedit/dist/editrc.5 (revision 296171)
+++ vendor/NetBSD/libedit/dist/editrc.5 (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/editrc.5
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/el.c
===================================================================
--- vendor/NetBSD/libedit/dist/el.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/el.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/el.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/el.h
===================================================================
--- vendor/NetBSD/libedit/dist/el.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/el.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/el.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/eln.c
===================================================================
--- vendor/NetBSD/libedit/dist/eln.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/eln.c (revision 296172)
@@ -1,399 +1,392 @@
-/* $NetBSD: eln.c,v 1.27 2016/02/24 17:13:22 christos Exp $ */
+/* $NetBSD: eln.c,v 1.28 2016/02/28 23:02:24 christos Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 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
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: eln.c,v 1.27 2016/02/24 17:13:22 christos Exp $");
+__RCSID("$NetBSD: eln.c,v 1.28 2016/02/28 23:02:24 christos Exp $");
#endif /* not lint && not SCCSID */
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include "el.h"
public int
el_getc(EditLine *el, char *cp)
{
int num_read;
wchar_t wc = 0;
num_read = el_wgetc(el, &wc);
*cp = '\0';
if (num_read <= 0)
return num_read;
num_read = ct_wctob(wc);
if (num_read == EOF) {
errno = ERANGE;
return -1;
} else {
*cp = (char)num_read;
return 1;
}
}
#ifdef WIDECHAR
public void
el_push(EditLine *el, const char *str)
{
/* Using multibyte->wide string decoding works fine under single-byte
* character sets too, and Does The Right Thing. */
el_wpush(el, ct_decode_string(str, &el->el_lgcyconv));
}
public const char *
el_gets(EditLine *el, int *nread)
{
const wchar_t *tmp;
tmp = el_wgets(el, nread);
if (tmp != NULL) {
int i;
size_t nwread = 0;
for (i = 0; i < *nread; i++)
nwread += ct_enc_width(tmp[i]);
*nread = (int)nwread;
}
return ct_encode_string(tmp, &el->el_lgcyconv);
}
public int
el_parse(EditLine *el, int argc, const char *argv[])
{
int ret;
const wchar_t **wargv;
wargv = (const wchar_t **)
ct_decode_argv(argc, argv, &el->el_lgcyconv);
if (!wargv)
return -1;
ret = el_wparse(el, argc, wargv);
ct_free_argv(wargv);
return ret;
}
public int
el_set(EditLine *el, int op, ...)
{
va_list ap;
int ret;
if (!el)
return -1;
va_start(ap, op);
switch (op) {
case EL_PROMPT: /* el_pfunc_t */
case EL_RPROMPT: {
el_pfunc_t p = va_arg(ap, el_pfunc_t);
ret = prompt_set(el, p, 0, op, 0);
break;
}
case EL_RESIZE: {
el_zfunc_t p = va_arg(ap, el_zfunc_t);
void *arg = va_arg(ap, void *);
ret = ch_resizefun(el, p, arg);
break;
}
case EL_ALIAS_TEXT: {
el_afunc_t p = va_arg(ap, el_afunc_t);
void *arg = va_arg(ap, void *);
ret = ch_aliasfun(el, p, arg);
break;
}
case EL_PROMPT_ESC:
case EL_RPROMPT_ESC: {
el_pfunc_t p = va_arg(ap, el_pfunc_t);
int c = va_arg(ap, int);
ret = prompt_set(el, p, c, op, 0);
break;
}
case EL_TERMINAL: /* const char * */
ret = el_wset(el, op, va_arg(ap, char *));
break;
case EL_EDITOR: /* const wchar_t * */
ret = el_wset(el, op, ct_decode_string(va_arg(ap, char *),
&el->el_lgcyconv));
break;
case EL_SIGNAL: /* int */
case EL_EDITMODE:
case EL_UNBUFFERED:
case EL_PREP_TERM:
ret = el_wset(el, op, va_arg(ap, int));
break;
case EL_BIND: /* const char * list -> const wchar_t * list */
case EL_TELLTC:
case EL_SETTC:
case EL_ECHOTC:
case EL_SETTY: {
const char *argv[20];
int i;
const wchar_t **wargv;
for (i = 1; i < (int)__arraycount(argv) - 1; ++i)
if ((argv[i] = va_arg(ap, const char *)) == NULL)
break;
argv[0] = argv[i] = NULL;
wargv = (const wchar_t **)
ct_decode_argv(i + 1, argv, &el->el_lgcyconv);
if (!wargv) {
ret = -1;
goto out;
}
/*
* AFAIK we can't portably pass through our new wargv to
* el_wset(), so we have to reimplement the body of
* el_wset() for these ops.
*/
switch (op) {
case EL_BIND:
wargv[0] = STR("bind");
ret = map_bind(el, i, wargv);
break;
case EL_TELLTC:
wargv[0] = STR("telltc");
ret = terminal_telltc(el, i, wargv);
break;
case EL_SETTC:
wargv[0] = STR("settc");
ret = terminal_settc(el, i, wargv);
break;
case EL_ECHOTC:
wargv[0] = STR("echotc");
ret = terminal_echotc(el, i, wargv);
break;
case EL_SETTY:
wargv[0] = STR("setty");
ret = tty_stty(el, i, wargv);
break;
default:
ret = -1;
}
ct_free_argv(wargv);
break;
}
/* XXX: do we need to change el_func_t too? */
case EL_ADDFN: { /* const char *, const char *, el_func_t */
const char *args[2];
el_func_t func;
wchar_t **wargv;
args[0] = va_arg(ap, const char *);
args[1] = va_arg(ap, const char *);
func = va_arg(ap, el_func_t);
wargv = ct_decode_argv(2, args, &el->el_lgcyconv);
if (!wargv) {
ret = -1;
goto out;
}
/* XXX: The two strdup's leak */
ret = map_addfunc(el, Strdup(wargv[0]), Strdup(wargv[1]),
func);
ct_free_argv(wargv);
break;
}
case EL_HIST: { /* hist_fun_t, const char * */
hist_fun_t fun = va_arg(ap, hist_fun_t);
void *ptr = va_arg(ap, void *);
ret = hist_set(el, fun, ptr);
el->el_flags |= NARROW_HISTORY;
break;
}
case EL_GETCFN: /* el_rfunc_t */
ret = el_wset(el, op, va_arg(ap, el_rfunc_t));
break;
case EL_CLIENTDATA: /* void * */
ret = el_wset(el, op, va_arg(ap, void *));
break;
case EL_SETFP: { /* int, FILE * */
int what = va_arg(ap, int);
FILE *fp = va_arg(ap, FILE *);
ret = el_wset(el, op, what, fp);
break;
}
case EL_REFRESH:
re_clear_display(el);
re_refresh(el);
terminal__flush(el);
ret = 0;
break;
default:
ret = -1;
break;
}
out:
va_end(ap);
return ret;
}
public int
el_get(EditLine *el, int op, ...)
{
va_list ap;
int ret;
if (!el)
return -1;
va_start(ap, op);
switch (op) {
case EL_PROMPT: /* el_pfunc_t * */
case EL_RPROMPT: {
el_pfunc_t *p = va_arg(ap, el_pfunc_t *);
ret = prompt_get(el, p, 0, op);
break;
}
case EL_PROMPT_ESC: /* el_pfunc_t *, char **/
case EL_RPROMPT_ESC: {
el_pfunc_t *p = va_arg(ap, el_pfunc_t *);
char *c = va_arg(ap, char *);
wchar_t wc = 0;
ret = prompt_get(el, p, &wc, op);
*c = (char)wc;
break;
}
case EL_EDITOR: {
const char **p = va_arg(ap, const char **);
const wchar_t *pw;
ret = el_wget(el, op, &pw);
*p = ct_encode_string(pw, &el->el_lgcyconv);
if (!el->el_lgcyconv.csize)
ret = -1;
break;
}
case EL_TERMINAL: /* const char ** */
ret = el_wget(el, op, va_arg(ap, const char **));
break;
case EL_SIGNAL: /* int * */
case EL_EDITMODE:
case EL_UNBUFFERED:
case EL_PREP_TERM:
ret = el_wget(el, op, va_arg(ap, int *));
break;
case EL_GETTC: {
char *argv[20];
static char gettc[] = "gettc";
int i;
for (i = 1; i < (int)__arraycount(argv); ++i)
if ((argv[i] = va_arg(ap, char *)) == NULL)
break;
argv[0] = gettc;
ret = terminal_gettc(el, i, argv);
break;
}
case EL_GETCFN: /* el_rfunc_t */
ret = el_wget(el, op, va_arg(ap, el_rfunc_t *));
break;
case EL_CLIENTDATA: /* void ** */
ret = el_wget(el, op, va_arg(ap, void **));
break;
case EL_GETFP: { /* int, FILE ** */
int what = va_arg(ap, int);
FILE **fpp = va_arg(ap, FILE **);
ret = el_wget(el, op, what, fpp);
break;
}
default:
ret = -1;
break;
}
va_end(ap);
return ret;
}
const LineInfo *
el_line(EditLine *el)
{
const LineInfoW *winfo = el_wline(el);
LineInfo *info = &el->el_lgcylinfo;
size_t offset;
const Char *p;
info->buffer = ct_encode_string(winfo->buffer, &el->el_lgcyconv);
offset = 0;
for (p = winfo->buffer; p < winfo->cursor; p++)
offset += ct_enc_width(*p);
info->cursor = info->buffer + offset;
offset = 0;
for (p = winfo->buffer; p < winfo->lastchar; p++)
offset += ct_enc_width(*p);
info->lastchar = info->buffer + offset;
return info;
}
int
el_insertstr(EditLine *el, const char *str)
{
return el_winsertstr(el, ct_decode_string(str, &el->el_lgcyconv));
}
#endif /* WIDECHAR */
Property changes on: vendor/NetBSD/libedit/dist/eln.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/emacs.c
===================================================================
--- vendor/NetBSD/libedit/dist/emacs.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/emacs.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/emacs.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/filecomplete.c
===================================================================
--- vendor/NetBSD/libedit/dist/filecomplete.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/filecomplete.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/filecomplete.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/filecomplete.h
===================================================================
--- vendor/NetBSD/libedit/dist/filecomplete.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/filecomplete.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/filecomplete.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/hist.c
===================================================================
--- vendor/NetBSD/libedit/dist/hist.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/hist.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/hist.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/hist.h
===================================================================
--- vendor/NetBSD/libedit/dist/hist.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/hist.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/hist.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/histedit.h
===================================================================
--- vendor/NetBSD/libedit/dist/histedit.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/histedit.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/histedit.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/history.c
===================================================================
--- vendor/NetBSD/libedit/dist/history.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/history.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/history.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/map.c
===================================================================
--- vendor/NetBSD/libedit/dist/map.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/map.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/map.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/map.h
===================================================================
--- vendor/NetBSD/libedit/dist/map.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/map.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/map.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/parse.c
===================================================================
--- vendor/NetBSD/libedit/dist/parse.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/parse.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/parse.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/parse.h
===================================================================
--- vendor/NetBSD/libedit/dist/parse.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/parse.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/parse.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/prompt.c
===================================================================
--- vendor/NetBSD/libedit/dist/prompt.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/prompt.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/prompt.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/prompt.h
===================================================================
--- vendor/NetBSD/libedit/dist/prompt.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/prompt.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/prompt.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/read.c
===================================================================
--- vendor/NetBSD/libedit/dist/read.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/read.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/read.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/read.h
===================================================================
--- vendor/NetBSD/libedit/dist/read.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/read.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/read.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/readline/Makefile
===================================================================
--- vendor/NetBSD/libedit/dist/readline/Makefile (revision 296171)
+++ vendor/NetBSD/libedit/dist/readline/Makefile (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/readline/Makefile
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/readline/readline.h
===================================================================
--- vendor/NetBSD/libedit/dist/readline/readline.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/readline/readline.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/readline/readline.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/readline.c
===================================================================
--- vendor/NetBSD/libedit/dist/readline.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/readline.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/readline.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/refresh.c
===================================================================
--- vendor/NetBSD/libedit/dist/refresh.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/refresh.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/refresh.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/refresh.h
===================================================================
--- vendor/NetBSD/libedit/dist/refresh.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/refresh.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/refresh.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/search.c
===================================================================
--- vendor/NetBSD/libedit/dist/search.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/search.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/search.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/search.h
===================================================================
--- vendor/NetBSD/libedit/dist/search.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/search.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/search.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/sig.c
===================================================================
--- vendor/NetBSD/libedit/dist/sig.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/sig.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/sig.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/sig.h
===================================================================
--- vendor/NetBSD/libedit/dist/sig.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/sig.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/sig.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/sys.h
===================================================================
--- vendor/NetBSD/libedit/dist/sys.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/sys.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/sys.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/tokenizer.c
===================================================================
--- vendor/NetBSD/libedit/dist/tokenizer.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/tokenizer.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/tokenizer.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/tty.c
===================================================================
--- vendor/NetBSD/libedit/dist/tty.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/tty.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/tty.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/tty.h
===================================================================
--- vendor/NetBSD/libedit/dist/tty.h (revision 296171)
+++ vendor/NetBSD/libedit/dist/tty.h (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/tty.h
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
Index: vendor/NetBSD/libedit/dist/vi.c
===================================================================
--- vendor/NetBSD/libedit/dist/vi.c (revision 296171)
+++ vendor/NetBSD/libedit/dist/vi.c (revision 296172)
Property changes on: vendor/NetBSD/libedit/dist/vi.c
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-FreeBSD=%H
\ No newline at end of property
File Metadata
Details
Attached
Mime Type
text/x-c
Expires
Wed, Jan 1, 4:02 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15639813
Default Alt Text
(37 KB)
Attached To
Mode
rS FreeBSD src repository - subversion
Attached
Detach File
Event Timeline
Log In to Comment