summaryrefslogtreecommitdiffstats
path: root/lib/libedit/common.c
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2015-01-09 07:40:56 +0000
committerbapt <bapt@FreeBSD.org>2015-01-09 07:40:56 +0000
commit9092259f68a804406ade5c84b5ceb67aae8c8303 (patch)
treed33ef1b987208879e7fa795c6b8d9fb885b151a9 /lib/libedit/common.c
parentced5b3dac1efcd02dc8fdf099780b1245832ae94 (diff)
downloadFreeBSD-src-9092259f68a804406ade5c84b5ceb67aae8c8303.zip
FreeBSD-src-9092259f68a804406ade5c84b5ceb67aae8c8303.tar.gz
Synchronize libedit with NetBSD and activate UTF-8 support [1]
Differences with NetBSD Reapply our local patches on top of it Fix Unicode environement detection Fix reading a line in unicode environment. It allows /bin/sh to works in UTF-8 envs Differential Revision: https://reviews.freebsd.org/D1455 Reviewed by: jilles, pfg Obtained from: NetBSD [1] MFC after: 1 month Relnotes: yes
Diffstat (limited to 'lib/libedit/common.c')
-rw-r--r--lib/libedit/common.c280
1 files changed, 144 insertions, 136 deletions
diff --git a/lib/libedit/common.c b/lib/libedit/common.c
index 64490c9..fc09a9b 100644
--- a/lib/libedit/common.c
+++ b/lib/libedit/common.c
@@ -1,3 +1,5 @@
+/* $NetBSD: common.c,v 1.29 2012/03/24 20:08:43 christos Exp $ */
+
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -28,12 +30,15 @@
* 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.
- *
- * $NetBSD: common.c,v 1.23 2009/02/27 04:18:45 msaitoh Exp $
*/
+#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.29 2012/03/24 20:08:43 christos Exp $");
+#endif
#endif /* not lint && not SCCSID */
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -41,7 +46,6 @@ __FBSDID("$FreeBSD$");
/*
* common.c: Common Editor functions
*/
-#include "sys.h"
#include "el.h"
/* ed_end_of_file():
@@ -50,12 +54,12 @@ __FBSDID("$FreeBSD$");
*/
protected el_action_t
/*ARGSUSED*/
-ed_end_of_file(EditLine *el, int c __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;
}
@@ -64,12 +68,12 @@ ed_end_of_file(EditLine *el, int c __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) {
@@ -97,7 +101,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;
}
@@ -107,12 +111,12 @@ ed_insert(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-ed_delete_prev_word(EditLine *el, int c __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);
@@ -125,7 +129,7 @@ ed_delete_prev_word(EditLine *el, int c __unused)
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;
}
@@ -135,9 +139,9 @@ ed_delete_prev_word(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_delete_next_char(EditLine *el, int c)
+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",
@@ -150,21 +154,21 @@ ed_delete_next_char(EditLine *el, int c)
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
- return (CC_ERROR);
+ return CC_ERROR;
}
c_delafter(el, el->el_state.argument); /* delete after dot */
if (el->el_map.type == MAP_VI &&
@@ -172,7 +176,7 @@ ed_delete_next_char(EditLine *el, int c)
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;
}
@@ -182,9 +186,9 @@ ed_delete_next_char(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-ed_kill_line(EditLine *el, int c __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;
@@ -193,7 +197,7 @@ ed_kill_line(EditLine *el, int c __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;
}
@@ -203,17 +207,20 @@ ed_kill_line(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_move_to_end(EditLine *el, int c __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;
}
@@ -223,21 +230,21 @@ ed_move_to_end(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_move_to_beg(EditLine *el, int c __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;
}
@@ -246,12 +253,12 @@ ed_move_to_beg(EditLine *el, int c __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++;
}
@@ -260,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;
}
@@ -272,15 +279,15 @@ ed_transpose_chars(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-ed_next_char(EditLine *el, int c __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)
@@ -289,9 +296,9 @@ ed_next_char(EditLine *el, int c __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;
}
@@ -301,11 +308,11 @@ ed_next_char(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_prev_word(EditLine *el, int c __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,
@@ -315,9 +322,9 @@ ed_prev_word(EditLine *el, int c __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;
}
@@ -327,7 +334,7 @@ ed_prev_word(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_prev_char(EditLine *el, int c __unused)
+ed_prev_char(EditLine *el, Int c __attribute__((__unused__)))
{
if (el->el_line.cursor > el->el_line.buffer) {
@@ -338,11 +345,11 @@ ed_prev_char(EditLine *el, int c __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;
}
@@ -351,19 +358,19 @@ ed_prev_char(EditLine *el, int c __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);
}
@@ -371,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((unsigned char) c))
- return (CC_ERROR);
+ if (!Isdigit(c))
+ return CC_ERROR;
if (el->el_state.doingarg) {
/* if doing an arg, add this in... */
@@ -383,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);
@@ -399,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((unsigned char) 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;
}
@@ -424,10 +431,11 @@ ed_argument_digit(EditLine *el, int c)
*/
protected el_action_t
/*ARGSUSED*/
-ed_unassigned(EditLine *el, int c __unused)
+ed_unassigned(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
- return (CC_ERROR);
+ return CC_ERROR;
}
@@ -441,11 +449,11 @@ ed_unassigned(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_sigint(EditLine *el __unused,
- int c __unused)
+ed_tty_sigint(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
- return (CC_NORM);
+ return CC_NORM;
}
@@ -455,11 +463,11 @@ ed_tty_sigint(EditLine *el __unused,
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_dsusp(EditLine *el __unused,
- int c __unused)
+ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
- return (CC_NORM);
+ return CC_NORM;
}
@@ -469,11 +477,11 @@ ed_tty_dsusp(EditLine *el __unused,
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_flush_output(EditLine *el __unused,
- int c __unused)
+ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
- return (CC_NORM);
+ return CC_NORM;
}
@@ -483,11 +491,11 @@ ed_tty_flush_output(EditLine *el __unused,
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_sigquit(EditLine *el __unused,
- int c __unused)
+ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
- return (CC_NORM);
+ return CC_NORM;
}
@@ -497,11 +505,11 @@ ed_tty_sigquit(EditLine *el __unused,
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_sigtstp(EditLine *el __unused,
- int c __unused)
+ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
- return (CC_NORM);
+ return CC_NORM;
}
@@ -511,11 +519,11 @@ ed_tty_sigtstp(EditLine *el __unused,
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_stop_output(EditLine *el __unused,
- int c __unused)
+ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
- return (CC_NORM);
+ return CC_NORM;
}
@@ -525,11 +533,11 @@ ed_tty_stop_output(EditLine *el __unused,
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_start_output(EditLine *el __unused,
- int c __unused)
+ed_tty_start_output(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
- return (CC_NORM);
+ return CC_NORM;
}
@@ -539,13 +547,13 @@ ed_tty_start_output(EditLine *el __unused,
*/
protected el_action_t
/*ARGSUSED*/
-ed_newline(EditLine *el, int c __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;
}
@@ -555,17 +563,17 @@ ed_newline(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_delete_prev_char(EditLine *el, int c __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;
}
@@ -575,12 +583,12 @@ ed_delete_prev_char(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_clear_screen(EditLine *el, int c __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;
}
@@ -590,11 +598,11 @@ ed_clear_screen(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_redisplay(EditLine *el __unused,
- int c __unused)
+ed_redisplay(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
- return (CC_REDISPLAY);
+ return CC_REDISPLAY;
}
@@ -604,11 +612,11 @@ ed_redisplay(EditLine *el __unused,
*/
protected el_action_t
/*ARGSUSED*/
-ed_start_over(EditLine *el, int c __unused)
+ed_start_over(EditLine *el, Int c __attribute__((__unused__)))
{
ch_reset(el, 0);
- return (CC_REFRESH);
+ return CC_REFRESH;
}
@@ -618,11 +626,11 @@ ed_start_over(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_sequence_lead_in(EditLine *el __unused,
- int c __unused)
+ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
+ Int c __attribute__((__unused__)))
{
- return (CC_NORM);
+ return CC_NORM;
}
@@ -632,7 +640,7 @@ ed_sequence_lead_in(EditLine *el __unused,
*/
protected el_action_t
/*ARGSUSED*/
-ed_prev_history(EditLine *el, int c __unused)
+ed_prev_history(EditLine *el, Int c __attribute__((__unused__)))
{
char beep = 0;
int sv_event = el->el_history.eventno;
@@ -642,7 +650,7 @@ ed_prev_history(EditLine *el, int c __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);
@@ -652,7 +660,7 @@ ed_prev_history(EditLine *el, int c __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 */
@@ -670,7 +678,7 @@ ed_prev_history(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_next_history(EditLine *el, int c __unused)
+ed_next_history(EditLine *el, Int c __attribute__((__unused__)))
{
el_action_t beep = CC_REFRESH, rval;
@@ -697,9 +705,9 @@ ed_next_history(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_search_prev_history(EditLine *el, int c __unused)
+ed_search_prev_history(EditLine *el, Int c __attribute__((__unused__)))
{
- const char *hp;
+ const Char *hp;
int h;
bool_t found = 0;
@@ -712,20 +720,20 @@ ed_search_prev_history(EditLine *el, int c __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 !! */
@@ -736,7 +744,7 @@ ed_search_prev_history(EditLine *el, int c __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)) {
@@ -751,11 +759,11 @@ ed_search_prev_history(EditLine *el, int c __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);
}
@@ -765,9 +773,9 @@ ed_search_prev_history(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_search_next_history(EditLine *el, int c __unused)
+ed_search_next_history(EditLine *el, Int c __attribute__((__unused__)))
{
- const char *hp;
+ const Char *hp;
int h;
bool_t found = 0;
@@ -776,14 +784,14 @@ ed_search_next_history(EditLine *el, int c __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 !! */
@@ -791,7 +799,7 @@ ed_search_next_history(EditLine *el, int c __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))
@@ -804,12 +812,12 @@ ed_search_next_history(EditLine *el, int c __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);
}
@@ -819,9 +827,9 @@ ed_search_next_history(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_prev_line(EditLine *el, int c __unused)
+ed_prev_line(EditLine *el, Int c __attribute__((__unused__)))
{
- char *ptr;
+ Char *ptr;
int nchars = c_hpos(el);
/*
@@ -835,7 +843,7 @@ ed_prev_line(EditLine *el, int c __unused)
break;
if (el->el_state.argument > 0)
- return (CC_ERROR);
+ return CC_ERROR;
/*
* Move to the beginning of the line
@@ -852,7 +860,7 @@ ed_prev_line(EditLine *el, int c __unused)
continue;
el->el_line.cursor = ptr;
- return (CC_CURSOR);
+ return CC_CURSOR;
}
@@ -862,9 +870,9 @@ ed_prev_line(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_next_line(EditLine *el, int c __unused)
+ed_next_line(EditLine *el, Int c __attribute__((__unused__)))
{
- char *ptr;
+ Char *ptr;
int nchars = c_hpos(el);
/*
@@ -875,7 +883,7 @@ ed_next_line(EditLine *el, int c __unused)
break;
if (el->el_state.argument > 0)
- return (CC_ERROR);
+ return CC_ERROR;
/*
* Move to the character requested
@@ -886,7 +894,7 @@ ed_next_line(EditLine *el, int c __unused)
continue;
el->el_line.cursor = ptr;
- return (CC_CURSOR);
+ return CC_CURSOR;
}
@@ -896,16 +904,16 @@ ed_next_line(EditLine *el, int c __unused)
*/
protected el_action_t
/*ARGSUSED*/
-ed_command(EditLine *el, int c __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);
OpenPOWER on IntegriCloud