Vendor import NetBSD's libedit of "2006/03/23 20:22:51 UTC".

Obtained from:	NetBSD
This commit is contained in:
David E. O'Brien 2011-03-31 18:28:46 +00:00
parent 04f67c6977
commit 307eee7ed0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/vendor/NetBSD/libedit/dist/; revision=220216
svn path=/vendor/NetBSD/libedit/2006-03-23/; revision=220217; tag=vendor/NetBSD/libedit/2006-03-23
11 changed files with 212 additions and 119 deletions

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*-
* Copyright (c) 1992, 1993
@ -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)

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*-
* 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.18 2005/08/08 14:05:37 christos Exp $");
__RCSID("$NetBSD: common.c,v 1.19 2006/03/06 21:11:56 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -137,7 +137,7 @@ ed_delete_prev_word(EditLine *el, int c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
ed_delete_next_char(EditLine *el, int c __attribute__((__unused__)))
ed_delete_next_char(EditLine *el, int c)
{
#ifdef notdef /* XXX */
#define EL el->el_line
@ -154,9 +154,8 @@ ed_delete_next_char(EditLine *el, int c __attribute__((__unused__)))
#ifdef KSHVI
return (CC_ERROR);
#else
term_overwrite(el, STReof, 4);
/* then do an EOF */
term__flush();
/* then do an EOF */
term_writechar(el, c);
return (CC_EOF);
#endif
} else {

View File

@ -1,4 +1,4 @@
/* $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 $ */
/*-
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: emacs.c,v 1.20 2005/08/08 14:05:37 christos Exp $");
__RCSID("$NetBSD: emacs.c,v 1.21 2006/03/06 21:11:56 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -52,15 +52,14 @@ __RCSID("$NetBSD: emacs.c,v 1.20 2005/08/08 14:05:37 christos Exp $");
*/
protected el_action_t
/*ARGSUSED*/
em_delete_or_list(EditLine *el, int c __attribute__((__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 {
/*

123
key.c
View File

@ -1,4 +1,4 @@
/* $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 $ */
/*-
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: key.c,v 1.17 2005/08/08 14:05:37 christos Exp $");
__RCSID("$NetBSD: key.c,v 1.19 2006/03/23 20:22:51 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -91,7 +91,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
@ -497,7 +496,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 */
@ -551,7 +550,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] = '"';
@ -582,9 +582,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++)
@ -609,83 +610,97 @@ 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)
{
char *sb = buf + off;
char *eb = buf + cnt;
char *b = sb;
if (ch == 0) {
buf[cnt++] = '^';
buf[cnt] = '@';
return (cnt);
ADDC('^');
ADDC('@');
return b - sb;
}
if (iscntrl(ch)) {
buf[cnt++] = '^';
ADDC('^');
if (ch == '\177')
buf[cnt] = '?';
ADDC('?');
else
buf[cnt] = ch | 0100;
ADDC(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++ = *p | 0100;
ADDC('^');
if (*p == '\177') {
ADDC('?');
} else {
ADDC(*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;
}

6
key.h
View File

@ -1,4 +1,4 @@
/* $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 $ */
/*-
* Copyright (c) 1992, 1993
@ -74,6 +74,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 */

37
map.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: map.c,v 1.22 2005/08/09 13:58:44 christos Exp $ */
/* $NetBSD: map.c,v 1.23 2006/03/06 21:11:56 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: map.c,v 1.22 2005/08/09 13:58:44 christos Exp $");
__RCSID("$NetBSD: map.c,v 1.23 2006/03/06 21:11:56 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -1128,7 +1128,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]) {
@ -1156,40 +1156,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]);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: readline.c,v 1.58 2005/07/14 15:00:58 christos Exp $ */
/* $NetBSD: readline.c,v 1.66 2006/03/21 17:52:50 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
__RCSID("$NetBSD: readline.c,v 1.58 2005/07/14 15:00:58 christos Exp $");
__RCSID("$NetBSD: readline.c,v 1.66 2006/03/21 17:52:50 christos Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@ -160,6 +160,7 @@ static Function *map[256];
static unsigned char _el_rl_complete(EditLine *, int);
static unsigned char _el_rl_tstp(EditLine *, int);
static char *_get_prompt(EditLine *);
static int _getc_function(EditLine *, char *);
static HIST_ENTRY *_move_history(int);
static int _history_expand_command(const char *, size_t, size_t,
char **);
@ -197,6 +198,23 @@ _move_history(int op)
}
/*
* read one key from user defined input function
*/
static int
/*ARGSUSED*/
_getc_function(EditLine *el, char *c)
{
int i;
i = (*rl_getc_function)(NULL, 0);
if (i == -1)
return 0;
*c = i;
return 1;
}
/*
* READLINE compatibility stuff
*/
@ -242,6 +260,10 @@ rl_initialize(void)
max_input_history = INT_MAX;
el_set(e, EL_HIST, history, h);
/* setup getc function if valid */
if (rl_getc_function)
el_set(e, EL_GETCFN, _getc_function);
/* for proper prompt printing in readline() */
rl_prompt = strdup("");
if (rl_prompt == NULL) {
@ -706,6 +728,7 @@ _history_expand_command(const char *command, size_t offs, size_t cmdlen,
what = realloc(from, size);
if (what == NULL) {
free(from);
free(tmp);
return 0;
}
len = 0;
@ -718,6 +741,7 @@ _history_expand_command(const char *command, size_t offs, size_t cmdlen,
(size <<= 1));
if (nwhat == NULL) {
free(what);
free(tmp);
return 0;
}
what = nwhat;
@ -730,10 +754,13 @@ _history_expand_command(const char *command, size_t offs, size_t cmdlen,
free(what);
if (search) {
from = strdup(search);
if (from == NULL)
if (from == NULL) {
free(tmp);
return 0;
}
} else {
from = NULL;
free(tmp);
return (-1);
}
}
@ -745,6 +772,7 @@ _history_expand_command(const char *command, size_t offs, size_t cmdlen,
with = realloc(to, size);
if (with == NULL) {
free(to);
free(tmp);
return -1;
}
len = 0;
@ -756,6 +784,7 @@ _history_expand_command(const char *command, size_t offs, size_t cmdlen,
nwith = realloc(with, size);
if (nwith == NULL) {
free(with);
free(tmp);
return -1;
}
with = nwith;
@ -824,12 +853,14 @@ history_expand(char *str, char **output)
return 0;
}
#define ADD_STRING(what, len) \
#define ADD_STRING(what, len, fr) \
{ \
if (idx + len + 1 > size) { \
char *nresult = realloc(result, (size += len + 1));\
if (nresult == NULL) { \
free(*output); \
if (/*CONSTCOND*/fr) \
free(tmp); \
return 0; \
} \
result = nresult; \
@ -841,6 +872,7 @@ history_expand(char *str, char **output)
result = NULL;
size = idx = 0;
tmp = NULL;
for (i = 0; str[i];) {
int qchar, loop_again;
size_t len, start, j;
@ -878,24 +910,29 @@ loop:
goto loop;
}
len = i - start;
tmp = &str[start];
ADD_STRING(tmp, len);
ADD_STRING(&str[start], len, 0);
if (str[i] == '\0' || str[i] != history_expansion_char) {
len = j - i;
tmp = &str[i];
ADD_STRING(tmp, len);
ADD_STRING(&str[i], len, 0);
if (start == 0)
ret = 0;
else
ret = 1;
break;
}
if (tmp) {
free(tmp);
tmp = NULL;
}
ret = _history_expand_command (str, i, (j - i), &tmp);
if (ret > 0 && tmp) {
len = strlen(tmp);
ADD_STRING(tmp, len);
ADD_STRING(tmp, len, 1);
}
if (tmp) {
free(tmp);
tmp = NULL;
}
i = j;
}
@ -1083,7 +1120,7 @@ read_history(const char *filename)
if (h == NULL || e == NULL)
rl_initialize();
return (history(h, &ev, H_LOAD, filename));
return (history(h, &ev, H_LOAD, filename) == -1);
}
@ -1097,7 +1134,7 @@ write_history(const char *filename)
if (h == NULL || e == NULL)
rl_initialize();
return (history(h, &ev, H_SAVE, filename));
return (history(h, &ev, H_SAVE, filename) == -1);
}
@ -1614,7 +1651,7 @@ rl_callback_read_char()
if (buf == NULL || count-- <= 0)
return;
if (count == 0 && buf[0] == CTRL('d'))
if (count == 0 && buf[0] == e->el_tty.t_c[TS_IO][C_EOF])
done = 1;
if (buf[count] == '\n' || buf[count] == '\r')
done = 2;
@ -1654,7 +1691,7 @@ void
rl_redisplay(void)
{
char a[2];
a[0] = CTRL('r');
a[0] = e->el_tty.t_c[TS_IO][C_REPRINT];
a[1] = '\0';
el_push(e, a);
}

46
term.c
View File

@ -1,4 +1,4 @@
/* $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 $ */
/*-
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95";
#else
__RCSID("$NetBSD: term.c,v 1.41 2005/08/08 14:05:37 christos Exp $");
__RCSID("$NetBSD: term.c,v 1.45 2006/03/18 19:23:14 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -398,7 +398,8 @@ term_alloc(EditLine *el, const struct termcapstr *t, const char *cap)
* New string is shorter; no need to allocate space
*/
if (clen <= tlen) {
(void) strcpy(*str, cap); /* XXX strcpy is safe */
if (*str)
(void) strcpy(*str, cap); /* XXX strcpy is safe */
return;
}
/*
@ -472,8 +473,12 @@ 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;
@ -483,8 +488,12 @@ 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;
@ -1250,6 +1259,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
@ -1277,11 +1299,17 @@ term_telltc(EditLine *el, int argc __attribute__((__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);
}

3
term.h
View File

@ -1,4 +1,4 @@
/* $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 $ */
/*-
* Copyright (c) 1992, 1993
@ -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);

21
tty.c
View File

@ -1,4 +1,4 @@
/* $NetBSD: tty.c,v 1.23 2005/06/01 11:37:52 lukem Exp $ */
/* $NetBSD: tty.c,v 1.25 2006/03/18 09:09:41 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: tty.c,v 1.23 2005/06/01 11:37:52 lukem Exp $");
__RCSID("$NetBSD: tty.c,v 1.25 2006/03/18 09:09:41 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -529,8 +529,11 @@ tty_setup(EditLine *el)
#endif /* DEBUG_TTY */
return (-1);
}
} else
}
#ifdef notdef
else
tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]);
#endif
el->el_tty.t_ed.c_iflag &= ~el->el_tty.t_t[ED_IO][MD_INP].t_clrmask;
el->el_tty.t_ed.c_iflag |= el->el_tty.t_t[ED_IO][MD_INP].t_setmask;
@ -1200,10 +1203,14 @@ tty_stty(EditLine *el, int argc __attribute__((__unused__)), const char **argv)
st = len =
strlen(el->el_tty.t_t[z][m->m_type].t_name);
}
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;
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) {

9
vi.c
View File

@ -1,4 +1,4 @@
/* $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 $ */
/*-
* Copyright (c) 1992, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)vi.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: vi.c,v 1.24 2005/08/10 12:46:24 christos Exp $");
__RCSID("$NetBSD: vi.c,v 1.25 2006/03/06 21:11:56 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@ -600,13 +600,12 @@ vi_delete_prev_char(EditLine *el, int c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
vi_list_or_eof(EditLine *el, int c __attribute__((__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 {
/*