1. discarded term.h from the distribution

2. changed key_* to el_ley_* in the libedit key.h
   (because it's in the conflict with the aix definitions)
3. use libedit_term.h instead of term.h in the cmd-line-utils/libedit/el.h
4. added definition of MIN in the cmd-line-utils/libedit/read.c 
   (if it wasn't defined yet)
5. discarded definition of SUNOS macro from configure.in 
   (now we don't include term.h in the el.h at all)
parent e022b314
......@@ -24,7 +24,7 @@ pkginclude_HEADERS = readline/readline.h
noinst_HEADERS = chared.h el.h histedit.h key.h parse.h refresh.h sig.h \
sys.h tokenizer.h config.h hist.h map.h prompt.h read.h \
search.h tty.h libedit_term.h term.h
search.h tty.h libedit_term.h
EXTRA_DIST = makelist.sh np/unvis.c np/strlcpy.c np/vis.c np/vis.h np/strlcat.c np/fgetln.c
......
......@@ -84,7 +84,7 @@ el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr)
el_free(el);
return NULL;
}
(void) key_init(el);
(void) el_key_init(el);
(void) map_init(el);
if (tty_init(el) == -1)
el->el_flags |= NO_TTY;
......@@ -112,7 +112,7 @@ el_end(EditLine *el)
el_reset(el);
term_end(el);
key_end(el);
el_key_end(el);
map_end(el);
tty_end(el);
ch_end(el);
......
......@@ -98,7 +98,7 @@ typedef struct el_state_t {
#include "tty.h"
#include "prompt.h"
#include "key.h"
#include "term.h"
#include "libedit_term.h"
#include "refresh.h"
#include "chared.h"
#include "common.h"
......
......@@ -103,14 +103,14 @@ private int key__decode_char(char *, int, int);
* Initialize the key maps
*/
protected int
key_init(EditLine *el)
el_key_init(EditLine *el)
{
el->el_key.buf = (char *) el_malloc(KEY_BUFSIZ);
if (el->el_key.buf == NULL)
return (-1);
el->el_key.map = NULL;
key_reset(el);
el_key_reset(el);
return (0);
}
......@@ -119,7 +119,7 @@ key_init(EditLine *el)
* Free the key maps
*/
protected void
key_end(EditLine *el)
el_key_end(EditLine *el)
{
el_free((ptr_t) el->el_key.buf);
......@@ -133,7 +133,7 @@ key_end(EditLine *el)
* Associate cmd with a key value
*/
protected key_value_t *
key_map_cmd(EditLine *el, int cmd)
el_key_map_cmd(EditLine *el, int cmd)
{
el->el_key.val.cmd = (el_action_t) cmd;
......@@ -145,7 +145,7 @@ key_map_cmd(EditLine *el, int cmd)
* Associate str with a key value
*/
protected key_value_t *
key_map_str(EditLine *el, char *str)
el_key_map_str(EditLine *el, char *str)
{
el->el_key.val.str = str;
......@@ -159,7 +159,7 @@ key_map_str(EditLine *el, char *str)
* [Always bind the ansi arrow keys?]
*/
protected void
key_reset(EditLine *el)
el_key_reset(EditLine *el)
{
node__put(el, el->el_key.map);
......@@ -177,7 +177,7 @@ key_reset(EditLine *el)
* The last character read is returned in *ch.
*/
protected int
key_get(EditLine *el, char *ch, key_value_t *val)
el_key_get(EditLine *el, char *ch, key_value_t *val)
{
return (node_trav(el, el->el_key.map, ch, val));
......@@ -191,7 +191,7 @@ key_get(EditLine *el, char *ch, key_value_t *val)
* out str or a unix command.
*/
protected void
key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
el_key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
{
if (key[0] == '\0') {
......@@ -219,7 +219,7 @@ key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
*
*/
protected void
key_clear(EditLine *el, el_action_t *map, const char *in)
el_key_clear(EditLine *el, el_action_t *map, const char *in)
{
if ((map[(unsigned char)*in] == ED_SEQUENCE_LEAD_IN) &&
......@@ -227,7 +227,7 @@ key_clear(EditLine *el, el_action_t *map, const char *in)
el->el_map.alt[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN) ||
(map == el->el_map.alt &&
el->el_map.key[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN)))
(void) key_delete(el, in);
(void) el_key_delete(el, in);
}
......@@ -236,7 +236,7 @@ key_clear(EditLine *el, el_action_t *map, const char *in)
* they exists.
*/
protected int
key_delete(EditLine *el, const char *key)
el_key_delete(EditLine *el, const char *key)
{
if (key[0] == '\0') {
......@@ -257,7 +257,7 @@ key_delete(EditLine *el, const char *key)
* Print entire el->el_key.map if null
*/
protected void
key_print(EditLine *el, const char *key)
el_key_print(EditLine *el, const char *key)
{
/* do nothing if el->el_key.map is empty and null key specified */
......@@ -504,7 +504,7 @@ node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt)
if (str[1] == 0) {
el->el_key.buf[ncnt + 1] = '"';
el->el_key.buf[ncnt + 2] = '\0';
key_kprint(el, el->el_key.buf,
el_key_kprint(el, el->el_key.buf,
&ptr->val, ptr->type);
return (0);
} else
......@@ -552,7 +552,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt)
/* print this key and function */
el->el_key.buf[ncnt + 1] = '"';
el->el_key.buf[ncnt + 2] = '\0';
key_kprint(el, el->el_key.buf, &ptr->val, ptr->type);
el_key_kprint(el, el->el_key.buf, &ptr->val, ptr->type);
} else
(void) node_enum(el, ptr->next, ncnt + 1);
......@@ -568,7 +568,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt)
* function specified by val
*/
protected void
key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
el_key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
{
el_bindings_t *fp;
char unparsbuf[EL_BUFSIZ];
......@@ -579,7 +579,7 @@ key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
case XK_STR:
case XK_EXE:
(void) fprintf(el->el_outfile, fmt, key,
key__decode_str(val->str, unparsbuf,
el_key__decode_str(val->str, unparsbuf,
ntype == XK_STR ? "\"\"" : "[]"));
break;
case XK_CMD:
......@@ -644,7 +644,7 @@ key__decode_char(char *buf, int cnt, int ch)
* Make a printable version of the ey
*/
protected char *
key__decode_str(const char *str, char *buf, const char *sep)
el_key__decode_str(const char *str, char *buf, const char *sep)
{
char *b;
const char *p;
......
......@@ -62,18 +62,19 @@ typedef struct el_key_t {
#define XK_NOD 2
#define XK_EXE 3
protected int key_init(EditLine *);
protected void key_end(EditLine *);
protected key_value_t *key_map_cmd(EditLine *, int);
protected key_value_t *key_map_str(EditLine *, char *);
protected void key_reset(EditLine *);
protected int key_get(EditLine *, char *, key_value_t *);
protected void key_add(EditLine *, const char *, key_value_t *, int);
protected void key_clear(EditLine *, el_action_t *, const char *);
protected int key_delete(EditLine *, const char *);
protected void key_print(EditLine *, const char *);
protected void key_kprint(EditLine *, const char *, key_value_t *,
protected int el_key_init(EditLine *);
protected void el_key_end(EditLine *);
protected key_value_t *el_key_map_cmd(EditLine *, int);
protected key_value_t *el_key_map_str(EditLine *, char *);
protected void el_key_reset(EditLine *);
protected int el_key_get(EditLine *, char *, key_value_t *);
protected void el_key_add(EditLine *,
const char *, key_value_t *, int);
protected void el_key_clear(EditLine *, el_action_t *, const char *);
protected int el_key_delete(EditLine *, const char *);
protected void el_key_print(EditLine *, const char *);
protected void el_key_kprint(EditLine *, const char *, key_value_t *,
int);
protected char *key__decode_str(const char *, char *, const char *);
protected char *el_key__decode_str(const char *, char *, const char *);
#endif /* _h_el_key */
......@@ -1011,7 +1011,8 @@ map_init_meta(EditLine *el)
break;
default:
buf[1] = i & 0177;
key_add(el, buf, key_map_cmd(el, (int) map[i]), XK_CMD);
el_key_add(el, buf,
el_key_map_cmd(el, (int) map[i]), XK_CMD);
break;
}
map[(int) buf[0]] = ED_SEQUENCE_LEAD_IN;
......@@ -1033,7 +1034,7 @@ map_init_vi(EditLine *el)
el->el_map.type = MAP_VI;
el->el_map.current = el->el_map.key;
key_reset(el);
el_key_reset(el);
for (i = 0; i < N_KEYS; i++) {
key[i] = vii[i];
......@@ -1062,7 +1063,7 @@ map_init_emacs(EditLine *el)
el->el_map.type = MAP_EMACS;
el->el_map.current = el->el_map.key;
key_reset(el);
el_key_reset(el);
for (i = 0; i < N_KEYS; i++) {
key[i] = emacs[i];
......@@ -1075,7 +1076,7 @@ map_init_emacs(EditLine *el)
buf[0] = CONTROL('X');
buf[1] = CONTROL('X');
buf[2] = 0;
key_add(el, buf, key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD);
el_key_add(el, buf, el_key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD);
tty_bind_char(el, 1);
term_bind_arrow(el);
......@@ -1132,7 +1133,7 @@ map_print_key(EditLine *el, el_action_t *map, const char *in)
el_bindings_t *bp;
if (in[0] == '\0' || in[1] == '\0') {
(void) key__decode_str(in, outbuf, "");
(void) el_key__decode_str(in, outbuf, "");
for (bp = el->el_map.help; bp->name != NULL; bp++)
if (bp->func == map[(unsigned char) *in]) {
(void) fprintf(el->el_outfile,
......@@ -1140,7 +1141,7 @@ map_print_key(EditLine *el, el_action_t *map, const char *in)
return;
}
} else
key_print(el, in);
el_key_print(el, in);
}
......@@ -1162,20 +1163,20 @@ map_print_some_keys(EditLine *el, el_action_t *map, int first, int last)
if (first == last)
(void) fprintf(el->el_outfile,
"%-15s-> is undefined\n",
key__decode_str(firstbuf, unparsbuf, STRQQ));
el_key__decode_str(firstbuf, unparsbuf, STRQQ));
return;
}
for (bp = el->el_map.help; bp->name != NULL; bp++) {
if (bp->func == map[first]) {
if (first == last) {
(void) fprintf(el->el_outfile, "%-15s-> %s\n",
key__decode_str(firstbuf, unparsbuf, STRQQ),
el_key__decode_str(firstbuf, unparsbuf, STRQQ),
bp->name);
} else {
(void) fprintf(el->el_outfile,
"%-4s to %-7s-> %s\n",
key__decode_str(firstbuf, unparsbuf, STRQQ),
key__decode_str(lastbuf, extrabuf, STRQQ),
el_key__decode_str(firstbuf, unparsbuf, STRQQ),
el_key__decode_str(lastbuf, extrabuf, STRQQ),
bp->name);
}
return;
......@@ -1229,7 +1230,7 @@ map_print_all_keys(EditLine *el)
map_print_some_keys(el, el->el_map.alt, prev, i - 1);
(void) fprintf(el->el_outfile, "Multi-character bindings\n");
key_print(el, "");
el_key_print(el, "");
(void) fprintf(el->el_outfile, "Arrow key bindings\n");
term_print_arrow(el, "");
}
......@@ -1322,9 +1323,9 @@ map_bind(EditLine *el, int argc, const char **argv)
return (-1);
}
if (in[1])
(void) key_delete(el, in);
(void) el_key_delete(el, in);
else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN)
(void) key_delete(el, in);
(void) el_key_delete(el, in);
else
map[(unsigned char) *in] = ED_UNASSIGNED;
return (0);
......@@ -1352,9 +1353,9 @@ map_bind(EditLine *el, int argc, const char **argv)
return (-1);
}
if (key)
term_set_arrow(el, in, key_map_str(el, out), ntype);
term_set_arrow(el, in, el_key_map_str(el, out), ntype);
else
key_add(el, in, key_map_str(el, out), ntype);
el_key_add(el, in, el_key_map_str(el, out), ntype);
map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN;
break;
......@@ -1365,13 +1366,13 @@ map_bind(EditLine *el, int argc, const char **argv)
return (-1);
}
if (key)
term_set_arrow(el, in, key_map_str(el, out), ntype);
term_set_arrow(el, in, el_key_map_str(el, out), ntype);
else {
if (in[1]) {
key_add(el, in, key_map_cmd(el, cmd), ntype);
el_key_add(el, in, el_key_map_cmd(el, cmd), ntype);
map[(unsigned char) *in] = ED_SEQUENCE_LEAD_IN;
} else {
key_clear(el, map, in);
el_key_clear(el, map, in);
map[(unsigned char) *in] = cmd;
}
}
......
......@@ -198,6 +198,10 @@ read_preread(EditLine *el)
return (0);
#ifdef FIONREAD
#ifndef MIN // definition of MIN is lacking on hpux..
#define MIN(x,y) (((x)<(y))?(x):(y))
#endif
(void) ioctl(el->el_infd, FIONREAD, (ioctl_t) & chrs);
if (chrs > 0) {
char buf[EL_BUFSIZ];
......@@ -262,7 +266,7 @@ read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch)
cmd = el->el_map.current[(unsigned char) *ch];
if (cmd == ED_SEQUENCE_LEAD_IN) {
key_value_t val;
switch (key_get(el, ch, &val)) {
switch (el_key_get(el, ch, &val)) {
case XK_CMD:
cmd = val.cmd;
break;
......@@ -459,7 +463,8 @@ el_gets(EditLine *el, int *nread)
#endif /* DEBUG_READ */
break;
}
if ((uint)cmdnum >= (uint)(el->el_map.nfunc)) { /* BUG CHECK command */
if ((unsigned int)cmdnum >= (unsigned int)(el->el_map.nfunc))
{ /* BUG CHECK command */
#ifdef DEBUG_EDIT
(void) fprintf(el->el_errfile,
"ERROR: illegal command from key 0%o\r\n", ch);
......
......@@ -67,10 +67,6 @@ __RCSID("$NetBSD: term.c,v 1.35 2002/03/18 16:00:59 christos Exp $");
#include "el.h"
/* Solaris's term.h does horrid things. */
#if (defined(HAVE_TERM_H) && !defined(SUNOS))
#include <term.h>
#endif
#include <sys/types.h>
#include <sys/ioctl.h>
......@@ -1079,32 +1075,32 @@ term_reset_arrow(EditLine *el)
static const char stOH[] = {033, 'O', 'H', '\0'};
static const char stOF[] = {033, 'O', 'F', '\0'};
key_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
key_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
key_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
key_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
key_add(el, strH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
key_add(el, strF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
key_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
key_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
key_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
key_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
key_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
el_key_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
el_key_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
el_key_add(el, strC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
el_key_add(el, strD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
el_key_add(el, strH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
el_key_add(el, strF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
el_key_add(el, stOA, &arrow[A_K_UP].fun, arrow[A_K_UP].type);
el_key_add(el, stOB, &arrow[A_K_DN].fun, arrow[A_K_DN].type);
el_key_add(el, stOC, &arrow[A_K_RT].fun, arrow[A_K_RT].type);
el_key_add(el, stOD, &arrow[A_K_LT].fun, arrow[A_K_LT].type);
el_key_add(el, stOH, &arrow[A_K_HO].fun, arrow[A_K_HO].type);
el_key_add(el, stOF, &arrow[A_K_EN].fun, arrow[A_K_EN].type);
if (el->el_map.type == MAP_VI) {
key_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
key_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
key_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
key_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
key_add(el, &strH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
key_add(el, &strF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
key_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
key_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
key_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
key_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
key_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
key_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
el_key_add(el, &strA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
el_key_add(el, &strB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
el_key_add(el, &strC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
el_key_add(el, &strD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
el_key_add(el, &strH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
el_key_add(el, &strF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
el_key_add(el, &stOA[1], &arrow[A_K_UP].fun, arrow[A_K_UP].type);
el_key_add(el, &stOB[1], &arrow[A_K_DN].fun, arrow[A_K_DN].type);
el_key_add(el, &stOC[1], &arrow[A_K_RT].fun, arrow[A_K_RT].type);
el_key_add(el, &stOD[1], &arrow[A_K_LT].fun, arrow[A_K_LT].type);
el_key_add(el, &stOH[1], &arrow[A_K_HO].fun, arrow[A_K_HO].type);
el_key_add(el, &stOF[1], &arrow[A_K_EN].fun, arrow[A_K_EN].type);
}
}
......@@ -1158,7 +1154,7 @@ term_print_arrow(EditLine *el, const char *name)
for (i = 0; i < A_K_NKEYS; i++)
if (*name == '\0' || strcmp(name, arrow[i].name) == 0)
if (arrow[i].type != XK_NOD)
key_kprint(el, arrow[i].name, &arrow[i].fun,
el_key_kprint(el, arrow[i].name, &arrow[i].fun,
arrow[i].type);
}
......@@ -1199,19 +1195,19 @@ term_bind_arrow(EditLine *el)
* unassigned key.
*/
if (arrow[i].type == XK_NOD)
key_clear(el, map, p);
el_key_clear(el, map, p);
else {
if (p[1] && (dmap[j] == map[j] ||
map[j] == ED_SEQUENCE_LEAD_IN)) {
key_add(el, p, &arrow[i].fun,
el_key_add(el, p, &arrow[i].fun,
arrow[i].type);
map[j] = ED_SEQUENCE_LEAD_IN;
} else if (map[j] == ED_UNASSIGNED) {
key_clear(el, map, p);
el_key_clear(el, map, p);
if (arrow[i].type == XK_CMD)
map[j] = arrow[i].fun.cmd;
else
key_add(el, p, &arrow[i].fun,
el_key_add(el, p, &arrow[i].fun,
arrow[i].type);
}
}
......@@ -1245,6 +1241,8 @@ term__flush(void)
/* term_telltc():
* Print the current termcap characteristics
*/
char *el_key__decode_str(const char *, char *, const char *);
protected int
/*ARGSUSED*/
term_telltc(EditLine *el, int argc __attribute__((unused)),
......@@ -1272,7 +1270,7 @@ term_telltc(EditLine *el, int argc __attribute__((unused)),
(void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n",
t->long_name,
t->name, *ts && **ts ?
key__decode_str(*ts, upbuf, "") : "(empty)");
el_key__decode_str(*ts, upbuf, "") : "(empty)");
(void) fputc('\n', el->el_outfile);
return (0);
}
......
/* $NetBSD: term.h,v 1.13 2002/03/18 16:01:00 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Christos Zoulas of Cornell University.
*
* 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 University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)term.h 8.1 (Berkeley) 6/4/93
*/
/*
* el.term.h: Termcap header
*/
#ifndef _h_el_term
#define _h_el_term
#include "histedit.h"
typedef struct { /* Symbolic function key bindings */
const char *name; /* name of the key */
int key; /* Index in termcap table */
key_value_t fun; /* Function bound to it */
int type; /* Type of function */
} fkey_t;
typedef struct {
coord_t t_size; /* # lines and cols */
int t_flags;
#define TERM_CAN_INSERT 0x001 /* Has insert cap */
#define TERM_CAN_DELETE 0x002 /* Has delete cap */
#define TERM_CAN_CEOL 0x004 /* Has CEOL cap */
#define TERM_CAN_TAB 0x008 /* Can use tabs */
#define TERM_CAN_ME 0x010 /* Can turn all attrs. */
#define TERM_CAN_UP 0x020 /* Can move up */
#define TERM_HAS_META 0x040 /* Has a meta key */
#define TERM_HAS_AUTO_MARGINS 0x080 /* Has auto margins */
#define TERM_HAS_MAGIC_MARGINS 0x100 /* Has magic margins */
char *t_buf; /* Termcap buffer */
int t_loc; /* location used */
char **t_str; /* termcap strings */
int *t_val; /* termcap values */
char *t_cap; /* Termcap buffer */
fkey_t *t_fkey; /* Array of keys */
} el_term_t;
/*
* fKey indexes
*/
#define A_K_DN 0
#define A_K_UP 1
#define A_K_LT 2
#define A_K_RT 3
#define A_K_HO 4
#define A_K_EN 5
#define A_K_NKEYS 6
protected void term_move_to_line(EditLine *, int);
protected void term_move_to_char(EditLine *, int);
protected void term_clear_EOL(EditLine *, int);
protected void term_overwrite(EditLine *, const char *, int);
protected void term_insertwrite(EditLine *, char *, int);
protected void term_deletechars(EditLine *, int);
protected void term_clear_screen(EditLine *);
protected void term_beep(EditLine *);
protected int term_change_size(EditLine *, int, int);
protected int term_get_size(EditLine *, int *, int *);
protected int term_init(EditLine *);
protected void term_bind_arrow(EditLine *);
protected void term_print_arrow(EditLine *, const char *);
protected int term_clear_arrow(EditLine *, const char *);
protected int term_set_arrow(EditLine *, const char *, key_value_t *, int);
protected void term_end(EditLine *);
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 int term__putc(int);
protected void term__flush(void);
/*
* Easy access macros
*/
#define EL_FLAGS (el)->el_term.t_flags
#define EL_CAN_INSERT (EL_FLAGS & TERM_CAN_INSERT)
#define EL_CAN_DELETE (EL_FLAGS & TERM_CAN_DELETE)
#define EL_CAN_CEOL (EL_FLAGS & TERM_CAN_CEOL)
#define EL_CAN_TAB (EL_FLAGS & TERM_CAN_TAB)
#define EL_CAN_ME (EL_FLAGS & TERM_CAN_ME)
#define EL_HAS_META (EL_FLAGS & TERM_HAS_META)
#define EL_HAS_AUTO_MARGINS (EL_FLAGS & TERM_HAS_AUTO_MARGINS)
#define EL_HAS_MAGIC_MARGINS (EL_FLAGS & TERM_HAS_MAGIC_MARGINS)
#endif /* _h_el_term */
......@@ -784,15 +784,15 @@ tty_bind_char(EditLine *el, int force)
if (new[0] == old[0] && !force)
continue;
/* Put the old default binding back, and set the new binding */
key_clear(el, map, (char *)old);
el_key_clear(el, map, (char *)old);
map[old[0]] = dmap[old[0]];
key_clear(el, map, (char *)new);
el_key_clear(el, map, (char *)new);
/* MAP_VI == 1, MAP_EMACS == 0... */
map[new[0]] = tp->bind[el->el_map.type];
if (dalt) {
key_clear(el, alt, (char *)old);
el_key_clear(el, alt, (char *)old);
alt[old[0]] = dalt[old[0]];
key_clear(el, alt, (char *)new);
el_key_clear(el, alt, (char *)new);
alt[new[0]] = tp->bind[el->el_map.type + 1];
}
}
......
......@@ -1875,13 +1875,6 @@ else
fi
AC_SUBST(TERMCAP_LIB)
# for libedit 2.6.7
case "${host}" in
*-*-solaris2*)
AC_DEFINE_UNQUOTED(SUNOS, 1, [macro for libedit-2.6.7, current platform is solaris-2])
;;
esac
LIBEDIT_LOBJECTS=""
AC_CHECK_FUNC(strunvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS unvis.o"])
AC_CHECK_FUNC(strvis, ,[LIBEDIT_LOBJECTS="$LIBEDIT_LOBJECTS vis.o"])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment