mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Upgrade to libedit-2.9
BitKeeper/deleted/.del-readline.h~ac6080227e4b72fc: Delete: cmd-line-utils/libedit/readline/readline.h
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: emacs.c,v 1.12 2002/11/15 14:32:33 christos Exp $ */
|
||||
/* $NetBSD: emacs.c,v 1.19 2004/10/28 21:14:52 dsl Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -15,11 +15,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 University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* 3. 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.
|
||||
*
|
||||
@ -36,14 +32,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: emacs.c,v 1.12 2002/11/15 14:32:33 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
#include <config.h>
|
||||
|
||||
/*
|
||||
* emacs.c: Emacs functions
|
||||
@ -56,7 +45,7 @@ __RCSID("$NetBSD: emacs.c,v 1.12 2002/11/15 14:32:33 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 __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
if (el->el_line.cursor == el->el_line.lastchar) {
|
||||
@ -75,7 +64,10 @@ em_delete_or_list(EditLine *el, int c __attribute__((unused)))
|
||||
return (CC_ERROR);
|
||||
}
|
||||
} else {
|
||||
c_delafter(el, el->el_state.argument); /* delete after dot */
|
||||
if (el->el_state.doingarg)
|
||||
c_delafter(el, el->el_state.argument);
|
||||
else
|
||||
c_delafter1(el);
|
||||
if (el->el_line.cursor > el->el_line.lastchar)
|
||||
el->el_line.cursor = el->el_line.lastchar;
|
||||
/* bounds check */
|
||||
@ -90,7 +82,7 @@ em_delete_or_list(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_delete_next_word(EditLine *el, int c __attribute__((unused)))
|
||||
em_delete_next_word(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
char *cp, *p, *kp;
|
||||
|
||||
@ -119,14 +111,12 @@ em_delete_next_word(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_yank(EditLine *el, int c __attribute__((unused)))
|
||||
em_yank(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
char *kp, *cp;
|
||||
|
||||
if (el->el_chared.c_kill.last == el->el_chared.c_kill.buf) {
|
||||
if (!ch_enlargebufs(el, 1))
|
||||
return (CC_ERROR);
|
||||
}
|
||||
if (el->el_chared.c_kill.last == el->el_chared.c_kill.buf)
|
||||
return (CC_NORM);
|
||||
|
||||
if (el->el_line.lastchar +
|
||||
(el->el_chared.c_kill.last - el->el_chared.c_kill.buf) >=
|
||||
@ -156,7 +146,7 @@ em_yank(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_kill_line(EditLine *el, int c __attribute__((unused)))
|
||||
em_kill_line(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
char *kp, *cp;
|
||||
|
||||
@ -178,7 +168,7 @@ em_kill_line(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_kill_region(EditLine *el, int c __attribute__((unused)))
|
||||
em_kill_region(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
char *kp, *cp;
|
||||
|
||||
@ -211,7 +201,7 @@ em_kill_region(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_copy_region(EditLine *el, int c __attribute__((unused)))
|
||||
em_copy_region(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
char *kp, *cp;
|
||||
|
||||
@ -235,12 +225,12 @@ em_copy_region(EditLine *el, int c __attribute__((unused)))
|
||||
}
|
||||
|
||||
|
||||
/* em_gosmacs_traspose():
|
||||
/* em_gosmacs_transpose():
|
||||
* Exchange the two characters before the cursor
|
||||
* Gosling emacs transpose chars [^T]
|
||||
*/
|
||||
protected el_action_t
|
||||
em_gosmacs_traspose(EditLine *el, int c)
|
||||
em_gosmacs_transpose(EditLine *el, int c)
|
||||
{
|
||||
|
||||
if (el->el_line.cursor > &el->el_line.buffer[1]) {
|
||||
@ -260,7 +250,7 @@ em_gosmacs_traspose(EditLine *el, int c)
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_next_word(EditLine *el, int c __attribute__((unused)))
|
||||
em_next_word(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
if (el->el_line.cursor == el->el_line.lastchar)
|
||||
return (CC_ERROR);
|
||||
@ -285,7 +275,7 @@ em_next_word(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_upper_case(EditLine *el, int c __attribute__((unused)))
|
||||
em_upper_case(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
char *cp, *ep;
|
||||
|
||||
@ -293,8 +283,8 @@ em_upper_case(EditLine *el, int c __attribute__((unused)))
|
||||
el->el_state.argument, ce__isword);
|
||||
|
||||
for (cp = el->el_line.cursor; cp < ep; cp++)
|
||||
if (islower((unsigned char) *cp))
|
||||
*cp = toupper(*cp);
|
||||
if (islower((unsigned char)*cp))
|
||||
*cp = toupper((unsigned char)*cp);
|
||||
|
||||
el->el_line.cursor = ep;
|
||||
if (el->el_line.cursor > el->el_line.lastchar)
|
||||
@ -309,7 +299,7 @@ em_upper_case(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_capitol_case(EditLine *el, int c __attribute__((unused)))
|
||||
em_capitol_case(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
char *cp, *ep;
|
||||
|
||||
@ -317,16 +307,16 @@ em_capitol_case(EditLine *el, int c __attribute__((unused)))
|
||||
el->el_state.argument, ce__isword);
|
||||
|
||||
for (cp = el->el_line.cursor; cp < ep; cp++) {
|
||||
if (isalpha((unsigned char) *cp)) {
|
||||
if (islower((unsigned char) *cp))
|
||||
*cp = toupper(*cp);
|
||||
if (isalpha((unsigned char)*cp)) {
|
||||
if (islower((unsigned char)*cp))
|
||||
*cp = toupper((unsigned char)*cp);
|
||||
cp++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (; cp < ep; cp++)
|
||||
if (isupper((unsigned char) *cp))
|
||||
*cp = tolower(*cp);
|
||||
if (isupper((unsigned char)*cp))
|
||||
*cp = tolower((unsigned char)*cp);
|
||||
|
||||
el->el_line.cursor = ep;
|
||||
if (el->el_line.cursor > el->el_line.lastchar)
|
||||
@ -341,7 +331,7 @@ em_capitol_case(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_lower_case(EditLine *el, int c __attribute__((unused)))
|
||||
em_lower_case(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
char *cp, *ep;
|
||||
|
||||
@ -349,8 +339,8 @@ em_lower_case(EditLine *el, int c __attribute__((unused)))
|
||||
el->el_state.argument, ce__isword);
|
||||
|
||||
for (cp = el->el_line.cursor; cp < ep; cp++)
|
||||
if (isupper((unsigned char) *cp))
|
||||
*cp = tolower(*cp);
|
||||
if (isupper((unsigned char)*cp))
|
||||
*cp = tolower((unsigned char)*cp);
|
||||
|
||||
el->el_line.cursor = ep;
|
||||
if (el->el_line.cursor > el->el_line.lastchar)
|
||||
@ -365,7 +355,7 @@ em_lower_case(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_set_mark(EditLine *el, int c __attribute__((unused)))
|
||||
em_set_mark(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
el->el_chared.c_kill.mark = el->el_line.cursor;
|
||||
@ -379,7 +369,7 @@ em_set_mark(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_exchange_mark(EditLine *el, int c __attribute__((unused)))
|
||||
em_exchange_mark(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
char *cp;
|
||||
|
||||
@ -396,7 +386,7 @@ em_exchange_mark(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_universal_argument(EditLine *el, int c __attribute__((unused)))
|
||||
em_universal_argument(EditLine *el, int c __attribute__((__unused__)))
|
||||
{ /* multiply current argument by 4 */
|
||||
|
||||
if (el->el_state.argument > 1000000)
|
||||
@ -413,7 +403,7 @@ em_universal_argument(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_meta_next(EditLine *el, int c __attribute__((unused)))
|
||||
em_meta_next(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
el->el_state.metanext = 1;
|
||||
@ -426,7 +416,7 @@ em_meta_next(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_toggle_overwrite(EditLine *el, int c __attribute__((unused)))
|
||||
em_toggle_overwrite(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
el->el_state.inputmode = (el->el_state.inputmode == MODE_INSERT) ?
|
||||
@ -440,7 +430,7 @@ em_toggle_overwrite(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_copy_prev_word(EditLine *el, int c __attribute__((unused)))
|
||||
em_copy_prev_word(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
char *cp, *oldc, *dp;
|
||||
|
||||
@ -467,7 +457,7 @@ em_copy_prev_word(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_inc_search_next(EditLine *el, int c __attribute__((unused)))
|
||||
em_inc_search_next(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
el->el_search.patlen = 0;
|
||||
@ -480,9 +470,32 @@ em_inc_search_next(EditLine *el, int c __attribute__((unused)))
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_inc_search_prev(EditLine *el, int c __attribute__((unused)))
|
||||
em_inc_search_prev(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
el->el_search.patlen = 0;
|
||||
return (ce_inc_search(el, ED_SEARCH_PREV_HISTORY));
|
||||
}
|
||||
|
||||
|
||||
/* em_delete_prev_char():
|
||||
* Delete the character to the left of the cursor
|
||||
* [^?]
|
||||
*/
|
||||
protected el_action_t
|
||||
/*ARGSUSED*/
|
||||
em_delete_prev_char(EditLine *el, int c __attribute__((__unused__)))
|
||||
{
|
||||
|
||||
if (el->el_line.cursor <= el->el_line.buffer)
|
||||
return (CC_ERROR);
|
||||
|
||||
if (el->el_state.doingarg)
|
||||
c_delbefore(el, el->el_state.argument);
|
||||
else
|
||||
c_delbefore1(el);
|
||||
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user