mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
upgrade to libedit-2.6.7
(fixed Bug #4462 libedit compile failure) BitKeeper/etc/ignore: change config.h -> config.h to commit cmd-line-utils/libedit/config.h cmd-line-utils/libedit/Makefile.am: upgrade to libedit-2.6.7 cmd-line-utils/libedit/chared.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/chared.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/common.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/el.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/el.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/emacs.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/hist.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/hist.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/histedit.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/history.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/key.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/key.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/makelist.sh: upgrade to libedit-2.6.7 cmd-line-utils/libedit/map.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/map.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/parse.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/prompt.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/read.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/readline.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/readline/readline.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/refresh.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/search.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/search.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/sig.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/sig.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/sys.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/term.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/tokenizer.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/tokenizer.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/tty.c: upgrade to libedit-2.6.7 cmd-line-utils/libedit/tty.h: upgrade to libedit-2.6.7 cmd-line-utils/libedit/vi.c: upgrade to libedit-2.6.7 configure.in: change liblibedit.a to correct libedit.a
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: common.c,v 1.10 2001/01/10 07:45:41 jdolecek Exp $ */
|
||||
/* $NetBSD: common.c,v 1.14 2002/11/20 16:50:08 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -36,12 +36,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "compat.h"
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: common.c,v 1.14 2002/11/20 16:50:08 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
/*
|
||||
* common.c: Common Editor functions
|
||||
*/
|
||||
#include "sys.h"
|
||||
#include "el.h"
|
||||
|
||||
/* ed_end_of_file():
|
||||
@ -66,7 +72,7 @@ ed_end_of_file(EditLine *el, int c __attribute__((unused)))
|
||||
protected el_action_t
|
||||
ed_insert(EditLine *el, int c)
|
||||
{
|
||||
int i;
|
||||
int count = el->el_state.argument;
|
||||
|
||||
if (c == '\0')
|
||||
return (CC_ERROR);
|
||||
@ -74,42 +80,28 @@ ed_insert(EditLine *el, int c)
|
||||
if (el->el_line.lastchar + el->el_state.argument >=
|
||||
el->el_line.limit) {
|
||||
/* end of buffer space, try to allocate more */
|
||||
if (!ch_enlargebufs(el, (size_t) el->el_state.argument))
|
||||
if (!ch_enlargebufs(el, (size_t) count))
|
||||
return CC_ERROR; /* error allocating more */
|
||||
}
|
||||
|
||||
if (el->el_state.argument == 1) {
|
||||
if (el->el_state.inputmode != MODE_INSERT) {
|
||||
el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] =
|
||||
*el->el_line.cursor;
|
||||
el->el_chared.c_undo.buf[el->el_chared.c_undo.isize] =
|
||||
'\0';
|
||||
c_delafter(el, 1);
|
||||
}
|
||||
c_insert(el, 1);
|
||||
if (count == 1) {
|
||||
if (el->el_state.inputmode == MODE_INSERT
|
||||
|| el->el_line.cursor >= el->el_line.lastchar)
|
||||
c_insert(el, 1);
|
||||
|
||||
*el->el_line.cursor++ = c;
|
||||
el->el_state.doingarg = 0; /* just in case */
|
||||
re_fastaddc(el); /* fast refresh for one char. */
|
||||
} else {
|
||||
if (el->el_state.inputmode != MODE_INSERT) {
|
||||
for (i = 0; i < el->el_state.argument; i++)
|
||||
el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] =
|
||||
el->el_line.cursor[i];
|
||||
if (el->el_state.inputmode != MODE_REPLACE_1)
|
||||
c_insert(el, el->el_state.argument);
|
||||
|
||||
el->el_chared.c_undo.buf[el->el_chared.c_undo.isize] =
|
||||
'\0';
|
||||
c_delafter(el, el->el_state.argument);
|
||||
}
|
||||
c_insert(el, el->el_state.argument);
|
||||
|
||||
while (el->el_state.argument--)
|
||||
while (count-- && el->el_line.cursor < el->el_line.lastchar)
|
||||
*el->el_line.cursor++ = c;
|
||||
re_refresh(el);
|
||||
}
|
||||
|
||||
if (el->el_state.inputmode == MODE_REPLACE_1)
|
||||
(void) vi_command_mode(el, 0);
|
||||
return vi_command_mode(el, 0);
|
||||
|
||||
return (CC_NORM);
|
||||
}
|
||||
@ -229,7 +221,7 @@ ed_move_to_end(EditLine *el, int c __attribute__((unused)))
|
||||
#ifdef VI_MOVE
|
||||
el->el_line.cursor--;
|
||||
#endif
|
||||
if (el->el_chared.c_vcmd.action & DELETE) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
@ -253,7 +245,7 @@ ed_move_to_beg(EditLine *el, int c __attribute__((unused)))
|
||||
/* We want FIRST non space character */
|
||||
while (isspace((unsigned char) *el->el_line.cursor))
|
||||
el->el_line.cursor++;
|
||||
if (el->el_chared.c_vcmd.action & DELETE) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
@ -295,16 +287,20 @@ protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_next_char(EditLine *el, int c __attribute__((unused)))
|
||||
{
|
||||
char *lim = el->el_line.lastchar;
|
||||
|
||||
if (el->el_line.cursor >= el->el_line.lastchar)
|
||||
if (el->el_line.cursor >= lim ||
|
||||
(el->el_line.cursor == lim - 1 &&
|
||||
el->el_map.type == MAP_VI &&
|
||||
el->el_chared.c_vcmd.action == NOP))
|
||||
return (CC_ERROR);
|
||||
|
||||
el->el_line.cursor += el->el_state.argument;
|
||||
if (el->el_line.cursor > el->el_line.lastchar)
|
||||
el->el_line.cursor = el->el_line.lastchar;
|
||||
if (el->el_line.cursor > lim)
|
||||
el->el_line.cursor = lim;
|
||||
|
||||
if (el->el_map.type == MAP_VI)
|
||||
if (el->el_chared.c_vcmd.action & DELETE) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
@ -330,7 +326,7 @@ ed_prev_word(EditLine *el, int c __attribute__((unused)))
|
||||
ce__isword);
|
||||
|
||||
if (el->el_map.type == MAP_VI)
|
||||
if (el->el_chared.c_vcmd.action & DELETE) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
@ -353,7 +349,7 @@ ed_prev_char(EditLine *el, int c __attribute__((unused)))
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
|
||||
if (el->el_map.type == MAP_VI)
|
||||
if (el->el_chared.c_vcmd.action & DELETE) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
}
|
||||
@ -405,25 +401,9 @@ ed_digit(EditLine *el, int c)
|
||||
(el->el_state.argument * 10) + (c - '0');
|
||||
}
|
||||
return (CC_ARGHACK);
|
||||
} else {
|
||||
if (el->el_line.lastchar + 1 >= el->el_line.limit) {
|
||||
if (!ch_enlargebufs(el, 1))
|
||||
return (CC_ERROR);
|
||||
}
|
||||
|
||||
if (el->el_state.inputmode != MODE_INSERT) {
|
||||
el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] =
|
||||
*el->el_line.cursor;
|
||||
el->el_chared.c_undo.buf[el->el_chared.c_undo.isize] =
|
||||
'\0';
|
||||
c_delafter(el, 1);
|
||||
}
|
||||
c_insert(el, 1);
|
||||
*el->el_line.cursor++ = c;
|
||||
el->el_state.doingarg = 0;
|
||||
re_fastaddc(el);
|
||||
}
|
||||
return (CC_NORM);
|
||||
|
||||
return ed_insert(el, c);
|
||||
}
|
||||
|
||||
|
||||
@ -457,12 +437,11 @@ ed_argument_digit(EditLine *el, int c)
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_unassigned(EditLine *el, int c __attribute__((unused)))
|
||||
ed_unassigned(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
term_beep(el);
|
||||
term__flush();
|
||||
return (CC_NORM);
|
||||
return (CC_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@ -490,7 +469,7 @@ ed_tty_sigint(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_dsusp(EditLine *el __attribute__((unused)),
|
||||
ed_tty_dsusp(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -504,7 +483,7 @@ ed_tty_dsusp(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_flush_output(EditLine *el __attribute__((unused)),
|
||||
ed_tty_flush_output(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -518,7 +497,7 @@ ed_tty_flush_output(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_sigquit(EditLine *el __attribute__((unused)),
|
||||
ed_tty_sigquit(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -532,7 +511,7 @@ ed_tty_sigquit(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_sigtstp(EditLine *el __attribute__((unused)),
|
||||
ed_tty_sigtstp(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -546,7 +525,7 @@ ed_tty_sigtstp(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_stop_output(EditLine *el __attribute__((unused)),
|
||||
ed_tty_stop_output(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -560,7 +539,7 @@ ed_tty_stop_output(EditLine *el __attribute__((unused)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_start_output(EditLine *el __attribute__((unused)),
|
||||
ed_tty_start_output(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -580,8 +559,6 @@ ed_newline(EditLine *el, int c __attribute__((unused)))
|
||||
re_goto_bottom(el);
|
||||
*el->el_line.lastchar++ = '\n';
|
||||
*el->el_line.lastchar = '\0';
|
||||
if (el->el_map.type == MAP_VI)
|
||||
el->el_chared.c_vcmd.ins = el->el_line.buffer;
|
||||
return (CC_NEWLINE);
|
||||
}
|
||||
|
||||
@ -627,7 +604,7 @@ ed_clear_screen(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_redisplay(EditLine *el __attribute__((unused)),
|
||||
ed_redisplay(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -655,7 +632,7 @@ ed_start_over(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_sequence_lead_in(EditLine *el __attribute__((unused)),
|
||||
ed_sequence_lead_in(EditLine *el __attribute__((unused)),
|
||||
int c __attribute__((unused)))
|
||||
{
|
||||
|
||||
@ -672,8 +649,9 @@ protected el_action_t
|
||||
ed_prev_history(EditLine *el, int c __attribute__((unused)))
|
||||
{
|
||||
char beep = 0;
|
||||
int sv_event = el->el_history.eventno;
|
||||
|
||||
el->el_chared.c_undo.action = NOP;
|
||||
el->el_chared.c_undo.len = -1;
|
||||
*el->el_line.lastchar = '\0'; /* just in case */
|
||||
|
||||
if (el->el_history.eventno == 0) { /* save the current buffer
|
||||
@ -686,15 +664,17 @@ ed_prev_history(EditLine *el, int c __attribute__((unused)))
|
||||
el->el_history.eventno += el->el_state.argument;
|
||||
|
||||
if (hist_get(el) == CC_ERROR) {
|
||||
if (el->el_map.type == MAP_VI) {
|
||||
el->el_history.eventno = sv_event;
|
||||
return CC_ERROR;
|
||||
}
|
||||
beep = 1;
|
||||
/* el->el_history.eventno was fixed by first call */
|
||||
(void) hist_get(el);
|
||||
}
|
||||
re_refresh(el);
|
||||
if (beep)
|
||||
return (CC_ERROR);
|
||||
else
|
||||
return (CC_NORM); /* was CC_UP_HIST */
|
||||
return CC_REFRESH_BEEP;
|
||||
return CC_REFRESH;
|
||||
}
|
||||
|
||||
|
||||
@ -706,17 +686,22 @@ protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_next_history(EditLine *el, int c __attribute__((unused)))
|
||||
{
|
||||
el_action_t beep = CC_REFRESH, rval;
|
||||
|
||||
el->el_chared.c_undo.action = NOP;
|
||||
el->el_chared.c_undo.len = -1;
|
||||
*el->el_line.lastchar = '\0'; /* just in case */
|
||||
|
||||
el->el_history.eventno -= el->el_state.argument;
|
||||
|
||||
if (el->el_history.eventno < 0) {
|
||||
el->el_history.eventno = 0;
|
||||
return (CC_ERROR);/* make it beep */
|
||||
beep = CC_REFRESH_BEEP;
|
||||
}
|
||||
return (hist_get(el));
|
||||
rval = hist_get(el);
|
||||
if (rval == CC_REFRESH)
|
||||
return beep;
|
||||
return rval;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -733,7 +718,7 @@ ed_search_prev_history(EditLine *el, int c __attribute__((unused)))
|
||||
bool_t found = 0;
|
||||
|
||||
el->el_chared.c_vcmd.action = NOP;
|
||||
el->el_chared.c_undo.action = NOP;
|
||||
el->el_chared.c_undo.len = -1;
|
||||
*el->el_line.lastchar = '\0'; /* just in case */
|
||||
if (el->el_history.eventno < 0) {
|
||||
#ifdef DEBUG_EDIT
|
||||
@ -801,7 +786,7 @@ ed_search_next_history(EditLine *el, int c __attribute__((unused)))
|
||||
bool_t found = 0;
|
||||
|
||||
el->el_chared.c_vcmd.action = NOP;
|
||||
el->el_chared.c_undo.action = NOP;
|
||||
el->el_chared.c_undo.len = -1;
|
||||
*el->el_line.lastchar = '\0'; /* just in case */
|
||||
|
||||
if (el->el_history.eventno == 0)
|
||||
@ -930,25 +915,13 @@ ed_command(EditLine *el, int c __attribute__((unused)))
|
||||
char tmpbuf[EL_BUFSIZ];
|
||||
int tmplen;
|
||||
|
||||
el->el_line.buffer[0] = '\0';
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
tmplen = c_gets(el, tmpbuf, "\n: ");
|
||||
term__putc('\n');
|
||||
|
||||
c_insert(el, 3); /* prompt + ": " */
|
||||
*el->el_line.cursor++ = '\n';
|
||||
*el->el_line.cursor++ = ':';
|
||||
*el->el_line.cursor++ = ' ';
|
||||
re_refresh(el);
|
||||
if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1)
|
||||
term_beep(el);
|
||||
|
||||
tmplen = c_gets(el, tmpbuf);
|
||||
tmpbuf[tmplen] = '\0';
|
||||
|
||||
el->el_line.buffer[0] = '\0';
|
||||
el->el_line.lastchar = el->el_line.buffer;
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
|
||||
if (parse_line(el, tmpbuf) == -1)
|
||||
return (CC_ERROR);
|
||||
else
|
||||
return (CC_REFRESH);
|
||||
el->el_map.current = el->el_map.key;
|
||||
re_clear_display(el);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
|
Reference in New Issue
Block a user