MFC the latest synchronisation with the NetBSD code.
This commit is contained in:
parent
21cbc159a9
commit
edd291ee53
@ -30,7 +30,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)chared.h 8.1 (Berkeley) 6/4/93
|
||||
* $NetBSD: chared.h,v 1.16 2005/08/08 14:05:37 christos Exp $
|
||||
* $NetBSD: chared.h,v 1.17 2006/03/06 21:11:56 christos Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
@ -116,7 +116,6 @@ typedef struct el_chared_t {
|
||||
} el_chared_t;
|
||||
|
||||
|
||||
#define STReof "^D\b\b"
|
||||
#define STRQQ "\"\""
|
||||
|
||||
#define isglob(a) (strchr("*[]?", (a)) != NULL)
|
||||
|
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: common.c,v 1.18 2005/08/08 14:05:37 christos Exp $
|
||||
* $NetBSD: common.c,v 1.19 2006/03/06 21:11:56 christos Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
@ -135,7 +135,7 @@ ed_delete_prev_word(EditLine *el, int c __unused)
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_delete_next_char(EditLine *el, int c __unused)
|
||||
ed_delete_next_char(EditLine *el, int c)
|
||||
{
|
||||
#ifdef notdef /* XXX */
|
||||
#define EL el->el_line
|
||||
@ -152,9 +152,8 @@ ed_delete_next_char(EditLine *el, int c __unused)
|
||||
#ifdef KSHVI
|
||||
return (CC_ERROR);
|
||||
#else
|
||||
term_overwrite(el, STReof, 4);
|
||||
/* then do an EOF */
|
||||
term__flush();
|
||||
term_writechar(el, c);
|
||||
return (CC_EOF);
|
||||
#endif
|
||||
} else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: editline.3,v 1.50 2005/10/12 09:29:43 wiz Exp $
|
||||
.\" $NetBSD: editline.3,v 1.51 2006/08/21 12:45:30 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -13,11 +13,7 @@
|
||||
.\" 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
|
||||
.\" 3. 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.
|
||||
.\"
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: editrc.5,v 1.19 2003/11/01 23:35:33 christos Exp $
|
||||
.\" $NetBSD: editrc.5,v 1.20 2006/08/21 12:45:30 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -13,11 +13,7 @@
|
||||
.\" 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
|
||||
.\" 3. 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.
|
||||
.\"
|
||||
|
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: emacs.c,v 1.20 2005/08/08 14:05:37 christos Exp $
|
||||
* $NetBSD: emacs.c,v 1.21 2006/03/06 21:11:56 christos Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
@ -50,15 +50,14 @@ __FBSDID("$FreeBSD$");
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_delete_or_list(EditLine *el, int c __unused)
|
||||
em_delete_or_list(EditLine *el, int c)
|
||||
{
|
||||
|
||||
if (el->el_line.cursor == el->el_line.lastchar) {
|
||||
/* if I'm at the end */
|
||||
if (el->el_line.cursor == el->el_line.buffer) {
|
||||
/* and the beginning */
|
||||
term_overwrite(el, STReof, 4); /* then do an EOF */
|
||||
term__flush();
|
||||
term_writec(el, c); /* then do an EOF */
|
||||
return (CC_EOF);
|
||||
} else {
|
||||
/*
|
||||
|
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: history.c,v 1.31 2005/08/01 14:34:06 christos Exp $
|
||||
* $NetBSD: history.c,v 1.32 2006/09/28 13:52:51 christos Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
@ -543,6 +543,7 @@ history_end(History *h)
|
||||
|
||||
if (h->h_next == history_def_next)
|
||||
history_def_clear(h->h_ref, &ev);
|
||||
h_free(h->h_ref);
|
||||
h_free(h);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: key.c,v 1.17 2005/08/08 14:05:37 christos Exp $
|
||||
* $NetBSD: key.c,v 1.19 2006/03/23 20:22:51 christos Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
@ -88,7 +88,6 @@ private int node__delete(EditLine *, key_node_t **, const char *);
|
||||
private int node_lookup(EditLine *, const char *, key_node_t *,
|
||||
int);
|
||||
private int node_enum(EditLine *, key_node_t *, int);
|
||||
private int key__decode_char(char *, int, int);
|
||||
|
||||
#define KEY_BUFSIZ EL_BUFSIZ
|
||||
|
||||
@ -494,7 +493,7 @@ node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt)
|
||||
/* If match put this char into el->el_key.buf. Recurse */
|
||||
if (ptr->ch == *str) {
|
||||
/* match found */
|
||||
ncnt = key__decode_char(el->el_key.buf, cnt,
|
||||
ncnt = key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt,
|
||||
(unsigned char) ptr->ch);
|
||||
if (ptr->next != NULL)
|
||||
/* not yet at leaf */
|
||||
@ -548,7 +547,8 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt)
|
||||
return (-1);
|
||||
}
|
||||
/* put this char at end of str */
|
||||
ncnt = key__decode_char(el->el_key.buf, cnt, (unsigned char) ptr->ch);
|
||||
ncnt = key__decode_char(el->el_key.buf, KEY_BUFSIZ, cnt,
|
||||
(unsigned char)ptr->ch);
|
||||
if (ptr->next == NULL) {
|
||||
/* print this key and function */
|
||||
el->el_key.buf[ncnt + 1] = '"';
|
||||
@ -579,9 +579,10 @@ key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
|
||||
switch (ntype) {
|
||||
case XK_STR:
|
||||
case XK_EXE:
|
||||
(void) fprintf(el->el_outfile, fmt, key,
|
||||
key__decode_str(val->str, unparsbuf,
|
||||
ntype == XK_STR ? "\"\"" : "[]"));
|
||||
(void) key__decode_str(val->str, unparsbuf,
|
||||
sizeof(unparsbuf),
|
||||
ntype == XK_STR ? "\"\"" : "[]");
|
||||
(void) fprintf(el->el_outfile, fmt, key, unparsbuf);
|
||||
break;
|
||||
case XK_CMD:
|
||||
for (fp = el->el_map.help; fp->name; fp++)
|
||||
@ -606,85 +607,99 @@ key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
|
||||
}
|
||||
|
||||
|
||||
#define ADDC(c) \
|
||||
if (b < eb) \
|
||||
*b++ = c; \
|
||||
else \
|
||||
b++
|
||||
/* key__decode_char():
|
||||
* Put a printable form of char in buf.
|
||||
*/
|
||||
private int
|
||||
key__decode_char(char *buf, int cnt, int ch)
|
||||
protected int
|
||||
key__decode_char(char *buf, int cnt, int off, int ch)
|
||||
{
|
||||
ch = (unsigned char)ch;
|
||||
char *sb = buf + off;
|
||||
char *eb = buf + cnt;
|
||||
char *b = sb;
|
||||
|
||||
ch = (unsigned char)ch;
|
||||
if (ch == 0) {
|
||||
buf[cnt++] = '^';
|
||||
buf[cnt] = '@';
|
||||
return (cnt);
|
||||
ADDC('^');
|
||||
ADDC('@');
|
||||
return b - sb;
|
||||
}
|
||||
if (iscntrl(ch)) {
|
||||
buf[cnt++] = '^';
|
||||
if (ch == 0177)
|
||||
buf[cnt] = '?';
|
||||
ADDC('^');
|
||||
if (ch == '\177')
|
||||
ADDC('?');
|
||||
else
|
||||
buf[cnt] = toascii(ch) | 0100;
|
||||
ADDC(toascii(ch) | 0100);
|
||||
} else if (ch == '^') {
|
||||
buf[cnt++] = '\\';
|
||||
buf[cnt] = '^';
|
||||
ADDC('\\');
|
||||
ADDC('^');
|
||||
} else if (ch == '\\') {
|
||||
buf[cnt++] = '\\';
|
||||
buf[cnt] = '\\';
|
||||
ADDC('\\');
|
||||
ADDC('\\');
|
||||
} else if (ch == ' ' || (isprint(ch) && !isspace(ch))) {
|
||||
buf[cnt] = ch;
|
||||
ADDC(ch);
|
||||
} else {
|
||||
buf[cnt++] = '\\';
|
||||
buf[cnt++] = (((unsigned int) ch >> 6) & 7) + '0';
|
||||
buf[cnt++] = (((unsigned int) ch >> 3) & 7) + '0';
|
||||
buf[cnt] = (ch & 7) + '0';
|
||||
ADDC('\\');
|
||||
ADDC((((unsigned int) ch >> 6) & 7) + '0');
|
||||
ADDC((((unsigned int) ch >> 3) & 7) + '0');
|
||||
ADDC((ch & 7) + '0');
|
||||
}
|
||||
return (cnt);
|
||||
return b - sb;
|
||||
}
|
||||
|
||||
|
||||
/* key__decode_str():
|
||||
* Make a printable version of the ey
|
||||
*/
|
||||
protected char *
|
||||
key__decode_str(const char *str, char *buf, const char *sep)
|
||||
protected int
|
||||
key__decode_str(const char *str, char *buf, int len, const char *sep)
|
||||
{
|
||||
char *b;
|
||||
char *b = buf, *eb = b + len;
|
||||
const char *p;
|
||||
|
||||
b = buf;
|
||||
if (sep[0] != '\0')
|
||||
*b++ = sep[0];
|
||||
if (*str == 0) {
|
||||
*b++ = '^';
|
||||
*b++ = '@';
|
||||
if (sep[0] != '\0' && sep[1] != '\0')
|
||||
*b++ = sep[1];
|
||||
*b++ = 0;
|
||||
return (buf);
|
||||
if (sep[0] != '\0') {
|
||||
ADDC(sep[0]);
|
||||
}
|
||||
if (*str == '\0') {
|
||||
ADDC('^');
|
||||
ADDC('@');
|
||||
if (sep[0] != '\0' && sep[1] != '\0') {
|
||||
ADDC(sep[1]);
|
||||
}
|
||||
goto done;
|
||||
}
|
||||
for (p = str; *p != 0; p++) {
|
||||
if (iscntrl((unsigned char) *p)) {
|
||||
*b++ = '^';
|
||||
if (*p == '\177')
|
||||
*b++ = '?';
|
||||
else
|
||||
*b++ = toascii(*p) | 0100;
|
||||
ADDC('^');
|
||||
if (*p == '\177') {
|
||||
ADDC('?');
|
||||
} else {
|
||||
ADDC(toascii(*p) | 0100);
|
||||
}
|
||||
} else if (*p == '^' || *p == '\\') {
|
||||
*b++ = '\\';
|
||||
*b++ = *p;
|
||||
ADDC('\\');
|
||||
ADDC(*p);
|
||||
} else if (*p == ' ' || (isprint((unsigned char) *p) &&
|
||||
!isspace((unsigned char) *p))) {
|
||||
*b++ = *p;
|
||||
ADDC(*p);
|
||||
} else {
|
||||
*b++ = '\\';
|
||||
*b++ = (((unsigned int) *p >> 6) & 7) + '0';
|
||||
*b++ = (((unsigned int) *p >> 3) & 7) + '0';
|
||||
*b++ = (*p & 7) + '0';
|
||||
ADDC('\\');
|
||||
ADDC((((unsigned int) *p >> 6) & 7) + '0');
|
||||
ADDC((((unsigned int) *p >> 3) & 7) + '0');
|
||||
ADDC((*p & 7) + '0');
|
||||
}
|
||||
}
|
||||
if (sep[0] != '\0' && sep[1] != '\0')
|
||||
*b++ = sep[1];
|
||||
*b++ = 0;
|
||||
return (buf); /* should check for overflow */
|
||||
if (sep[0] != '\0' && sep[1] != '\0') {
|
||||
ADDC(sep[1]);
|
||||
}
|
||||
done:
|
||||
ADDC('\0');
|
||||
if (b - buf >= len)
|
||||
buf[len - 1] = '\0';
|
||||
return b - buf;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)key.h 8.1 (Berkeley) 6/4/93
|
||||
* $NetBSD: key.h,v 1.8 2003/08/07 16:44:32 agc Exp $
|
||||
* $NetBSD: key.h,v 1.10 2006/03/23 20:22:51 christos Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
@ -76,6 +76,8 @@ protected int key_delete(EditLine *, const char *);
|
||||
protected void key_print(EditLine *, const char *);
|
||||
protected void key_kprint(EditLine *, const char *, key_value_t *,
|
||||
int);
|
||||
protected char *key__decode_str(const char *, char *, const char *);
|
||||
protected int key__decode_str(const char *, char *, int,
|
||||
const char *);
|
||||
protected int key__decode_char(char *, int, int, int);
|
||||
|
||||
#endif /* _h_el_key */
|
||||
|
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: map.c,v 1.22 2005/08/09 13:58:44 christos Exp $
|
||||
* $NetBSD: map.c,v 1.24 2006/04/09 01:36:51 christos Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
@ -1126,7 +1126,7 @@ map_print_key(EditLine *el, el_action_t *map, const char *in)
|
||||
el_bindings_t *bp, *ep;
|
||||
|
||||
if (in[0] == '\0' || in[1] == '\0') {
|
||||
(void) key__decode_str(in, outbuf, "");
|
||||
(void) key__decode_str(in, outbuf, sizeof(outbuf), "");
|
||||
ep = &el->el_map.help[el->el_map.nfunc];
|
||||
for (bp = el->el_map.help; bp < ep; bp++)
|
||||
if (bp->func == map[(unsigned char) *in]) {
|
||||
@ -1154,40 +1154,47 @@ map_print_some_keys(EditLine *el, el_action_t *map, int first, int last)
|
||||
lastbuf[0] = last;
|
||||
lastbuf[1] = 0;
|
||||
if (map[first] == ED_UNASSIGNED) {
|
||||
if (first == last)
|
||||
if (first == last) {
|
||||
(void) key__decode_str(firstbuf, unparsbuf,
|
||||
sizeof(unparsbuf), STRQQ);
|
||||
(void) fprintf(el->el_outfile,
|
||||
"%-15s-> is undefined\n",
|
||||
key__decode_str(firstbuf, unparsbuf, STRQQ));
|
||||
"%-15s-> is undefined\n", unparsbuf);
|
||||
}
|
||||
return;
|
||||
}
|
||||
ep = &el->el_map.help[el->el_map.nfunc];
|
||||
for (bp = el->el_map.help; bp < ep; bp++) {
|
||||
if (bp->func == map[first]) {
|
||||
if (first == last) {
|
||||
(void) key__decode_str(firstbuf, unparsbuf,
|
||||
sizeof(unparsbuf), STRQQ);
|
||||
(void) fprintf(el->el_outfile, "%-15s-> %s\n",
|
||||
key__decode_str(firstbuf, unparsbuf, STRQQ),
|
||||
bp->name);
|
||||
unparsbuf, bp->name);
|
||||
} else {
|
||||
(void) key__decode_str(firstbuf, unparsbuf,
|
||||
sizeof(unparsbuf), STRQQ);
|
||||
(void) key__decode_str(lastbuf, extrabuf,
|
||||
sizeof(extrabuf), STRQQ);
|
||||
(void) fprintf(el->el_outfile,
|
||||
"%-4s to %-7s-> %s\n",
|
||||
key__decode_str(firstbuf, unparsbuf, STRQQ),
|
||||
key__decode_str(lastbuf, extrabuf, STRQQ),
|
||||
bp->name);
|
||||
unparsbuf, extrabuf, bp->name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef MAP_DEBUG
|
||||
if (map == el->el_map.key) {
|
||||
(void) key__decode_str(firstbuf, unparsbuf,
|
||||
sizeof(unparsbuf), STRQQ);
|
||||
(void) fprintf(el->el_outfile,
|
||||
"BUG!!! %s isn't bound to anything.\n",
|
||||
key__decode_str(firstbuf, unparsbuf, STRQQ));
|
||||
"BUG!!! %s isn't bound to anything.\n", unparsbuf);
|
||||
(void) fprintf(el->el_outfile, "el->el_map.key[%d] == %d\n",
|
||||
first, el->el_map.key[first]);
|
||||
} else {
|
||||
(void) key__decode_str(firstbuf, unparsbuf,
|
||||
sizeof(unparsbuf), STRQQ);
|
||||
(void) fprintf(el->el_outfile,
|
||||
"BUG!!! %s isn't bound to anything.\n",
|
||||
key__decode_str(firstbuf, unparsbuf, STRQQ));
|
||||
"BUG!!! %s isn't bound to anything.\n", unparsbuf);
|
||||
(void) fprintf(el->el_outfile, "el->el_map.alt[%d] == %d\n",
|
||||
first, el->el_map.alt[first]);
|
||||
}
|
||||
@ -1374,7 +1381,7 @@ map_bind(EditLine *el, int argc, const char **argv)
|
||||
break;
|
||||
|
||||
default:
|
||||
EL_ABORT((el->el_errfile, "Bad XK_ type\n", ntype));
|
||||
EL_ABORT((el->el_errfile, "Bad XK_ type %d\n", ntype));
|
||||
break;
|
||||
}
|
||||
return (0);
|
||||
|
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: read.c,v 1.39 2005/08/02 12:11:14 christos Exp $
|
||||
* $NetBSD: read.c,v 1.40 2007/03/01 21:41:45 christos Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
@ -55,6 +55,7 @@ private int read__fixio(int, int);
|
||||
private int read_preread(EditLine *);
|
||||
private int read_char(EditLine *, char *);
|
||||
private int read_getcmd(EditLine *, el_action_t *, char *);
|
||||
private void read_pop(c_macro_t *);
|
||||
|
||||
/* read_init():
|
||||
* Initialize the read stuff
|
||||
@ -299,6 +300,19 @@ read_char(EditLine *el, char *cp)
|
||||
return (num_read);
|
||||
}
|
||||
|
||||
/* read_pop():
|
||||
* Pop a macro from the stack
|
||||
*/
|
||||
private void
|
||||
read_pop(c_macro_t *ma)
|
||||
{
|
||||
int i;
|
||||
|
||||
el_free(ma->macro[0]);
|
||||
for (i = ma->level--; i > 0; i--)
|
||||
ma->macro[i - 1] = ma->macro[i];
|
||||
ma->offset = 0;
|
||||
}
|
||||
|
||||
/* el_getc():
|
||||
* Read a character
|
||||
@ -315,20 +329,22 @@ el_getc(EditLine *el, char *cp)
|
||||
if (!read_preread(el))
|
||||
break;
|
||||
}
|
||||
|
||||
if (ma->level < 0)
|
||||
break;
|
||||
|
||||
if (ma->macro[ma->level][ma->offset] == '\0') {
|
||||
el_free(ma->macro[ma->level--]);
|
||||
ma->offset = 0;
|
||||
if (ma->macro[0][ma->offset] == '\0') {
|
||||
read_pop(ma);
|
||||
continue;
|
||||
}
|
||||
*cp = ma->macro[ma->level][ma->offset++] & 0377;
|
||||
if (ma->macro[ma->level][ma->offset] == '\0') {
|
||||
|
||||
*cp = ma->macro[0][ma->offset++] & 0377;
|
||||
|
||||
if (ma->macro[0][ma->offset] == '\0') {
|
||||
/* Needed for QuoteMode On */
|
||||
el_free(ma->macro[ma->level--]);
|
||||
ma->offset = 0;
|
||||
read_pop(ma);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
@ -13,11 +13,7 @@
|
||||
* 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
|
||||
* 3. 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.
|
||||
*
|
||||
@ -33,7 +29,7 @@
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: read.h,v 1.4 2004/02/27 14:52:18 christos Exp $
|
||||
* $NetBSD: read.h,v 1.5 2006/08/21 12:45:30 christos Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: term.c,v 1.41 2005/08/08 14:05:37 christos Exp $
|
||||
* $NetBSD: term.c,v 1.45 2006/03/18 19:23:14 christos Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
@ -386,6 +386,7 @@ term_alloc(EditLine *el, const struct termcapstr *t, const char *cap)
|
||||
* New string is shorter; no need to allocate space
|
||||
*/
|
||||
if (clen <= tlen) {
|
||||
if (*str)
|
||||
(void) strcpy(*str, cap); /* XXX strcpy is safe */
|
||||
return;
|
||||
}
|
||||
@ -460,9 +461,13 @@ term_alloc_display(EditLine *el)
|
||||
return (-1);
|
||||
for (i = 0; i < c->v; i++) {
|
||||
b[i] = (char *) el_malloc((size_t) (sizeof(char) * (c->h + 1)));
|
||||
if (b[i] == NULL)
|
||||
if (b[i] == NULL) {
|
||||
while (--i >= 0)
|
||||
el_free((ptr_t) b[i]);
|
||||
el_free((ptr_t) b);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
b[c->v] = NULL;
|
||||
el->el_display = b;
|
||||
|
||||
@ -471,9 +476,13 @@ term_alloc_display(EditLine *el)
|
||||
return (-1);
|
||||
for (i = 0; i < c->v; i++) {
|
||||
b[i] = (char *) el_malloc((size_t) (sizeof(char) * (c->h + 1)));
|
||||
if (b[i] == NULL)
|
||||
if (b[i] == NULL) {
|
||||
while (--i >= 0)
|
||||
el_free((ptr_t) b[i]);
|
||||
el_free((ptr_t) b);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
b[c->v] = NULL;
|
||||
el->el_vdisplay = b;
|
||||
return (0);
|
||||
@ -1244,6 +1253,19 @@ term__flush(void)
|
||||
(void) fflush(term_outfile);
|
||||
}
|
||||
|
||||
/* term_writec():
|
||||
* Write the given character out, in a human readable form
|
||||
*/
|
||||
protected void
|
||||
term_writec(EditLine *el, int c)
|
||||
{
|
||||
char buf[8];
|
||||
int cnt = key__decode_char(buf, sizeof(buf), 0, c);
|
||||
buf[cnt] = '\0';
|
||||
term_overwrite(el, buf, cnt);
|
||||
term__flush();
|
||||
}
|
||||
|
||||
|
||||
/* term_telltc():
|
||||
* Print the current termcap characteristics
|
||||
@ -1271,11 +1293,17 @@ term_telltc(EditLine *el, int argc __unused,
|
||||
(void) fprintf(el->el_outfile, "\tIt %s magic margins\n",
|
||||
EL_HAS_MAGIC_MARGINS ? "has" : "does not have");
|
||||
|
||||
for (t = tstr, ts = el->el_term.t_str; t->name != NULL; t++, ts++)
|
||||
for (t = tstr, ts = el->el_term.t_str; t->name != NULL; t++, ts++) {
|
||||
const char *ub;
|
||||
if (*ts && **ts) {
|
||||
(void) key__decode_str(*ts, upbuf, sizeof(upbuf), "");
|
||||
ub = upbuf;
|
||||
} else {
|
||||
ub = "(empty)";
|
||||
}
|
||||
(void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n",
|
||||
t->long_name,
|
||||
t->name, *ts && **ts ?
|
||||
key__decode_str(*ts, upbuf, "") : "(empty)");
|
||||
t->long_name, t->name, ub);
|
||||
}
|
||||
(void) fputc('\n', el->el_outfile);
|
||||
return (0);
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)term.h 8.1 (Berkeley) 6/4/93
|
||||
* $NetBSD: term.h,v 1.16 2005/03/15 00:10:40 christos Exp $
|
||||
* $NetBSD: term.h,v 1.17 2006/03/06 21:11:56 christos Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
@ -102,6 +102,7 @@ protected int term_set(EditLine *, const char *);
|
||||
protected int term_settc(EditLine *, int, const char **);
|
||||
protected int term_telltc(EditLine *, int, const char **);
|
||||
protected int term_echotc(EditLine *, int, const char **);
|
||||
protected void term_writec(EditLine *, int);
|
||||
protected int term__putc(int);
|
||||
protected void term__flush(void);
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: tty.c,v 1.23 2005/06/01 11:37:52 lukem Exp $
|
||||
* $NetBSD: tty.c,v 1.24 2006/03/18 09:07:05 christos Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
@ -1149,10 +1149,14 @@ tty_stty(EditLine *el, int argc __unused, const char **argv)
|
||||
st = len =
|
||||
strlen(el->el_tty.t_t[z][m->m_type].t_name);
|
||||
}
|
||||
if (i != -1) {
|
||||
x = (el->el_tty.t_t[z][i].t_setmask & m->m_value)
|
||||
? '+' : '\0';
|
||||
x = (el->el_tty.t_t[z][i].t_clrmask & m->m_value)
|
||||
? '-' : x;
|
||||
} else {
|
||||
x = '\0';
|
||||
}
|
||||
|
||||
if (x != '\0' || aflag) {
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $NetBSD: vi.c,v 1.24 2005/08/10 12:46:24 christos Exp $
|
||||
* $NetBSD: vi.c,v 1.25 2006/03/06 21:11:56 christos Exp $
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
@ -595,13 +595,12 @@ vi_delete_prev_char(EditLine *el, int c __unused)
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
vi_list_or_eof(EditLine *el, int c __unused)
|
||||
vi_list_or_eof(EditLine *el, int c)
|
||||
{
|
||||
|
||||
if (el->el_line.cursor == el->el_line.lastchar) {
|
||||
if (el->el_line.cursor == el->el_line.buffer) {
|
||||
term_overwrite(el, STReof, 4); /* then do a EOF */
|
||||
term__flush();
|
||||
term_writec(el, c); /* then do a EOF */
|
||||
return (CC_EOF);
|
||||
} else {
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user