mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
WL#5945 : Improve libedit library
Updated libedit library.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: common.c,v 1.21 2008/09/30 08:37:42 aymeric Exp $ */
|
||||
/* $NetBSD: common.c,v 1.28 2011/07/29 20:58:07 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -51,12 +51,12 @@ static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93";
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_end_of_file(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_end_of_file(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
re_goto_bottom(el);
|
||||
*el->el_line.lastchar = '\0';
|
||||
return (CC_EOF);
|
||||
return CC_EOF;
|
||||
}
|
||||
|
||||
|
||||
@ -65,12 +65,12 @@ ed_end_of_file(EditLine *el, int c __attribute__((__unused__)))
|
||||
* Insert a character [bound to all insert keys]
|
||||
*/
|
||||
protected el_action_t
|
||||
ed_insert(EditLine *el, int c)
|
||||
ed_insert(EditLine *el, Int c)
|
||||
{
|
||||
int count = el->el_state.argument;
|
||||
|
||||
if (c == '\0')
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
|
||||
if (el->el_line.lastchar + el->el_state.argument >=
|
||||
el->el_line.limit) {
|
||||
@ -98,7 +98,7 @@ ed_insert(EditLine *el, int c)
|
||||
if (el->el_state.inputmode == MODE_REPLACE_1)
|
||||
return vi_command_mode(el, 0);
|
||||
|
||||
return (CC_NORM);
|
||||
return CC_NORM;
|
||||
}
|
||||
|
||||
|
||||
@ -108,12 +108,12 @@ ed_insert(EditLine *el, int c)
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_delete_prev_word(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_delete_prev_word(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
char *cp, *p, *kp;
|
||||
Char *cp, *p, *kp;
|
||||
|
||||
if (el->el_line.cursor == el->el_line.buffer)
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
|
||||
cp = c__prev_word(el->el_line.cursor, el->el_line.buffer,
|
||||
el->el_state.argument, ce__isword);
|
||||
@ -122,11 +122,11 @@ ed_delete_prev_word(EditLine *el, int c __attribute__((__unused__)))
|
||||
*kp++ = *p;
|
||||
el->el_chared.c_kill.last = kp;
|
||||
|
||||
c_delbefore(el, el->el_line.cursor - cp); /* delete before dot */
|
||||
c_delbefore(el, (int)(el->el_line.cursor - cp));/* delete before dot */
|
||||
el->el_line.cursor = cp;
|
||||
if (el->el_line.cursor < el->el_line.buffer)
|
||||
el->el_line.cursor = el->el_line.buffer; /* bounds check */
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
|
||||
|
||||
@ -136,9 +136,9 @@ 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 __attribute__((__unused__)))
|
||||
{
|
||||
#ifdef notdef /* XXX */
|
||||
#ifdef DEBUG_EDIT
|
||||
#define EL el->el_line
|
||||
(void) fprintf(el->el_errlfile,
|
||||
"\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n",
|
||||
@ -151,24 +151,24 @@ ed_delete_next_char(EditLine *el, int c __attribute__((__unused__)))
|
||||
if (el->el_line.cursor == el->el_line.buffer) {
|
||||
/* if I'm also at the beginning */
|
||||
#ifdef KSHVI
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
#else
|
||||
/* then do an EOF */
|
||||
term_writechar(el, c);
|
||||
return (CC_EOF);
|
||||
terminal_writec(el, c);
|
||||
return CC_EOF;
|
||||
#endif
|
||||
} else {
|
||||
#ifdef KSHVI
|
||||
el->el_line.cursor--;
|
||||
#else
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (el->el_line.cursor != el->el_line.buffer)
|
||||
el->el_line.cursor--;
|
||||
else
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
}
|
||||
}
|
||||
c_delafter(el, el->el_state.argument); /* delete after dot */
|
||||
@ -176,7 +176,7 @@ ed_delete_next_char(EditLine *el, int c __attribute__((__unused__)))
|
||||
el->el_line.cursor > el->el_line.buffer)
|
||||
/* bounds check */
|
||||
el->el_line.cursor = el->el_line.lastchar - 1;
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
|
||||
|
||||
@ -186,9 +186,9 @@ ed_delete_next_char(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_kill_line(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_kill_line(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
char *kp, *cp;
|
||||
Char *kp, *cp;
|
||||
|
||||
cp = el->el_line.cursor;
|
||||
kp = el->el_chared.c_kill.buf;
|
||||
@ -197,7 +197,7 @@ ed_kill_line(EditLine *el, int c __attribute__((__unused__)))
|
||||
el->el_chared.c_kill.last = kp;
|
||||
/* zap! -- delete to end */
|
||||
el->el_line.lastchar = el->el_line.cursor;
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
|
||||
|
||||
@ -207,20 +207,20 @@ ed_kill_line(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_move_to_end(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_move_to_end(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
el->el_line.cursor = el->el_line.lastchar;
|
||||
if (el->el_map.type == MAP_VI) {
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
#ifdef VI_MOVE
|
||||
el->el_line.cursor--;
|
||||
#endif
|
||||
}
|
||||
return (CC_CURSOR);
|
||||
return CC_CURSOR;
|
||||
}
|
||||
|
||||
|
||||
@ -230,21 +230,21 @@ ed_move_to_end(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_move_to_beg(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_move_to_beg(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
|
||||
if (el->el_map.type == MAP_VI) {
|
||||
/* We want FIRST non space character */
|
||||
while (isspace((unsigned char) *el->el_line.cursor))
|
||||
while (Isspace(*el->el_line.cursor))
|
||||
el->el_line.cursor++;
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
}
|
||||
return (CC_CURSOR);
|
||||
return CC_CURSOR;
|
||||
}
|
||||
|
||||
|
||||
@ -253,12 +253,12 @@ ed_move_to_beg(EditLine *el, int c __attribute__((__unused__)))
|
||||
* [^T] [^T]
|
||||
*/
|
||||
protected el_action_t
|
||||
ed_transpose_chars(EditLine *el, int c)
|
||||
ed_transpose_chars(EditLine *el, Int c)
|
||||
{
|
||||
|
||||
if (el->el_line.cursor < el->el_line.lastchar) {
|
||||
if (el->el_line.lastchar <= &el->el_line.buffer[1])
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
else
|
||||
el->el_line.cursor++;
|
||||
}
|
||||
@ -267,9 +267,9 @@ ed_transpose_chars(EditLine *el, int c)
|
||||
c = el->el_line.cursor[-2];
|
||||
el->el_line.cursor[-2] = el->el_line.cursor[-1];
|
||||
el->el_line.cursor[-1] = c;
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
} else
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@ -279,15 +279,15 @@ ed_transpose_chars(EditLine *el, int c)
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_next_char(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_next_char(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
char *lim = el->el_line.lastchar;
|
||||
Char *lim = 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);
|
||||
return CC_ERROR;
|
||||
|
||||
el->el_line.cursor += el->el_state.argument;
|
||||
if (el->el_line.cursor > lim)
|
||||
@ -296,9 +296,9 @@ ed_next_char(EditLine *el, int c __attribute__((__unused__)))
|
||||
if (el->el_map.type == MAP_VI)
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
return (CC_CURSOR);
|
||||
return CC_CURSOR;
|
||||
}
|
||||
|
||||
|
||||
@ -308,11 +308,11 @@ ed_next_char(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_prev_word(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_prev_word(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
if (el->el_line.cursor == el->el_line.buffer)
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
|
||||
el->el_line.cursor = c__prev_word(el->el_line.cursor,
|
||||
el->el_line.buffer,
|
||||
@ -322,9 +322,9 @@ ed_prev_word(EditLine *el, int c __attribute__((__unused__)))
|
||||
if (el->el_map.type == MAP_VI)
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
return (CC_CURSOR);
|
||||
return CC_CURSOR;
|
||||
}
|
||||
|
||||
|
||||
@ -334,7 +334,7 @@ ed_prev_word(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_prev_char(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_prev_char(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
if (el->el_line.cursor > el->el_line.buffer) {
|
||||
@ -345,11 +345,11 @@ ed_prev_char(EditLine *el, int c __attribute__((__unused__)))
|
||||
if (el->el_map.type == MAP_VI)
|
||||
if (el->el_chared.c_vcmd.action != NOP) {
|
||||
cv_delfini(el);
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
return (CC_CURSOR);
|
||||
return CC_CURSOR;
|
||||
} else
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@ -358,19 +358,19 @@ ed_prev_char(EditLine *el, int c __attribute__((__unused__)))
|
||||
* [^V] [^V]
|
||||
*/
|
||||
protected el_action_t
|
||||
ed_quoted_insert(EditLine *el, int c)
|
||||
ed_quoted_insert(EditLine *el, Int c)
|
||||
{
|
||||
int num;
|
||||
char tc;
|
||||
Char tc;
|
||||
|
||||
tty_quotemode(el);
|
||||
num = el_getc(el, &tc);
|
||||
c = (unsigned char) tc;
|
||||
num = FUN(el,getc)(el, &tc);
|
||||
c = tc;
|
||||
tty_noquotemode(el);
|
||||
if (num == 1)
|
||||
return (ed_insert(el, c));
|
||||
return ed_insert(el, c);
|
||||
else
|
||||
return (ed_end_of_file(el, 0));
|
||||
return ed_end_of_file(el, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -378,11 +378,11 @@ ed_quoted_insert(EditLine *el, int c)
|
||||
* Adds to argument or enters a digit
|
||||
*/
|
||||
protected el_action_t
|
||||
ed_digit(EditLine *el, int c)
|
||||
ed_digit(EditLine *el, Int c)
|
||||
{
|
||||
|
||||
if (!isdigit(c))
|
||||
return (CC_ERROR);
|
||||
if (!Isdigit(c))
|
||||
return CC_ERROR;
|
||||
|
||||
if (el->el_state.doingarg) {
|
||||
/* if doing an arg, add this in... */
|
||||
@ -390,11 +390,11 @@ ed_digit(EditLine *el, int c)
|
||||
el->el_state.argument = c - '0';
|
||||
else {
|
||||
if (el->el_state.argument > 1000000)
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
el->el_state.argument =
|
||||
(el->el_state.argument * 10) + (c - '0');
|
||||
}
|
||||
return (CC_ARGHACK);
|
||||
return CC_ARGHACK;
|
||||
}
|
||||
|
||||
return ed_insert(el, c);
|
||||
@ -406,22 +406,22 @@ ed_digit(EditLine *el, int c)
|
||||
* For ESC-n
|
||||
*/
|
||||
protected el_action_t
|
||||
ed_argument_digit(EditLine *el, int c)
|
||||
ed_argument_digit(EditLine *el, Int c)
|
||||
{
|
||||
|
||||
if (!isdigit(c))
|
||||
return (CC_ERROR);
|
||||
if (!Isdigit(c))
|
||||
return CC_ERROR;
|
||||
|
||||
if (el->el_state.doingarg) {
|
||||
if (el->el_state.argument > 1000000)
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
el->el_state.argument = (el->el_state.argument * 10) +
|
||||
(c - '0');
|
||||
} else { /* else starting an argument */
|
||||
el->el_state.argument = c - '0';
|
||||
el->el_state.doingarg = 1;
|
||||
}
|
||||
return (CC_ARGHACK);
|
||||
return CC_ARGHACK;
|
||||
}
|
||||
|
||||
|
||||
@ -432,10 +432,10 @@ ed_argument_digit(EditLine *el, int c)
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_unassigned(EditLine *el __attribute__((__unused__)),
|
||||
int c __attribute__((__unused__)))
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@ -450,10 +450,10 @@ ed_unassigned(EditLine *el __attribute__((__unused__)),
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_sigint(EditLine *el __attribute__((__unused__)),
|
||||
int c __attribute__((__unused__)))
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
return CC_NORM;
|
||||
}
|
||||
|
||||
|
||||
@ -464,10 +464,10 @@ ed_tty_sigint(EditLine *el __attribute__((__unused__)),
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
|
||||
int c __attribute__((__unused__)))
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
return CC_NORM;
|
||||
}
|
||||
|
||||
|
||||
@ -478,10 +478,10 @@ ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
|
||||
int c __attribute__((__unused__)))
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
return CC_NORM;
|
||||
}
|
||||
|
||||
|
||||
@ -492,10 +492,10 @@ ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
|
||||
int c __attribute__((__unused__)))
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
return CC_NORM;
|
||||
}
|
||||
|
||||
|
||||
@ -506,10 +506,10 @@ ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
|
||||
int c __attribute__((__unused__)))
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
return CC_NORM;
|
||||
}
|
||||
|
||||
|
||||
@ -520,10 +520,10 @@ ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
|
||||
int c __attribute__((__unused__)))
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
return CC_NORM;
|
||||
}
|
||||
|
||||
|
||||
@ -534,10 +534,10 @@ ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_tty_start_output(EditLine *el __attribute__((__unused__)),
|
||||
int c __attribute__((__unused__)))
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
return CC_NORM;
|
||||
}
|
||||
|
||||
|
||||
@ -547,13 +547,13 @@ ed_tty_start_output(EditLine *el __attribute__((__unused__)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_newline(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_newline(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
re_goto_bottom(el);
|
||||
*el->el_line.lastchar++ = '\n';
|
||||
*el->el_line.lastchar = '\0';
|
||||
return (CC_NEWLINE);
|
||||
return CC_NEWLINE;
|
||||
}
|
||||
|
||||
|
||||
@ -563,17 +563,17 @@ ed_newline(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_delete_prev_char(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_delete_prev_char(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
if (el->el_line.cursor <= el->el_line.buffer)
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
|
||||
c_delbefore(el, el->el_state.argument);
|
||||
el->el_line.cursor -= el->el_state.argument;
|
||||
if (el->el_line.cursor < el->el_line.buffer)
|
||||
el->el_line.cursor = el->el_line.buffer;
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
|
||||
|
||||
@ -583,12 +583,12 @@ ed_delete_prev_char(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_clear_screen(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_clear_screen(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
term_clear_screen(el); /* clear the whole real screen */
|
||||
terminal_clear_screen(el); /* clear the whole real screen */
|
||||
re_clear_display(el); /* reset everything */
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
|
||||
|
||||
@ -599,10 +599,10 @@ ed_clear_screen(EditLine *el, int c __attribute__((__unused__)))
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_redisplay(EditLine *el __attribute__((__unused__)),
|
||||
int c __attribute__((__unused__)))
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_REDISPLAY);
|
||||
return CC_REDISPLAY;
|
||||
}
|
||||
|
||||
|
||||
@ -612,11 +612,11 @@ ed_redisplay(EditLine *el __attribute__((__unused__)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_start_over(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_start_over(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
ch_reset(el, 0);
|
||||
return (CC_REFRESH);
|
||||
return CC_REFRESH;
|
||||
}
|
||||
|
||||
|
||||
@ -627,10 +627,10 @@ ed_start_over(EditLine *el, int c __attribute__((__unused__)))
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
|
||||
int c __attribute__((__unused__)))
|
||||
Int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
return (CC_NORM);
|
||||
return CC_NORM;
|
||||
}
|
||||
|
||||
|
||||
@ -640,7 +640,7 @@ ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_prev_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_prev_history(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
char beep = 0;
|
||||
int sv_event = el->el_history.eventno;
|
||||
@ -650,7 +650,7 @@ ed_prev_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
|
||||
if (el->el_history.eventno == 0) { /* save the current buffer
|
||||
* away */
|
||||
(void) strncpy(el->el_history.buf, el->el_line.buffer,
|
||||
(void) Strncpy(el->el_history.buf, el->el_line.buffer,
|
||||
EL_BUFSIZ);
|
||||
el->el_history.last = el->el_history.buf +
|
||||
(el->el_line.lastchar - el->el_line.buffer);
|
||||
@ -660,7 +660,7 @@ ed_prev_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
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 */
|
||||
@ -678,7 +678,7 @@ ed_prev_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_next_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_next_history(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
el_action_t beep = CC_REFRESH, rval;
|
||||
|
||||
@ -705,9 +705,9 @@ ed_next_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_search_prev_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_search_prev_history(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
const char *hp;
|
||||
const Char *hp;
|
||||
int h;
|
||||
bool_t found = 0;
|
||||
|
||||
@ -720,20 +720,20 @@ ed_search_prev_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
"e_prev_search_hist(): eventno < 0;\n");
|
||||
#endif
|
||||
el->el_history.eventno = 0;
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
}
|
||||
if (el->el_history.eventno == 0) {
|
||||
(void) strncpy(el->el_history.buf, el->el_line.buffer,
|
||||
(void) Strncpy(el->el_history.buf, el->el_line.buffer,
|
||||
EL_BUFSIZ);
|
||||
el->el_history.last = el->el_history.buf +
|
||||
(el->el_line.lastchar - el->el_line.buffer);
|
||||
}
|
||||
if (el->el_history.ref == NULL)
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
|
||||
hp = HIST_FIRST(el);
|
||||
if (hp == NULL)
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
|
||||
c_setpat(el); /* Set search pattern !! */
|
||||
|
||||
@ -744,7 +744,7 @@ ed_search_prev_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
#ifdef SDEBUG
|
||||
(void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
|
||||
#endif
|
||||
if ((strncmp(hp, el->el_line.buffer, (size_t)
|
||||
if ((Strncmp(hp, el->el_line.buffer, (size_t)
|
||||
(el->el_line.lastchar - el->el_line.buffer)) ||
|
||||
hp[el->el_line.lastchar - el->el_line.buffer]) &&
|
||||
c_hmatch(el, hp)) {
|
||||
@ -759,11 +759,11 @@ ed_search_prev_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
#ifdef SDEBUG
|
||||
(void) fprintf(el->el_errfile, "not found\n");
|
||||
#endif
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
}
|
||||
el->el_history.eventno = h;
|
||||
|
||||
return (hist_get(el));
|
||||
return hist_get(el);
|
||||
}
|
||||
|
||||
|
||||
@ -773,9 +773,9 @@ ed_search_prev_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_search_next_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_search_next_history(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
const char *hp;
|
||||
const Char *hp;
|
||||
int h;
|
||||
bool_t found = 0;
|
||||
|
||||
@ -784,14 +784,14 @@ ed_search_next_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
*el->el_line.lastchar = '\0'; /* just in case */
|
||||
|
||||
if (el->el_history.eventno == 0)
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
|
||||
if (el->el_history.ref == NULL)
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
|
||||
hp = HIST_FIRST(el);
|
||||
if (hp == NULL)
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
|
||||
c_setpat(el); /* Set search pattern !! */
|
||||
|
||||
@ -799,7 +799,7 @@ ed_search_next_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
#ifdef SDEBUG
|
||||
(void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp);
|
||||
#endif
|
||||
if ((strncmp(hp, el->el_line.buffer, (size_t)
|
||||
if ((Strncmp(hp, el->el_line.buffer, (size_t)
|
||||
(el->el_line.lastchar - el->el_line.buffer)) ||
|
||||
hp[el->el_line.lastchar - el->el_line.buffer]) &&
|
||||
c_hmatch(el, hp))
|
||||
@ -812,12 +812,12 @@ ed_search_next_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
#ifdef SDEBUG
|
||||
(void) fprintf(el->el_errfile, "not found\n");
|
||||
#endif
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
}
|
||||
}
|
||||
el->el_history.eventno = found;
|
||||
|
||||
return (hist_get(el));
|
||||
return hist_get(el);
|
||||
}
|
||||
|
||||
|
||||
@ -827,9 +827,9 @@ ed_search_next_history(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_prev_line(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_prev_line(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
char *ptr;
|
||||
Char *ptr;
|
||||
int nchars = c_hpos(el);
|
||||
|
||||
/*
|
||||
@ -843,7 +843,7 @@ ed_prev_line(EditLine *el, int c __attribute__((__unused__)))
|
||||
break;
|
||||
|
||||
if (el->el_state.argument > 0)
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
|
||||
/*
|
||||
* Move to the beginning of the line
|
||||
@ -860,7 +860,7 @@ ed_prev_line(EditLine *el, int c __attribute__((__unused__)))
|
||||
continue;
|
||||
|
||||
el->el_line.cursor = ptr;
|
||||
return (CC_CURSOR);
|
||||
return CC_CURSOR;
|
||||
}
|
||||
|
||||
|
||||
@ -870,9 +870,9 @@ ed_prev_line(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_next_line(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_next_line(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
char *ptr;
|
||||
Char *ptr;
|
||||
int nchars = c_hpos(el);
|
||||
|
||||
/*
|
||||
@ -883,7 +883,7 @@ ed_next_line(EditLine *el, int c __attribute__((__unused__)))
|
||||
break;
|
||||
|
||||
if (el->el_state.argument > 0)
|
||||
return (CC_ERROR);
|
||||
return CC_ERROR;
|
||||
|
||||
/*
|
||||
* Move to the character requested
|
||||
@ -894,7 +894,7 @@ ed_next_line(EditLine *el, int c __attribute__((__unused__)))
|
||||
continue;
|
||||
|
||||
el->el_line.cursor = ptr;
|
||||
return (CC_CURSOR);
|
||||
return CC_CURSOR;
|
||||
}
|
||||
|
||||
|
||||
@ -904,16 +904,16 @@ ed_next_line(EditLine *el, int c __attribute__((__unused__)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
ed_command(EditLine *el, int c __attribute__((__unused__)))
|
||||
ed_command(EditLine *el, Int c __attribute__((__unused__)))
|
||||
{
|
||||
char tmpbuf[EL_BUFSIZ];
|
||||
Char tmpbuf[EL_BUFSIZ];
|
||||
int tmplen;
|
||||
|
||||
tmplen = c_gets(el, tmpbuf, "\n: ");
|
||||
term__putc(el, '\n');
|
||||
tmplen = c_gets(el, tmpbuf, STR("\n: "));
|
||||
terminal__putc(el, '\n');
|
||||
|
||||
if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1)
|
||||
term_beep(el);
|
||||
terminal_beep(el);
|
||||
|
||||
el->el_map.current = el->el_map.key;
|
||||
re_clear_display(el);
|
||||
|
Reference in New Issue
Block a user