summaryrefslogtreecommitdiffstats
path: root/lib/libedit/common.c
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-03-06 21:32:54 +0000
committerpfg <pfg@FreeBSD.org>2016-03-06 21:32:54 +0000
commit6f5b3c1fa3e9554a26cbf6401366ff8b0f0506fe (patch)
treed0cf340e5e8da21b579217126ee95772c2a99baf /lib/libedit/common.c
parent6e035b81175ff50ed064a8dd1d5bf9100b0d0711 (diff)
downloadFreeBSD-src-6f5b3c1fa3e9554a26cbf6401366ff8b0f0506fe.zip
FreeBSD-src-6f5b3c1fa3e9554a26cbf6401366ff8b0f0506fe.tar.gz
Revert r296175
Undo update of libedit 2016-02-27 Something in libedit appears to be causing breakage in lldb38. The changes are not generally huge but they are suficient to to justify reverting for now. Reported by: novel, bapt
Diffstat (limited to 'lib/libedit/common.c')
-rw-r--r--lib/libedit/common.c115
1 files changed, 56 insertions, 59 deletions
diff --git a/lib/libedit/common.c b/lib/libedit/common.c
index 26e4289..fc09a9b 100644
--- a/lib/libedit/common.c
+++ b/lib/libedit/common.c
@@ -1,4 +1,4 @@
-/* $NetBSD: common.c,v 1.39 2016/02/24 14:25:38 christos Exp $ */
+/* $NetBSD: common.c,v 1.29 2012/03/24 20:08:43 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.39 2016/02/24 14:25:38 christos Exp $");
+__RCSID("$NetBSD: common.c,v 1.29 2012/03/24 20:08:43 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
#include <sys/cdefs.h>
@@ -46,13 +46,7 @@ __FBSDID("$FreeBSD$");
/*
* common.c: Common Editor functions
*/
-#include <ctype.h>
-#include <string.h>
-
#include "el.h"
-#include "common.h"
-#include "parse.h"
-#include "vi.h"
/* ed_end_of_file():
* Indicate end of file
@@ -60,7 +54,7 @@ __FBSDID("$FreeBSD$");
*/
protected el_action_t
/*ARGSUSED*/
-ed_end_of_file(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_end_of_file(EditLine *el, Int c __attribute__((__unused__)))
{
re_goto_bottom(el);
@@ -74,7 +68,7 @@ ed_end_of_file(EditLine *el, wint_t c __attribute__((__unused__)))
* Insert a character [bound to all insert keys]
*/
protected el_action_t
-ed_insert(EditLine *el, wint_t c)
+ed_insert(EditLine *el, Int c)
{
int count = el->el_state.argument;
@@ -93,14 +87,14 @@ ed_insert(EditLine *el, wint_t c)
|| el->el_line.cursor >= el->el_line.lastchar)
c_insert(el, 1);
- *el->el_line.cursor++ = (Char)c;
+ *el->el_line.cursor++ = c;
re_fastaddc(el); /* fast refresh for one char. */
} else {
if (el->el_state.inputmode != MODE_REPLACE_1)
c_insert(el, el->el_state.argument);
while (count-- && el->el_line.cursor < el->el_line.lastchar)
- *el->el_line.cursor++ = (Char)c;
+ *el->el_line.cursor++ = c;
re_refresh(el);
}
@@ -117,7 +111,7 @@ ed_insert(EditLine *el, wint_t c)
*/
protected el_action_t
/*ARGSUSED*/
-ed_delete_prev_word(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_delete_prev_word(EditLine *el, Int c __attribute__((__unused__)))
{
Char *cp, *p, *kp;
@@ -145,7 +139,7 @@ ed_delete_prev_word(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_delete_next_char(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_delete_next_char(EditLine *el, Int c __attribute__((__unused__)))
{
#ifdef DEBUG_EDIT
#define EL el->el_line
@@ -192,7 +186,7 @@ ed_delete_next_char(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_kill_line(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_kill_line(EditLine *el, Int c __attribute__((__unused__)))
{
Char *kp, *cp;
@@ -213,7 +207,7 @@ ed_kill_line(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_move_to_end(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_move_to_end(EditLine *el, Int c __attribute__((__unused__)))
{
el->el_line.cursor = el->el_line.lastchar;
@@ -236,7 +230,7 @@ ed_move_to_end(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_move_to_beg(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_move_to_beg(EditLine *el, Int c __attribute__((__unused__)))
{
el->el_line.cursor = el->el_line.buffer;
@@ -259,7 +253,7 @@ ed_move_to_beg(EditLine *el, wint_t c __attribute__((__unused__)))
* [^T] [^T]
*/
protected el_action_t
-ed_transpose_chars(EditLine *el, wint_t c)
+ed_transpose_chars(EditLine *el, Int c)
{
if (el->el_line.cursor < el->el_line.lastchar) {
@@ -272,7 +266,7 @@ ed_transpose_chars(EditLine *el, wint_t c)
/* must have at least two chars entered */
c = el->el_line.cursor[-2];
el->el_line.cursor[-2] = el->el_line.cursor[-1];
- el->el_line.cursor[-1] = (Char)c;
+ el->el_line.cursor[-1] = c;
return CC_REFRESH;
} else
return CC_ERROR;
@@ -285,7 +279,7 @@ ed_transpose_chars(EditLine *el, wint_t c)
*/
protected el_action_t
/*ARGSUSED*/
-ed_next_char(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_next_char(EditLine *el, Int c __attribute__((__unused__)))
{
Char *lim = el->el_line.lastchar;
@@ -314,7 +308,7 @@ ed_next_char(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_prev_word(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_prev_word(EditLine *el, Int c __attribute__((__unused__)))
{
if (el->el_line.cursor == el->el_line.buffer)
@@ -340,7 +334,7 @@ ed_prev_word(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_prev_char(EditLine *el, Int c __attribute__((__unused__)))
{
if (el->el_line.cursor > el->el_line.buffer) {
@@ -364,12 +358,14 @@ ed_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
* [^V] [^V]
*/
protected el_action_t
-ed_quoted_insert(EditLine *el, wint_t c)
+ed_quoted_insert(EditLine *el, Int c)
{
int num;
+ Char tc;
tty_quotemode(el);
- num = el_wgetc(el, &c);
+ num = FUN(el,getc)(el, &tc);
+ c = tc;
tty_noquotemode(el);
if (num == 1)
return ed_insert(el, c);
@@ -382,7 +378,7 @@ ed_quoted_insert(EditLine *el, wint_t c)
* Adds to argument or enters a digit
*/
protected el_action_t
-ed_digit(EditLine *el, wint_t c)
+ed_digit(EditLine *el, Int c)
{
if (!Isdigit(c))
@@ -410,7 +406,7 @@ ed_digit(EditLine *el, wint_t c)
* For ESC-n
*/
protected el_action_t
-ed_argument_digit(EditLine *el, wint_t c)
+ed_argument_digit(EditLine *el, Int c)
{
if (!Isdigit(c))
@@ -436,7 +432,7 @@ ed_argument_digit(EditLine *el, wint_t c)
protected el_action_t
/*ARGSUSED*/
ed_unassigned(EditLine *el __attribute__((__unused__)),
- wint_t c __attribute__((__unused__)))
+ Int c __attribute__((__unused__)))
{
return CC_ERROR;
@@ -453,8 +449,8 @@ ed_unassigned(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_sigint(EditLine *el __attribute__((__unused__)),
- wint_t c __attribute__((__unused__)))
+ed_tty_sigint(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
return CC_NORM;
@@ -467,8 +463,8 @@ ed_tty_sigint(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
- wint_t c __attribute__((__unused__)))
+ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
return CC_NORM;
@@ -481,8 +477,8 @@ ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
- wint_t c __attribute__((__unused__)))
+ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
return CC_NORM;
@@ -495,8 +491,8 @@ ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
- wint_t c __attribute__((__unused__)))
+ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
return CC_NORM;
@@ -509,8 +505,8 @@ ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
- wint_t c __attribute__((__unused__)))
+ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
return CC_NORM;
@@ -523,8 +519,8 @@ ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
- wint_t c __attribute__((__unused__)))
+ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
return CC_NORM;
@@ -537,8 +533,8 @@ ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_start_output(EditLine *el __attribute__((__unused__)),
- wint_t c __attribute__((__unused__)))
+ed_tty_start_output(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
return CC_NORM;
@@ -551,7 +547,7 @@ ed_tty_start_output(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_newline(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_newline(EditLine *el, Int c __attribute__((__unused__)))
{
re_goto_bottom(el);
@@ -567,7 +563,7 @@ ed_newline(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_delete_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_delete_prev_char(EditLine *el, Int c __attribute__((__unused__)))
{
if (el->el_line.cursor <= el->el_line.buffer)
@@ -587,7 +583,7 @@ ed_delete_prev_char(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_clear_screen(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_clear_screen(EditLine *el, Int c __attribute__((__unused__)))
{
terminal_clear_screen(el); /* clear the whole real screen */
@@ -602,8 +598,8 @@ ed_clear_screen(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_redisplay(EditLine *el __attribute__((__unused__)),
- wint_t c __attribute__((__unused__)))
+ed_redisplay(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
return CC_REDISPLAY;
@@ -616,7 +612,7 @@ ed_redisplay(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_start_over(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_start_over(EditLine *el, Int c __attribute__((__unused__)))
{
ch_reset(el, 0);
@@ -630,8 +626,8 @@ ed_start_over(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
- wint_t c __attribute__((__unused__)))
+ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
return CC_NORM;
@@ -644,7 +640,7 @@ ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_prev_history(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_prev_history(EditLine *el, Int c __attribute__((__unused__)))
{
char beep = 0;
int sv_event = el->el_history.eventno;
@@ -664,6 +660,7 @@ ed_prev_history(EditLine *el, wint_t c __attribute__((__unused__)))
if (hist_get(el) == CC_ERROR) {
if (el->el_map.type == MAP_VI) {
el->el_history.eventno = sv_event;
+
}
beep = 1;
/* el->el_history.eventno was fixed by first call */
@@ -681,7 +678,7 @@ ed_prev_history(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_next_history(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_next_history(EditLine *el, Int c __attribute__((__unused__)))
{
el_action_t beep = CC_REFRESH, rval;
@@ -708,11 +705,11 @@ ed_next_history(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_search_prev_history(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_search_prev_history(EditLine *el, Int c __attribute__((__unused__)))
{
const Char *hp;
int h;
- int found = 0;
+ bool_t found = 0;
el->el_chared.c_vcmd.action = NOP;
el->el_chared.c_undo.len = -1;
@@ -751,7 +748,7 @@ ed_search_prev_history(EditLine *el, wint_t c __attribute__((__unused__)))
(el->el_line.lastchar - el->el_line.buffer)) ||
hp[el->el_line.lastchar - el->el_line.buffer]) &&
c_hmatch(el, hp)) {
- found = 1;
+ found++;
break;
}
h++;
@@ -776,11 +773,11 @@ ed_search_prev_history(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_search_next_history(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_search_next_history(EditLine *el, Int c __attribute__((__unused__)))
{
const Char *hp;
int h;
- int found = 0;
+ bool_t found = 0;
el->el_chared.c_vcmd.action = NOP;
el->el_chared.c_undo.len = -1;
@@ -830,7 +827,7 @@ ed_search_next_history(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_prev_line(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_prev_line(EditLine *el, Int c __attribute__((__unused__)))
{
Char *ptr;
int nchars = c_hpos(el);
@@ -873,7 +870,7 @@ ed_prev_line(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_next_line(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_next_line(EditLine *el, Int c __attribute__((__unused__)))
{
Char *ptr;
int nchars = c_hpos(el);
@@ -907,7 +904,7 @@ ed_next_line(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_command(EditLine *el, wint_t c __attribute__((__unused__)))
+ed_command(EditLine *el, Int c __attribute__((__unused__)))
{
Char tmpbuf[EL_BUFSIZ];
int tmplen;
OpenPOWER on IntegriCloud