diff options
author | rgrimes <rgrimes@FreeBSD.org> | 1995-05-30 05:51:47 +0000 |
---|---|---|
committer | rgrimes <rgrimes@FreeBSD.org> | 1995-05-30 05:51:47 +0000 |
commit | f05428e4cd63dde97bac14b84dd146a5c00455e3 (patch) | |
tree | e1331adb5d216f2b3fa6baa6491752348d2e5f10 /lib/libedit | |
parent | 6de57e42c294763c78d77b0a9a7c5a08008a378a (diff) | |
download | FreeBSD-src-f05428e4cd63dde97bac14b84dd146a5c00455e3.zip FreeBSD-src-f05428e4cd63dde97bac14b84dd146a5c00455e3.tar.gz |
Remove trailing whitespace.
Diffstat (limited to 'lib/libedit')
-rw-r--r-- | lib/libedit/Makefile | 6 | ||||
-rw-r--r-- | lib/libedit/TEST/test.c | 2 | ||||
-rw-r--r-- | lib/libedit/chared.c | 68 | ||||
-rw-r--r-- | lib/libedit/chared.h | 6 | ||||
-rw-r--r-- | lib/libedit/common.c | 148 | ||||
-rw-r--r-- | lib/libedit/el.c | 12 | ||||
-rw-r--r-- | lib/libedit/emacs.c | 36 | ||||
-rw-r--r-- | lib/libedit/hist.c | 2 | ||||
-rw-r--r-- | lib/libedit/history.c | 20 | ||||
-rw-r--r-- | lib/libedit/key.c | 46 | ||||
-rw-r--r-- | lib/libedit/key.h | 4 | ||||
-rw-r--r-- | lib/libedit/map.c | 50 | ||||
-rw-r--r-- | lib/libedit/map.h | 2 | ||||
-rw-r--r-- | lib/libedit/parse.c | 4 | ||||
-rw-r--r-- | lib/libedit/parse.h | 2 | ||||
-rw-r--r-- | lib/libedit/prompt.c | 6 | ||||
-rw-r--r-- | lib/libedit/read.c | 12 | ||||
-rw-r--r-- | lib/libedit/refresh.c | 68 | ||||
-rw-r--r-- | lib/libedit/search.c | 70 | ||||
-rw-r--r-- | lib/libedit/search.h | 4 | ||||
-rw-r--r-- | lib/libedit/sig.c | 6 | ||||
-rw-r--r-- | lib/libedit/term.c | 90 | ||||
-rw-r--r-- | lib/libedit/term.h | 2 | ||||
-rw-r--r-- | lib/libedit/tokenizer.c | 10 | ||||
-rw-r--r-- | lib/libedit/tokenizer.h | 2 | ||||
-rw-r--r-- | lib/libedit/tty.c | 82 | ||||
-rw-r--r-- | lib/libedit/tty.h | 4 | ||||
-rw-r--r-- | lib/libedit/vi.c | 128 |
28 files changed, 446 insertions, 446 deletions
diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile index 5880204..8863e80 100644 --- a/lib/libedit/Makefile +++ b/lib/libedit/Makefile @@ -14,11 +14,11 @@ LDADD+= -ltermcap SRCS= editline.c tokenizer.c history.c CLEANFILES+=common.h emacs.h fcns.h help.h vi.h help.c fcns.c editline.c -CFLAGS+=-I. -I${.CURDIR} +CFLAGS+=-I. -I${.CURDIR} CFLAGS+=#-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH CFLAGS+=#-DDEBUG_PASTE -AHDR=vi.h emacs.h common.h +AHDR=vi.h emacs.h common.h ASRC=${.CURDIR}/vi.c ${.CURDIR}/emacs.c ${.CURDIR}/common.c vi.h: vi.c makelist @@ -36,7 +36,7 @@ fcns.h: ${AHDR} makelist fcns.c: ${AHDR} fcns.h makelist sh ${.CURDIR}/makelist -fc ${AHDR} > ${.TARGET} -help.c: ${ASRC} makelist +help.c: ${ASRC} makelist sh ${.CURDIR}/makelist -bc ${ASRC} > ${.TARGET} help.h: ${ASRC} makelist diff --git a/lib/libedit/TEST/test.c b/lib/libedit/TEST/test.c index f456f51..2379b6f 100644 --- a/lib/libedit/TEST/test.c +++ b/lib/libedit/TEST/test.c @@ -87,7 +87,7 @@ complete(el, ch) EditLine *el; int ch; { - DIR *dd = opendir("."); + DIR *dd = opendir("."); struct dirent *dp; const char* ptr; const LineInfo *lf = el_line(el); diff --git a/lib/libedit/chared.c b/lib/libedit/chared.c index 5a393a7..62e2f6a 100644 --- a/lib/libedit/chared.c +++ b/lib/libedit/chared.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint && not SCCSID */ -/* +/* * chared.c: Character editor utilities */ #include "sys.h" @@ -67,7 +67,7 @@ cv_undo(el, action, size, ptr) } -/* c_insert(): +/* c_insert(): * Insert num characters */ protected void @@ -80,7 +80,7 @@ c_insert(el, num) if (el->el_line.lastchar + num >= el->el_line.limit) return; /* can't go past end of buffer */ - if (el->el_line.cursor < el->el_line.lastchar) { + if (el->el_line.cursor < el->el_line.lastchar) { /* if I must move chars */ for (cp = el->el_line.lastchar; cp >= el->el_line.cursor; cp--) cp[num] = *cp; @@ -93,7 +93,7 @@ c_insert(el, num) * Delete num characters after the cursor */ protected void -c_delafter(el, num) +c_delafter(el, num) EditLine *el; int num; { @@ -101,10 +101,10 @@ c_delafter(el, num) if (el->el_line.cursor + num > el->el_line.lastchar) num = el->el_line.lastchar - el->el_line.cursor; - if (num > 0) { + if (num > 0) { char *cp; - if (el->el_map.current != el->el_map.emacs) + if (el->el_map.current != el->el_map.emacs) cv_undo(el, INSERT, num, el->el_line.cursor); for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) @@ -125,12 +125,12 @@ c_delbefore(el, num) { if (el->el_line.cursor - num < el->el_line.buffer) - num = el->el_line.cursor - el->el_line.buffer; + num = el->el_line.cursor - el->el_line.buffer; - if (num > 0) { + if (num > 0) { char *cp; - if (el->el_map.current != el->el_map.emacs) + if (el->el_map.current != el->el_map.emacs) cv_undo(el, INSERT, num, el->el_line.cursor - num); for (cp = el->el_line.cursor - num; cp <= el->el_line.lastchar; cp++) @@ -145,7 +145,7 @@ c_delbefore(el, num) * Return if p is part of a word according to emacs */ protected int -ce__isword(p) +ce__isword(p) int p; { return isalpha(p) || isdigit(p) || strchr("*?_-.[]~=", p) != NULL; @@ -156,7 +156,7 @@ ce__isword(p) * Return if p is part of a word according to vi */ protected int -cv__isword(p) +cv__isword(p) int p; { return !isspace(p); @@ -167,7 +167,7 @@ cv__isword(p) * Find the previous word */ protected char * -c__prev_word(p, low, n, wtest) +c__prev_word(p, low, n, wtest) register char *p, *low; register int n; int (*wtest) __P((int)); @@ -175,9 +175,9 @@ c__prev_word(p, low, n, wtest) p--; while (n--) { - while ((p >= low) && !(*wtest)((unsigned char) *p)) + while ((p >= low) && !(*wtest)((unsigned char) *p)) p--; - while ((p >= low) && (*wtest)((unsigned char) *p)) + while ((p >= low) && (*wtest)((unsigned char) *p)) p--; } @@ -200,9 +200,9 @@ c__next_word(p, high, n, wtest) int (*wtest) __P((int)); { while (n--) { - while ((p < high) && !(*wtest)((unsigned char) *p)) + while ((p < high) && !(*wtest)((unsigned char) *p)) p++; - while ((p < high) && (*wtest)((unsigned char) *p)) + while ((p < high) && (*wtest)((unsigned char) *p)) p++; } if (p > high) @@ -225,14 +225,14 @@ cv_next_word(el, p, high, n, wtest) while (n--) { test = (*wtest)((unsigned char) *p); - while ((p < high) && (*wtest)((unsigned char) *p) == test) + while ((p < high) && (*wtest)((unsigned char) *p) == test) p++; /* * vi historically deletes with cw only the word preserving the * trailing whitespace! This is not what 'w' does.. */ - if (el->el_chared.c_vcmd.action != (DELETE|INSERT)) - while ((p < high) && isspace((unsigned char) *p)) + if (el->el_chared.c_vcmd.action != (DELETE|INSERT)) + while ((p < high) && isspace((unsigned char) *p)) p++; } @@ -262,14 +262,14 @@ cv_prev_word(el, p, low, n, wtest) * vi historically deletes with cb only the word preserving the * leading whitespace! This is not what 'b' does.. */ - if (el->el_chared.c_vcmd.action != (DELETE|INSERT)) - while ((p > low) && isspace((unsigned char) *p)) + if (el->el_chared.c_vcmd.action != (DELETE|INSERT)) + while ((p > low) && isspace((unsigned char) *p)) p--; test = (*wtest)((unsigned char) *p); - while ((p >= low) && (*wtest)((unsigned char) *p) == test) + while ((p >= low) && (*wtest)((unsigned char) *p) == test) p--; p++; - while (isspace((unsigned char) *p)) + while (isspace((unsigned char) *p)) p++; } @@ -319,7 +319,7 @@ c__number(p, num, dval) * Finish vi delete action */ protected void -cv_delfini(el) +cv_delfini(el) EditLine *el; { register int size; @@ -331,13 +331,13 @@ cv_delfini(el) oaction = el->el_chared.c_vcmd.action; el->el_chared.c_vcmd.action = NOP; - if (el->el_chared.c_vcmd.pos == 0) + if (el->el_chared.c_vcmd.pos == 0) return; if (el->el_line.cursor > el->el_chared.c_vcmd.pos) { size = (int) (el->el_line.cursor - el->el_chared.c_vcmd.pos); - c_delbefore(el, size); + c_delbefore(el, size); el->el_line.cursor = el->el_chared.c_vcmd.pos; re_refresh_cursor(el); } @@ -362,7 +362,7 @@ cv_delfini(el) abort(); break; } - + el->el_chared.c_undo.ptr = el->el_line.cursor; el->el_chared.c_undo.dsize = size; @@ -383,7 +383,7 @@ ce__endword(p, high, n) while (n--) { while ((p < high) && isspace((unsigned char) *p)) p++; - while ((p < high) && !isspace((unsigned char) *p)) + while ((p < high) && !isspace((unsigned char) *p)) p++; } @@ -404,14 +404,14 @@ cv__endword(p, high, n) p++; while (n--) { - while ((p < high) && isspace((unsigned char) *p)) + while ((p < high) && isspace((unsigned char) *p)) p++; if (isalnum((unsigned char) *p)) - while ((p < high) && isalnum((unsigned char) *p)) + while ((p < high) && isalnum((unsigned char) *p)) p++; else - while ((p < high) && !(isspace((unsigned char) *p) || + while ((p < high) && !(isspace((unsigned char) *p) || isalnum((unsigned char) *p))) p++; } @@ -458,7 +458,7 @@ ch_init(el) el->el_chared.c_macro.nline = NULL; el->el_chared.c_macro.level = -1; - el->el_chared.c_macro.macro = (char **) el_malloc(EL_MAXMACRO * + el->el_chared.c_macro.macro = (char **) el_malloc(EL_MAXMACRO * sizeof(char *)); return 0; } @@ -551,7 +551,7 @@ el_deletestr(el, n) if (n <= 0) return; - if (el->el_line.cursor < &el->el_line.buffer[n]) + if (el->el_line.cursor < &el->el_line.buffer[n]) return; c_delbefore(el, n); /* delete before dot */ @@ -630,7 +630,7 @@ c_hpos(el) if (el->el_line.cursor == el->el_line.buffer) return 0; else { - for (ptr = el->el_line.cursor - 1; + for (ptr = el->el_line.cursor - 1; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--) continue; diff --git a/lib/libedit/chared.h b/lib/libedit/chared.h index 20da6c8..22d07f0 100644 --- a/lib/libedit/chared.h +++ b/lib/libedit/chared.h @@ -54,7 +54,7 @@ * like real vi: i.e. the transition from command<->insert modes moves * the cursor. * - * On the other hand we really don't want to move the cursor, because + * On the other hand we really don't want to move the cursor, because * all the editing commands don't include the character under the cursor. * Probably the best fix is to make all the editing commands aware of * this fact. @@ -68,7 +68,7 @@ typedef struct c_macro_t { char *nline; } c_macro_t; -/* +/* * Undo information for both vi and emacs */ typedef struct c_undo_t { @@ -139,7 +139,7 @@ protected void cv_delfini __P((EditLine *)); protected char *cv__endword __P((char *, char *, int)); protected int ce__isword __P((int)); protected void cv_undo __P((EditLine *, int, int, char *)); -protected char *cv_next_word __P((EditLine*, char *, char *, int, +protected char *cv_next_word __P((EditLine*, char *, char *, int, int (*)(int))); protected char *cv_prev_word __P((EditLine*, char *, char *, int, int (*)(int))); diff --git a/lib/libedit/common.c b/lib/libedit/common.c index 696da52..c8be2b7 100644 --- a/lib/libedit/common.c +++ b/lib/libedit/common.c @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93"; #include "sys.h" #include "el.h" -/* ed_end_of_file(): +/* ed_end_of_file(): * Indicate end of file * [^D] */ @@ -60,7 +60,7 @@ ed_end_of_file(el, c) } -/* ed_insert(): +/* ed_insert(): * Add character to the line * Insert a character [bound to all insert keys] */ @@ -74,16 +74,16 @@ ed_insert(el, c) if (c == '\0') return CC_ERROR; - if (el->el_line.lastchar + el->el_state.argument >= + if (el->el_line.lastchar + el->el_state.argument >= el->el_line.limit) return CC_ERROR; /* end of buffer space */ 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_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_delafter(el, 1); } c_insert(el, 1); @@ -95,12 +95,12 @@ ed_insert(el, c) 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++] = + 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]; el->el_chared.c_undo.buf[el->el_chared.c_undo.isize] = '\0'; - c_delafter(el, el->el_state.argument); + c_delafter(el, el->el_state.argument); } c_insert(el, el->el_state.argument); @@ -117,7 +117,7 @@ ed_insert(el, c) } -/* ed_delete_prev_word(): +/* ed_delete_prev_word(): * Delete from beginning of current word to cursor * [M-^?] [^W] */ @@ -132,7 +132,7 @@ ed_delete_prev_word(el, c) if (el->el_line.cursor == el->el_line.buffer) return CC_ERROR; - cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, + cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, el->el_state.argument, ce__isword); for (p = cp, kp = el->el_chared.c_kill.buf; p < el->el_line.cursor; p++) @@ -147,7 +147,7 @@ ed_delete_prev_word(el, c) } -/* ed_delete_next_char(): +/* ed_delete_next_char(): * Delete character under cursor * [^D] [x] */ @@ -159,12 +159,12 @@ ed_delete_next_char(el, c) { #ifdef notdef /* XXX */ #define EL el->el_line -fprintf(stderr, "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", +fprintf(stderr, "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar, EL.lastchar, EL.limit, EL.limit); #endif if (el->el_line.cursor == el->el_line.lastchar) {/* if I'm at the end */ if (el->el_map.type == MAP_VI) { - if (el->el_line.cursor == el->el_line.buffer) { + if (el->el_line.cursor == el->el_line.buffer) { /* if I'm also at the beginning */ #ifdef KSHVI return CC_ERROR; @@ -196,7 +196,7 @@ fprintf(stderr, "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", } -/* ed_kill_line(): +/* ed_kill_line(): * Cut to the end of line * [^K] [^K] */ @@ -218,7 +218,7 @@ ed_kill_line(el, c) } -/* ed_move_to_end(): +/* ed_move_to_end(): * Move cursor to the end of line * [^E] [^E] */ @@ -242,7 +242,7 @@ ed_move_to_end(el, c) } -/* ed_move_to_beg(): +/* ed_move_to_beg(): * Move cursor to the beginning of line * [^A] [^A] */ @@ -256,7 +256,7 @@ ed_move_to_beg(el, c) if (el->el_map.type == MAP_VI) { /* We want FIRST non space character */ - while (isspace(*el->el_line.cursor)) + while (isspace(*el->el_line.cursor)) el->el_line.cursor++; if (el->el_chared.c_vcmd.action & DELETE) { cv_delfini(el); @@ -268,7 +268,7 @@ ed_move_to_beg(el, c) } -/* ed_transpose_chars(): +/* ed_transpose_chars(): * Exchange the character to the left of the cursor with the one under it * [^T] [^T] */ @@ -280,7 +280,7 @@ ed_transpose_chars(el, c) if (el->el_line.cursor < el->el_line.lastchar) { if (el->el_line.lastchar <= &el->el_line.buffer[1]) return CC_ERROR; - else + else el->el_line.cursor++; } if (el->el_line.cursor > &el->el_line.buffer[1]) { @@ -290,12 +290,12 @@ ed_transpose_chars(el, c) el->el_line.cursor[-1] = c; return CC_REFRESH; } - else + else return CC_ERROR; } -/* ed_next_char(): +/* ed_next_char(): * Move to the right one character * [^F] [^F] */ @@ -322,7 +322,7 @@ ed_next_char(el, c) } -/* ed_prev_word(): +/* ed_prev_word(): * Move to the beginning of the current word * [M-b] [b] */ @@ -335,8 +335,8 @@ ed_prev_word(el, c) if (el->el_line.cursor == el->el_line.buffer) return CC_ERROR; - el->el_line.cursor = c__prev_word(el->el_line.cursor, el->el_line.buffer, - el->el_state.argument, + el->el_line.cursor = c__prev_word(el->el_line.cursor, el->el_line.buffer, + el->el_state.argument, ce__isword); if (el->el_map.type == MAP_VI) @@ -349,7 +349,7 @@ ed_prev_word(el, c) } -/* ed_prev_char(): +/* ed_prev_char(): * Move to the left one character * [^B] [^B] */ @@ -372,12 +372,12 @@ ed_prev_char(el, c) return CC_CURSOR; } - else + else return CC_ERROR; } -/* ed_quoted_insert(): +/* ed_quoted_insert(): * Add the next character typed verbatim * [^V] [^V] */ @@ -400,7 +400,7 @@ ed_quoted_insert(el, c) } -/* ed_digit(): +/* ed_digit(): * Adds to argument or enters a digit */ protected el_action_t @@ -411,14 +411,14 @@ ed_digit(el, c) if (!isdigit(c)) return CC_ERROR; - if (el->el_state.doingarg) { + if (el->el_state.doingarg) { /* if doing an arg, add this in... */ - if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT) + if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT) el->el_state.argument = c - '0'; else { if (el->el_state.argument > 1000000) return CC_ERROR; - el->el_state.argument = + el->el_state.argument = (el->el_state.argument * 10) + (c - '0'); } return CC_ARGHACK; @@ -428,10 +428,10 @@ ed_digit(el, c) return CC_ERROR; if (el->el_state.inputmode != MODE_INSERT) { - el->el_chared.c_undo.buf[el->el_chared.c_undo.isize++] = + 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_delafter(el, 1); } c_insert(el, 1); *el->el_line.cursor++ = c; @@ -442,7 +442,7 @@ ed_digit(el, c) } -/* ed_argument_digit(): +/* ed_argument_digit(): * Digit that starts argument * For ESC-n */ @@ -467,7 +467,7 @@ ed_argument_digit(el, c) } -/* ed_unassigned(): +/* ed_unassigned(): * Indicates unbound character * Bound to keys that are not assigned */ @@ -487,7 +487,7 @@ ed_unassigned(el, c) ** TTY key handling. **/ -/* ed_tty_sigint(): +/* ed_tty_sigint(): * Tty interrupt character * [^C] */ @@ -496,12 +496,12 @@ protected el_action_t ed_tty_sigint(el, c) EditLine *el; int c; -{ +{ return CC_NORM; } -/* ed_tty_dsusp(): +/* ed_tty_dsusp(): * Tty delayed suspend character * [^Y] */ @@ -515,7 +515,7 @@ ed_tty_dsusp(el, c) } -/* ed_tty_flush_output(): +/* ed_tty_flush_output(): * Tty flush output characters * [^O] */ @@ -529,7 +529,7 @@ ed_tty_flush_output(el, c) } -/* ed_tty_sigquit(): +/* ed_tty_sigquit(): * Tty quit character * [^\] */ @@ -543,7 +543,7 @@ ed_tty_sigquit(el, c) } -/* ed_tty_sigtstp(): +/* ed_tty_sigtstp(): * Tty suspend character * [^Z] */ @@ -557,7 +557,7 @@ ed_tty_sigtstp(el, c) } -/* ed_tty_stop_output(): +/* ed_tty_stop_output(): * Tty disallow output characters * [^S] */ @@ -571,7 +571,7 @@ ed_tty_stop_output(el, c) } -/* ed_tty_start_output(): +/* ed_tty_start_output(): * Tty allow output characters * [^Q] */ @@ -585,7 +585,7 @@ ed_tty_start_output(el, c) } -/* ed_newline(): +/* ed_newline(): * Execute command * [^J] */ @@ -604,7 +604,7 @@ ed_newline(el, c) } -/* ed_delete_prev_char(): +/* ed_delete_prev_char(): * Delete the character to the left of the cursor * [^?] */ @@ -614,10 +614,10 @@ ed_delete_prev_char(el, c) EditLine *el; int c; { - if (el->el_line.cursor <= el->el_line.buffer) + if (el->el_line.cursor <= el->el_line.buffer) return CC_ERROR; - c_delbefore(el, el->el_state.argument); + 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; @@ -625,7 +625,7 @@ ed_delete_prev_char(el, c) } -/* ed_clear_screen(): +/* ed_clear_screen(): * Clear screen leaving current line at the top * [^L] */ @@ -641,7 +641,7 @@ ed_clear_screen(el, c) } -/* ed_redisplay(): +/* ed_redisplay(): * Redisplay everything * ^R */ @@ -657,7 +657,7 @@ ed_redisplay(el, c) } -/* ed_start_over(): +/* ed_start_over(): * Erase current line and start from scratch * [^G] */ @@ -672,7 +672,7 @@ ed_start_over(el, c) } -/* ed_sequence_lead_in(): +/* ed_sequence_lead_in(): * First character in a bound sequence * Placeholder for external keys */ @@ -686,7 +686,7 @@ ed_sequence_lead_in(el, c) } -/* ed_prev_history(): +/* ed_prev_history(): * Move to the previous history line * [^P] [k] */ @@ -703,7 +703,7 @@ ed_prev_history(el, c) if (el->el_history.eventno == 0) { /* save the current buffer away */ (void) strncpy(el->el_history.buf, el->el_line.buffer, EL_BUFSIZ); - el->el_history.last = el->el_history.buf + + el->el_history.last = el->el_history.buf + (el->el_line.lastchar - el->el_line.buffer); } @@ -712,7 +712,7 @@ ed_prev_history(el, c) if (hist_get(el) == CC_ERROR) { beep = 1; /* el->el_history.eventno was fixed by first call */ - (void) hist_get(el); + (void) hist_get(el); } re_refresh(el); @@ -723,7 +723,7 @@ ed_prev_history(el, c) } -/* ed_next_history(): +/* ed_next_history(): * Move to the next history line * [^N] [j] */ @@ -747,7 +747,7 @@ ed_next_history(el, c) } -/* ed_search_prev_history(): +/* ed_search_prev_history(): * Search previous in history for a line matching the current * next search history [M-P] [K] */ @@ -774,7 +774,7 @@ ed_search_prev_history(el, c) if (el->el_history.eventno == 0) { (void) strncpy(el->el_history.buf, el->el_line.buffer, EL_BUFSIZ); - el->el_history.last = el->el_history.buf + + el->el_history.last = el->el_history.buf + (el->el_line.lastchar - el->el_line.buffer); } @@ -795,9 +795,9 @@ ed_search_prev_history(el, c) #ifdef SDEBUG (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); #endif - if ((strncmp(hp, el->el_line.buffer, - el->el_line.lastchar - el->el_line.buffer) || - hp[el->el_line.lastchar-el->el_line.buffer]) && + if ((strncmp(hp, el->el_line.buffer, + el->el_line.lastchar - el->el_line.buffer) || + hp[el->el_line.lastchar-el->el_line.buffer]) && c_hmatch(el, hp)) { found++; break; @@ -808,7 +808,7 @@ ed_search_prev_history(el, c) if (!found) { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "not found\n"); + (void) fprintf(el->el_errfile, "not found\n"); #endif return CC_ERROR; } @@ -819,7 +819,7 @@ ed_search_prev_history(el, c) } -/* ed_search_next_history(): +/* ed_search_next_history(): * Search next in history for a line matching the current * [M-N] [J] */ @@ -853,9 +853,9 @@ ed_search_next_history(el, c) #ifdef SDEBUG (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); #endif - if ((strncmp(hp, el->el_line.buffer, - el->el_line.lastchar - el->el_line.buffer) || - hp[el->el_line.lastchar-el->el_line.buffer]) && + if ((strncmp(hp, el->el_line.buffer, + el->el_line.lastchar - el->el_line.buffer) || + hp[el->el_line.lastchar-el->el_line.buffer]) && c_hmatch(el, hp)) found = h; hp = HIST_NEXT(el); @@ -864,7 +864,7 @@ ed_search_next_history(el, c) if (!found) { /* is it the current history number? */ if (!c_hmatch(el, el->el_history.buf)) { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "not found\n"); + (void) fprintf(el->el_errfile, "not found\n"); #endif return CC_ERROR; } @@ -888,7 +888,7 @@ ed_prev_line(el, c) { char *ptr; int nchars = c_hpos(el); - + /* * Move to the line requested */ @@ -907,15 +907,15 @@ ed_prev_line(el, c) */ for (ptr--; ptr >= el->el_line.buffer && *ptr != '\n'; ptr--) continue; - + /* * Move to the character requested */ - for (ptr++; - nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; + for (ptr++; + nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; ptr++) continue; - + el->el_line.cursor = ptr; return CC_CURSOR; } @@ -948,16 +948,16 @@ ed_next_line(el, c) * Move to the character requested */ for (ptr++; - nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; + nchars-- > 0 && ptr < el->el_line.lastchar && *ptr != '\n'; ptr++) continue; - + el->el_line.cursor = ptr; return CC_CURSOR; } -/* ed_command(): +/* ed_command(): * Editline extended command * [M-X] [:] */ diff --git a/lib/libedit/el.c b/lib/libedit/el.c index 7314477..075a053 100644 --- a/lib/libedit/el.c +++ b/lib/libedit/el.c @@ -86,7 +86,7 @@ el_init(prog, fin, fout) return NULL; } } - else + else #endif el->el_errfile = stderr; @@ -132,7 +132,7 @@ el_end(el) el_free((ptr_t) el->el_prog); el_free((ptr_t) el); -} /* end el_end */ +} /* end el_end */ /* el_reset(): @@ -170,7 +170,7 @@ el_set(va_alist) el = va_arg(va, EditLine *); op = va_arg(va, int); #endif - + switch (op) { case EL_PROMPT: rv = prompt_set(el, va_arg(va, el_pfunc_t)); @@ -237,7 +237,7 @@ el_set(va_alist) } } break; - + case EL_ADDFN: { char *name = va_arg(va, char *); @@ -291,7 +291,7 @@ el_source(el, fname) if (fname == NULL) { fname = &elpath[1]; if ((fp = fopen(fname, "r")) == NULL) { - if ((ptr = getenv("HOME")) == NULL) + if ((ptr = getenv("HOME")) == NULL) return -1; fname = strncpy(path, ptr, MAXPATHLEN); (void) strncat(path, elpath, MAXPATHLEN); @@ -299,7 +299,7 @@ el_source(el, fname) } } - if ((fp = fopen(fname, "r")) == NULL) + if ((fp = fopen(fname, "r")) == NULL) return -1; while ((ptr = fgetln(fp, &len)) != NULL) diff --git a/lib/libedit/emacs.c b/lib/libedit/emacs.c index 273de107..a3a1975 100644 --- a/lib/libedit/emacs.c +++ b/lib/libedit/emacs.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint && not SCCSID */ -/* +/* * emacs.c: Emacs functions */ #include "sys.h" @@ -90,7 +90,7 @@ em_delete_next_word(el, c) if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; - cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, + cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (p = el->el_line.cursor, kp = el->el_chared.c_kill.buf; p < cp; p++) @@ -120,8 +120,8 @@ em_yank(el, c) if (el->el_chared.c_kill.last == el->el_chared.c_kill.buf) return CC_ERROR; - if (el->el_line.lastchar + - (el->el_chared.c_kill.last - el->el_chared.c_kill.buf) >= + if (el->el_line.lastchar + + (el->el_chared.c_kill.last - el->el_chared.c_kill.buf) >= el->el_line.limit) return CC_ERROR; @@ -129,13 +129,13 @@ em_yank(el, c) cp = el->el_line.cursor; /* open the space, */ - c_insert(el, el->el_chared.c_kill.last - el->el_chared.c_kill.buf); + c_insert(el, el->el_chared.c_kill.last - el->el_chared.c_kill.buf); /* copy the chars */ - for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++) + for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++) *cp++ = *kp; /* if an arg, cursor at beginning else cursor at end */ - if (el->el_state.argument == 1) + if (el->el_state.argument == 1) el->el_line.cursor = cp; return CC_REFRESH; @@ -251,7 +251,7 @@ em_gosmacs_traspose(el, c) el->el_line.cursor[-1] = c; return CC_REFRESH; } - else + else return CC_ERROR; } @@ -269,11 +269,11 @@ em_next_word(el, c) if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; - el->el_line.cursor = c__next_word(el->el_line.cursor, el->el_line.lastchar, + el->el_line.cursor = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); - if (el->el_map.type == MAP_VI) + if (el->el_map.type == MAP_VI) if (el->el_chared.c_vcmd.action & DELETE) { cv_delfini(el); return CC_REFRESH; @@ -294,7 +294,7 @@ em_upper_case(el, c) { char *cp, *ep; - ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, + ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (cp = el->el_line.cursor; cp < ep; cp++) @@ -320,7 +320,7 @@ em_capitol_case(el, c) { char *cp, *ep; - ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, + ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (cp = el->el_line.cursor; cp < ep; cp++) { @@ -353,7 +353,7 @@ em_lower_case(el, c) { char *cp, *ep; - ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, + ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); for (cp = el->el_line.cursor; cp < ep; cp++) @@ -383,7 +383,7 @@ em_set_mark(el, c) /* em_exchange_mark(): - * Exchange the cursor and mark + * Exchange the cursor and mark * [^X^X] */ protected el_action_t @@ -427,7 +427,7 @@ em_meta_next(el, c) EditLine *el; int c; { - el->el_state.metanext = 1; + el->el_state.metanext = 1; return CC_ARGHACK; } @@ -441,7 +441,7 @@ em_toggle_overwrite(el, c) EditLine *el; int c; { - el->el_state.inputmode = + el->el_state.inputmode = (el->el_state.inputmode == MODE_INSERT) ? MODE_REPLACE : MODE_INSERT; return CC_NORM; } @@ -463,8 +463,8 @@ em_copy_prev_word(el, c) oldc = el->el_line.cursor; /* does a bounds check */ - cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, - el->el_state.argument, ce__isword); + cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, + el->el_state.argument, ce__isword); c_insert(el, oldc - cp); for (dp = oldc; cp < oldc && dp < el->el_line.lastchar; cp++) diff --git a/lib/libedit/hist.c b/lib/libedit/hist.c index 394df63..27dacd1 100644 --- a/lib/libedit/hist.c +++ b/lib/libedit/hist.c @@ -101,7 +101,7 @@ hist_get(el) if (el->el_history.eventno == 0) { /* if really the current line */ (void) strncpy(el->el_line.buffer, el->el_history.buf, EL_BUFSIZ); - el->el_line.lastchar = el->el_line.buffer + + el->el_line.lastchar = el->el_line.buffer + (el->el_history.last - el->el_history.buf); #ifdef KSHVI diff --git a/lib/libedit/history.c b/lib/libedit/history.c index e866548..d60a7a9 100644 --- a/lib/libedit/history.c +++ b/lib/libedit/history.c @@ -130,7 +130,7 @@ private void history_def_delete __P((history_t *, hentry_t *)); /* history_def_first(): * Default function to return the first event in the history. */ -private const HistEvent * +private const HistEvent * history_def_first(p) ptr_t p; { @@ -145,7 +145,7 @@ history_def_first(p) /* history_def_last(): * Default function to return the last event in the history. */ -private const HistEvent * +private const HistEvent * history_def_last(p) ptr_t p; { @@ -160,7 +160,7 @@ history_def_last(p) /* history_def_next(): * Default function to return the next event in the history. */ -private const HistEvent * +private const HistEvent * history_def_next(p) ptr_t p; { @@ -181,7 +181,7 @@ history_def_next(p) /* history_def_prev(): * Default function to return the previous event in the history. */ -private const HistEvent * +private const HistEvent * history_def_prev(p) ptr_t p; { @@ -202,7 +202,7 @@ history_def_prev(p) /* history_def_curr(): * Default function to return the current event in the history. */ -private const HistEvent * +private const HistEvent * history_def_curr(p) ptr_t p; { @@ -296,7 +296,7 @@ history_def_enter(p, str) * Always keep at least one entry. * This way we don't have to check for the empty list. */ - while (h->cur > h->max + 1) + while (h->cur > h->max + 1) history_def_delete(h, h->list.prev); return ev; } @@ -399,9 +399,9 @@ history_set_fun(h, first, next, last, prev, curr, enter, add, ptr) history_efun_t enter, add; ptr_t ptr; { - if (first == NULL || next == NULL || + if (first == NULL || next == NULL || last == NULL || prev == NULL || curr == NULL || - enter == NULL || add == NULL || + enter == NULL || add == NULL || ptr == NULL ) { if (h->h_next != history_def_next) { history_def_init(&h->h_ref, 0); @@ -514,7 +514,7 @@ history(va_alist) #if __STDC__ va_start(va, fun); #else - History *h; + History *h; int fun; va_start(va); h = va_arg(va, History *); @@ -584,7 +584,7 @@ history(va_alist) history_efun_t add = va_arg(va, history_efun_t); ptr_t ptr = va_arg(va, ptr_t); - if (history_set_fun(h, first, next, last, prev, + if (history_set_fun(h, first, next, last, prev, curr, enter, add, ptr) == 0) ev = &sev; } diff --git a/lib/libedit/key.c b/lib/libedit/key.c index 058da0e..302b6bd 100644 --- a/lib/libedit/key.c +++ b/lib/libedit/key.c @@ -42,10 +42,10 @@ static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93"; * key.c: This module contains the procedures for maintaining * the extended-key map. * - * An extended-key (key) is a sequence of keystrokes introduced - * with an sequence introducer and consisting of an arbitrary - * number of characters. This module maintains a map (the el->el_key.map) - * to convert these extended-key sequences into input strs + * An extended-key (key) is a sequence of keystrokes introduced + * with an sequence introducer and consisting of an arbitrary + * number of characters. This module maintains a map (the el->el_key.map) + * to convert these extended-key sequences into input strs * (XK_STR), editor functions (XK_CMD), or unix commands (XK_EXE). * * Warning: @@ -65,8 +65,8 @@ static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93"; #include "el.h" -/* - * The Nodes of the el->el_key.map. The el->el_key.map is a linked list +/* + * The Nodes of the el->el_key.map. The el->el_key.map is a linked list * of these node elements */ struct key_node_t { @@ -78,9 +78,9 @@ struct key_node_t { struct key_node_t *sibling; /* ptr to another key with same prefix */ }; -private int node_trav __P((EditLine *, key_node_t *, char *, +private int node_trav __P((EditLine *, key_node_t *, char *, key_value_t *)); -private int node__try __P((key_node_t *, char *, +private int node__try __P((key_node_t *, char *, key_value_t *, int)); private key_node_t *node__get __P((int)); private void node__put __P((key_node_t *)); @@ -104,7 +104,7 @@ key_init(el) el->el_key.map = NULL; key_reset(el); return 0; -} +} /* key_end(): @@ -118,7 +118,7 @@ key_end(el) el->el_key.buf = NULL; /* XXX: provide a function to clear the keys */ el->el_key.map = NULL; -} +} /* key_map_cmd(): @@ -167,7 +167,7 @@ key_reset(el) * Looks up *ch in map and then reads characters until a * complete match is found or a mismatch occurs. Returns the * type of the match found (XK_STR, XK_CMD, or XK_EXE). - * Returns NULL in val.str and XK_STR for no match. + * Returns NULL in val.str and XK_STR for no match. * The last character read is returned in *ch. */ protected int @@ -195,7 +195,7 @@ key_add(el, key, val, ntype) int ntype; { if (key[0] == '\0') { - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "key_add: Null extended-key not allowed.\n"); return; } @@ -211,7 +211,7 @@ key_add(el, key, val, ntype) el->el_key.map = node__get(key[0]); /* it is properly initialized */ /* Now recurse through el->el_key.map */ - (void) node__try(el->el_key.map, key, val, ntype); + (void) node__try(el->el_key.map, key, val, ntype); return; } @@ -226,9 +226,9 @@ key_clear(el, map, in) char *in; { if ((map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN) && - ((map == el->el_map.key && + ((map == el->el_map.key && el->el_map.alt[(unsigned char) *in] != ED_SEQUENCE_LEAD_IN) || - (map == el->el_map.alt && + (map == el->el_map.alt && el->el_map.key[(unsigned char) *in] != ED_SEQUENCE_LEAD_IN))) (void) key_delete(el, in); } @@ -244,7 +244,7 @@ key_delete(el, key) char *key; { if (key[0] == '\0') { - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "key_delete: Null extended-key not allowed.\n"); return -1; } @@ -515,7 +515,7 @@ node_lookup(el, str, ptr, cnt) /* If match put this char into el->el_key.buf. Recurse */ if (ptr->ch == *str) { /* match found */ - ncnt = key__decode_char(el->el_key.buf, cnt, + ncnt = key__decode_char(el->el_key.buf, cnt, (unsigned char) ptr->ch); if (ptr->next != NULL) /* not yet at leaf */ @@ -557,7 +557,7 @@ node_enum(el, ptr, cnt) if (cnt >= KEY_BUFSIZ - 5) { /* buffer too small */ el->el_key.buf[++cnt] = '"'; el->el_key.buf[++cnt] = '\0'; - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "Some extended keys too long for internal print buffer"); (void) fprintf(el->el_errfile, " \"%s...\"\n", el->el_key.buf); return 0; @@ -607,18 +607,18 @@ key_kprint(el, key, val, ntype) switch (ntype) { case XK_STR: case XK_EXE: - (void) fprintf(el->el_errfile, fmt, key, - key__decode_str(val->str, unparsbuf, + (void) fprintf(el->el_errfile, fmt, key, + key__decode_str(val->str, unparsbuf, ntype == XK_STR ? "\"\"" : "[]")); break; case XK_CMD: - for (fp = el->el_map.help; fp->name; fp++) + for (fp = el->el_map.help; fp->name; fp++) if (val->cmd == fp->func) { (void) fprintf(el->el_errfile, fmt, key, fp->name); break; } #ifdef DEBUG_KEY - if (fp->name == NULL) + if (fp->name == NULL) (void) fprintf(el->el_errfile, "BUG! Command not found.\n"); #endif @@ -708,7 +708,7 @@ key__decode_str(str, buf, sep) *b++ = '\\'; *b++ = *p; } - else if (*p == ' ' || (isprint((unsigned char) *p) && + else if (*p == ' ' || (isprint((unsigned char) *p) && !isspace((unsigned char) *p))) { *b++ = *p; } diff --git a/lib/libedit/key.h b/lib/libedit/key.h index 2ed3afc..eed0818 100644 --- a/lib/libedit/key.h +++ b/lib/libedit/key.h @@ -65,7 +65,7 @@ protected void key_end __P((EditLine *)); protected key_value_t * key_map_cmd __P((EditLine *, int)); protected key_value_t * key_map_str __P((EditLine *, char *)); protected void key_reset __P((EditLine *)); -protected int key_get __P((EditLine *, char *, +protected int key_get __P((EditLine *, char *, key_value_t *)); protected void key_add __P((EditLine *, char *, key_value_t *, int)); @@ -73,7 +73,7 @@ protected void key_clear __P((EditLine *, el_action_t *, char *)); protected int key_delete __P((EditLine *, char *)); protected void key_print __P((EditLine *, char *)); -protected void key_kprint __P((EditLine *, char *, +protected void key_kprint __P((EditLine *, char *, key_value_t *, int)); protected char *key__decode_str __P((char *, char *, char *)); diff --git a/lib/libedit/map.c b/lib/libedit/map.c index 3378217..5f91c75 100644 --- a/lib/libedit/map.c +++ b/lib/libedit/map.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint && not SCCSID */ /* - * map.c: Editor function definitions + * map.c: Editor function definitions */ #include "sys.h" #include <stdlib.h> @@ -660,8 +660,8 @@ private el_action_t el_map_vi_command[] = { /* 41 */ ED_UNASSIGNED, /* ) */ /* 42 */ ED_UNASSIGNED, /* * */ /* 43 */ ED_NEXT_HISTORY, /* + */ - /* 44 */ VI_REPEAT_PREV_CHAR, /* , */ - /* 45 */ ED_PREV_HISTORY, /* - */ + /* 44 */ VI_REPEAT_PREV_CHAR, /* , */ + /* 45 */ ED_PREV_HISTORY, /* - */ /* 46 */ ED_UNASSIGNED, /* . */ /* 47 */ VI_SEARCH_PREV, /* / */ /* 48 */ VI_ZERO, /* 0 */ @@ -882,7 +882,7 @@ protected int map_init(el) EditLine *el; { - + /* * Make sure those are correct before starting. */ @@ -902,7 +902,7 @@ map_init(el) el->el_map.vii = el_map_vi_insert; el->el_map.help = (el_bindings_t *) el_malloc(sizeof(el_bindings_t) * EL_NUM_FCNS); - (void) memcpy(el->el_map.help, help__get(), + (void) memcpy(el->el_map.help, help__get(), sizeof(el_bindings_t) * EL_NUM_FCNS); el->el_map.func = (el_func_t *) el_malloc(sizeof(el_func_t) * EL_NUM_FCNS); memcpy(el->el_map.func, func__get(), sizeof(el_func_t) * EL_NUM_FCNS); @@ -948,8 +948,8 @@ map_init_nls(el) int i; el_action_t *map = el->el_map.key; - for (i = 0200; i <= 0377; i++) - if (isprint(i)) + for (i = 0200; i <= 0377; i++) + if (isprint(i)) map[i] = ED_INSERT; } @@ -977,12 +977,12 @@ map_init_meta(el) if (el->el_map.type == MAP_VI) map = alt; } - else + else map = alt; } buf[0] = (char) i; buf[2] = 0; - for (i = 0200; i <= 0377; i++) + for (i = 0200; i <= 0377; i++) switch (map[i]) { case ED_INSERT: case ED_UNASSIGNED: @@ -1064,14 +1064,14 @@ map_init_emacs(el) buf[2] = 0; buf[1] = CONTROL('X'); key_add(el, buf, key_map_cmd(el, EM_EXCHANGE_MARK), XK_CMD); - + tty_bind_char(el, 1); term_bind_arrow(el); } /* map_set_editor(): - * Set the editor + * Set the editor */ protected int map_set_editor(el, editor) @@ -1106,12 +1106,12 @@ map_print_key(el, map, in) (void) key__decode_str(in, outbuf, ""); for (bp = el->el_map.help; bp->name != NULL; bp++) if (bp->func == map[(unsigned char) *in]) { - (void) fprintf(el->el_outfile, + (void) fprintf(el->el_outfile, "%s\t->\t%s\n", outbuf, bp->name); return; } } - else + else key_print(el, in); } @@ -1144,13 +1144,13 @@ map_print_some_keys(el, map, first, last) if (bp->func == map[first]) { if (first == last) { (void) fprintf(el->el_outfile, "%-15s-> %s\n", - key__decode_str(firstbuf, unparsbuf, STRQQ), + key__decode_str(firstbuf, unparsbuf, STRQQ), bp->name); } else { (void) fprintf(el->el_outfile, "%-4s to %-7s-> %s\n", key__decode_str(firstbuf, unparsbuf, STRQQ), - key__decode_str(lastbuf, extrabuf, STRQQ), + key__decode_str(lastbuf, extrabuf, STRQQ), bp->name); } return; @@ -1160,13 +1160,13 @@ map_print_some_keys(el, map, first, last) if (map == el->el_map.key) { (void) fprintf(el->el_outfile, "BUG!!! %s isn't bound to anything.\n", key__decode_str(firstbuf, unparsbuf, STRQQ)); - (void) fprintf(el->el_outfile, "el->el_map.key[%d] == %d\n", + (void) fprintf(el->el_outfile, "el->el_map.key[%d] == %d\n", first, el->el_map.key[first]); } else { (void) fprintf(el->el_outfile, "BUG!!! %s isn't bound to anything.\n", key__decode_str(firstbuf, unparsbuf, STRQQ)); - (void) fprintf(el->el_outfile, "el->el_map.alt[%d] == %d\n", + (void) fprintf(el->el_outfile, "el->el_map.alt[%d] == %d\n", first, el->el_map.alt[first]); } #endif @@ -1268,8 +1268,8 @@ map_bind(el, argc, argv) return 0; case 'l': - for (bp = el->el_map.help; bp->name != NULL; bp++) - (void) fprintf(el->el_outfile, "%s\n\t%s\n", + for (bp = el->el_map.help; bp->name != NULL; bp++) + (void) fprintf(el->el_outfile, "%s\n\t%s\n", bp->name, bp->description); return 0; default: @@ -1298,11 +1298,11 @@ map_bind(el, argc, argv) (void) term_clear_arrow(el, in); return -1; } - if (in[1]) + if (in[1]) (void) key_delete(el, in); - else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN) + else if (map[(unsigned char) *in] == ED_SEQUENCE_LEAD_IN) (void) key_delete(el, in); - else + else map[(unsigned char) *in] = ED_UNASSIGNED; return 0; } @@ -1326,7 +1326,7 @@ map_bind(el, argc, argv) case XK_STR: case XK_EXE: if ((out = parse__string(outbuf, argv[argc])) == NULL) { - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "%s: Invalid \\ or ^ in outstring.\n", argv[0]); return -1; } @@ -1339,7 +1339,7 @@ map_bind(el, argc, argv) case XK_CMD: if ((cmd = parse_cmd(el, argv[argc])) == -1) { - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "%s: Invalid command `%s'.\n", argv[0], argv[argc]); return -1; } @@ -1379,7 +1379,7 @@ map_addfunc(el, name, help, func) if (name == NULL || help == NULL || func == NULL) return -1; - el->el_map.func = (el_func_t *) + el->el_map.func = (el_func_t *) el_realloc(el->el_map.func, nf * sizeof(el_func_t)); el->el_map.help = (el_bindings_t *) el_realloc(el->el_map.help, nf * sizeof(el_bindings_t)); diff --git a/lib/libedit/map.h b/lib/libedit/map.h index 71c93b4..c0f16f1 100644 --- a/lib/libedit/map.h +++ b/lib/libedit/map.h @@ -71,7 +71,7 @@ protected void map_end __P((EditLine *)); protected void map_init_vi __P((EditLine *)); protected void map_init_emacs __P((EditLine *)); protected int map_set_editor __P((EditLine *, char *)); -protected int map_addfunc __P((EditLine *, const char *, +protected int map_addfunc __P((EditLine *, const char *, const char *, el_func_t)); #endif /* _h_el_map */ diff --git a/lib/libedit/parse.c b/lib/libedit/parse.c index 2fe746f..a89539c 100644 --- a/lib/libedit/parse.c +++ b/lib/libedit/parse.c @@ -131,7 +131,7 @@ parse__escape(ptr) p = *ptr; - if (p[1] == 0) + if (p[1] == 0) return -1; if (*p == '\\') { @@ -180,7 +180,7 @@ parse__escape(ptr) } c = (c << 3) | (ch - '0'); } - if ((c & 0xffffff00) != 0) + if ((c & 0xffffff00) != 0) return -1; --p; } diff --git a/lib/libedit/parse.h b/lib/libedit/parse.h index 263076b..0601746 100644 --- a/lib/libedit/parse.h +++ b/lib/libedit/parse.h @@ -42,7 +42,7 @@ #ifndef _h_el_parse #define _h_el_parse -protected int parse_line __P((EditLine *, const char *)); +protected int parse_line __P((EditLine *, const char *)); protected int parse__escape __P((const char ** const)); protected char * parse__string __P((char *, const char *)); protected int parse_cmd __P((EditLine *, const char *)); diff --git a/lib/libedit/prompt.c b/lib/libedit/prompt.c index cea7ad7..59ba200 100644 --- a/lib/libedit/prompt.c +++ b/lib/libedit/prompt.c @@ -83,7 +83,7 @@ prompt_print(el) /* prompt_init(): * Initialize the prompt stuff */ -protected int +protected int prompt_init(el) EditLine *el; { @@ -98,7 +98,7 @@ prompt_init(el) * Clean up the prompt stuff */ protected void -/*ARGSUSED*/ +/*ARGSUSED*/ prompt_end(el) EditLine *el; { @@ -108,7 +108,7 @@ prompt_end(el) /* prompt_set(): * Install a prompt printing function */ -protected int +protected int prompt_set(el, prf) EditLine *el; el_pfunc_t prf; diff --git a/lib/libedit/read.c b/lib/libedit/read.c index ccfc88b..05049e8 100644 --- a/lib/libedit/read.c +++ b/lib/libedit/read.c @@ -104,7 +104,7 @@ read__fixio(fd, e) if (fcntl(fd, F_SETFL, e & ~O_NDELAY) == -1) return -1; - else + else e = 1; # endif /* F_SETFL && O_NDELAY */ @@ -233,7 +233,7 @@ read_getcmd(el, cmdnum, ch) break; } } - if (el->el_map.alt == NULL) + if (el->el_map.alt == NULL) el->el_map.current = el->el_map.key; } *cmdnum = cmd; @@ -261,9 +261,9 @@ el_getc(el, cp) if (!read_preread(el)) break; } - if (ma->level < 0) + if (ma->level < 0) break; - + if (*ma->macro[ma->level] == 0) { ma->level--; continue; @@ -347,7 +347,7 @@ el_gets(el, nread) if (cmdnum >= el->el_map.nfunc) { /* BUG CHECK command */ #ifdef DEBUG_EDIT - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "ERROR: illegal command from key 0%o\r\n", ch); #endif /* DEBUG_EDIT */ continue; /* try again */ @@ -399,7 +399,7 @@ el_gets(el, nread) break; case CC_NEWLINE: /* normal end of line */ - num = el->el_line.lastchar - el->el_line.buffer; + num = el->el_line.lastchar - el->el_line.buffer; break; case CC_FATAL: /* fatal error, reset to known state */ diff --git a/lib/libedit/refresh.c b/lib/libedit/refresh.c index 51fe769..6ad5522 100644 --- a/lib/libedit/refresh.c +++ b/lib/libedit/refresh.c @@ -51,9 +51,9 @@ static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93"; private void re_addc __P((EditLine *, int)); private void re_update_line __P((EditLine *, char *, char *, int)); -private void re_insert __P((EditLine *, char *, int, int, +private void re_insert __P((EditLine *, char *, int, int, char *, int)); -private void re_delete __P((EditLine *, char *, int, int, +private void re_delete __P((EditLine *, char *, int, int, int)); private void re_fastputc __P((EditLine *, int)); @@ -61,7 +61,7 @@ private void re__strncopy __P((char *, char *, size_t)); private void re__copy_and_pad __P((char *, char *, size_t)); #ifdef DEBUG_REFRESH -private void re_printstr __P((EditLine *, char *, char *, +private void re_printstr __P((EditLine *, char *, char *, char *)); # define __F el->el_errfile # define RE_DEBUG(a, b, c) do \ @@ -83,7 +83,7 @@ re_printstr(el, str, f, t) while (f < t) RE_DEBUG(1,(__F, "%c", *f++ & 0177),); RE_DEBUG(1,(__F, "\"\r\n"),); -} +} #else # define RE_DEBUG(a, b, c) #endif @@ -117,9 +117,9 @@ re_addc(el, c) } else if (iscntrl(c)) { re_putc(el, '^'); - if (c == '\177') + if (c == '\177') re_putc(el, '?'); - else + else /* uncontrolify it; works only for iso8859-1 like sets */ re_putc(el, (c | 0100)); } @@ -145,11 +145,11 @@ re_putc(el, c) el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_refresh.r_cursor.h] = c; el->el_refresh.r_cursor.h++; /* advance to next place */ if (el->el_refresh.r_cursor.h >= el->el_term.t_size.h) { - el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_term.t_size.h] = '\0'; + el->el_vdisplay[el->el_refresh.r_cursor.v][el->el_term.t_size.h] = '\0'; /* assure end of line */ el->el_refresh.r_cursor.h = 0; /* reset it. */ el->el_refresh.r_cursor.v++; - RE_DEBUG(el->el_refresh.r_cursor.v >= el->el_term.t_size.v, + RE_DEBUG(el->el_refresh.r_cursor.v >= el->el_term.t_size.v, (__F, "\r\nre_putc: overflow! r_cursor.v == %d > %d\r\n", el->el_refresh.r_cursor.v, el->el_term.t_size.v), abort()); } @@ -195,12 +195,12 @@ re_refresh(el) cur.v = el->el_refresh.r_cursor.v; } /* must be done BEFORE the NUL is written */ - el->el_refresh.r_newcv = el->el_refresh.r_cursor.v; + el->el_refresh.r_newcv = el->el_refresh.r_cursor.v; re_putc(el, '\0'); /* put NUL on end */ - RE_DEBUG(1,(__F, + RE_DEBUG(1,(__F, "term.h=%d vcur.h=%d vcur.v=%d vdisplay[0]=\r\n:%80.80s:\r\n", - el->el_term.t_size.h, el->el_refresh.r_cursor.h, + el->el_term.t_size.h, el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v, el->el_vdisplay[0]),); RE_DEBUG(1,(__F, "updating %d lines.\r\n", el->el_refresh.r_newcv),); @@ -214,14 +214,14 @@ re_refresh(el) * cursor by writing the character that is at the end of the * screen line, it won't be a NUL or some old leftover stuff. */ - re__copy_and_pad(el->el_display[i], el->el_vdisplay[i], + re__copy_and_pad(el->el_display[i], el->el_vdisplay[i], el->el_term.t_size.h); } RE_DEBUG(1,(__F, "\r\nel->el_refresh.r_cursor.v=%d,el->el_refresh.r_oldcv=%d i=%d\r\n", el->el_refresh.r_cursor.v, el->el_refresh.r_oldcv, i),); - if (el->el_refresh.r_oldcv > el->el_refresh.r_newcv) + if (el->el_refresh.r_oldcv > el->el_refresh.r_newcv) for (; i <= el->el_refresh.r_oldcv; i++) { term_move_to_line(el, i); term_move_to_char(el, 0); @@ -231,11 +231,11 @@ re_refresh(el) #endif /* DEBUG_REFRESH */ *el->el_display[i] = '\0'; } - + el->el_refresh.r_oldcv = el->el_refresh.r_newcv; /* set for next time */ - RE_DEBUG(1,(__F, + RE_DEBUG(1,(__F, "\r\ncursor.h = %d, cursor.v = %d, cur.h = %d, cur.v = %d\r\n", - el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v, + el->el_refresh.r_cursor.h, el->el_refresh.r_cursor.v, cur.h, cur.v),); term_move_to_line(el, cur.v); /* go to where the cursor is */ term_move_to_char(el, cur.h); @@ -243,7 +243,7 @@ re_refresh(el) /* re_goto_bottom(): - * used to go to last used screen line + * used to go to last used screen line */ protected void re_goto_bottom(el) @@ -259,7 +259,7 @@ re_goto_bottom(el) /* re_insert(): * insert num characters of s into d (in front of the character) - * at dat, maximum length of d is dlen + * at dat, maximum length of d is dlen */ private void /*ARGSUSED*/ @@ -289,7 +289,7 @@ re_insert(el, d, dat, dlen, s, num) *b-- = *a--; d[dlen] = '\0'; /* just in case */ } - RE_DEBUG(1,(__F, + RE_DEBUG(1,(__F, "re_insert() after insert: %d at %d max %d, d == \"%s\"\n", num, dat, dlen, d),); RE_DEBUG(1,(__F, "s == \"%s\"n", s),); @@ -305,7 +305,7 @@ re_insert(el, d, dat, dlen, s, num) /* re_delete(): - * delete num characters d at dat, maximum length of d is dlen + * delete num characters d at dat, maximum length of d is dlen */ private void /*ARGSUSED*/ @@ -400,7 +400,7 @@ re_update_line(el, old, new, i) */ while (*o) o++; - /* + /* * Remove any trailing blanks off of the end, being careful not to * back up past the beginning. */ @@ -411,7 +411,7 @@ re_update_line(el, old, new, i) } oe = o; *oe = '\0'; - + while (*n) n++; @@ -423,7 +423,7 @@ re_update_line(el, old, new, i) } ne = n; *ne = '\0'; - + /* * if no diff, continue to next line of redraw */ @@ -574,7 +574,7 @@ re_update_line(el, old, new, i) ofd - old, osb - old, ose - old, ols - old, oe - old),); RE_DEBUG(1,(__F, "nfd %d, nsb %d, nse %d, nls %d, ne %d\n", nfd - new, nsb - new, nse - new, nls - new, ne - new),); - RE_DEBUG(1,(__F, + RE_DEBUG(1,(__F, "xxx-xxx:\"00000000001111111111222222222233333333334\"\r\n"),); RE_DEBUG(1,(__F, "xxx-xxx:\"01234567890123456789012345678901234567890\"\r\n"),); @@ -602,14 +602,14 @@ re_update_line(el, old, new, i) /* * at this point we have something like this: - * + * * /old /ofd /osb /ose /ols /oe * v.....................v v..................v v........v * eddie> Oh, my fredded gruntle-buggy is to me, as foo var lurgid as * eddie> Oh, my fredded quiux buggy is to me, as gruntle-lurgid as - * ^.....................^ ^..................^ ^........^ + * ^.....................^ ^..................^ ^........^ * \new \nfd \nsb \nse \nls \ne - * + * * fx is the difference in length between the the chars between nfd and * nsb, and the chars between ofd and osb, and is thus the number of * characters to delete if < 0 (new is shorter than old, as above), @@ -739,7 +739,7 @@ re_update_line(el, old, new, i) * Again a duplicate test. */ if (sx < 0) { - RE_DEBUG(!EL_CAN_DELETE, + RE_DEBUG(!EL_CAN_DELETE, (__F, "ERROR: cannot delete in second diff\n"),); term_deletechars(el, -sx); } @@ -769,7 +769,7 @@ re_update_line(el, old, new, i) */ if (nsb != ne) { RE_DEBUG(1,(__F, "with stuff to keep at end\r\n"),); - /* + /* * We have to recalculate fx here because we set it * to zero above as a flag saying that we hadn't done * an early first insert. @@ -874,7 +874,7 @@ re_refresh_cursor(el) th = el->el_term.t_size.h; /* optimize for speed */ /* do input buffer to el->el_line.cursor */ - for (cp = el->el_line.buffer; cp < el->el_line.cursor; cp++) { + for (cp = el->el_line.buffer; cp < el->el_line.cursor; cp++) { c = *cp & 0xFF; h++; /* all chars at least this long */ @@ -927,7 +927,7 @@ re_fastputc(el, c) { term__putc(c); el->el_display[el->el_cursor.v][el->el_cursor.h++] = c; - if (el->el_cursor.h >= el->el_term.t_size.h) { + if (el->el_cursor.h >= el->el_term.t_size.h) { /* if we must overflow */ el->el_cursor.h = 0; el->el_cursor.v++; @@ -940,7 +940,7 @@ re_fastputc(el, c) /* re_fastaddc(): * we added just one char, handle it fast. - * Assumes that screen cursor == real cursor + * Assumes that screen cursor == real cursor */ protected void re_fastaddc(el) @@ -974,7 +974,7 @@ re_fastaddc(el) /* re_clear_display(): - * clear the screen buffers so that new new prompt starts fresh. + * clear the screen buffers so that new new prompt starts fresh. */ protected void re_clear_display(el) @@ -991,7 +991,7 @@ re_clear_display(el) /* re_clear_lines(): - * Make sure all lines are *really* blank + * Make sure all lines are *really* blank */ protected void re_clear_lines(el) diff --git a/lib/libedit/search.c b/lib/libedit/search.c index 7b622fd..bf6099d 100644 --- a/lib/libedit/search.c +++ b/lib/libedit/search.c @@ -91,7 +91,7 @@ search_end(el) /* regerror(): * Handle regular expression errors */ -public void +public void /*ARGSUSED*/ regerror(msg) const char *msg; @@ -156,25 +156,25 @@ c_hmatch(el, str) (void) fprintf(el->el_errfile, "match `%s' with `%s'\n", el->el_search.patbuf, str); #endif /* SDEBUG */ - + return el_match(str, el->el_search.patbuf); } -/* c_setpat(): +/* c_setpat(): * Set the history seatch pattern */ protected void c_setpat(el) EditLine *el; { - if (el->el_state.lastcmd != ED_SEARCH_PREV_HISTORY && + if (el->el_state.lastcmd != ED_SEARCH_PREV_HISTORY && el->el_state.lastcmd != ED_SEARCH_NEXT_HISTORY) { el->el_search.patlen = EL_CURSOR(el) - el->el_line.buffer; - if (el->el_search.patlen >= EL_BUFSIZ) + if (el->el_search.patlen >= EL_BUFSIZ) el->el_search.patlen = EL_BUFSIZ -1; if (el->el_search.patlen >= 0) { - (void) strncpy(el->el_search.patbuf, el->el_line.buffer, + (void) strncpy(el->el_search.patbuf, el->el_line.buffer, el->el_search.patlen); el->el_search.patbuf[el->el_search.patlen] = '\0'; } @@ -185,8 +185,8 @@ c_setpat(el) (void) fprintf(el->el_errfile, "\neventno = %d\n", el->el_history.eventno); (void) fprintf(el->el_errfile, "patlen = %d\n", el->el_search.patlen); (void) fprintf(el->el_errfile, "patbuf = \"%s\"\n", el->el_search.patbuf); - (void) fprintf(el->el_errfile, "cursor %d lastchar %d\n", - EL_CURSOR(el) - el->el_line.buffer, + (void) fprintf(el->el_errfile, "cursor %d lastchar %d\n", + EL_CURSOR(el) - el->el_line.buffer, el->el_line.lastchar - el->el_line.buffer); #endif } @@ -213,7 +213,7 @@ ce_inc_search(el, dir) newdir = dir, done, redo; - if (el->el_line.lastchar + sizeof(STRfwd) / sizeof(char) + 2 + + if (el->el_line.lastchar + sizeof(STRfwd) / sizeof(char) + 2 + el->el_search.patlen >= el->el_line.limit) return CC_ERROR; @@ -228,12 +228,12 @@ ce_inc_search(el, dir) } done = redo = 0; *el->el_line.lastchar++ = '\n'; - for (cp = newdir == ED_SEARCH_PREV_HISTORY ? STRbck : STRfwd; + for (cp = newdir == ED_SEARCH_PREV_HISTORY ? STRbck : STRfwd; *cp; *el->el_line.lastchar++ = *cp++) continue; *el->el_line.lastchar++ = pchar; - for (cp = &el->el_search.patbuf[1]; - cp < &el->el_search.patbuf[el->el_search.patlen]; + for (cp = &el->el_search.patbuf[1]; + cp < &el->el_search.patbuf[el->el_search.patlen]; *el->el_line.lastchar++ = *cp++) continue; *el->el_line.lastchar = '\0'; @@ -268,7 +268,7 @@ ce_inc_search(el, dir) case ED_DELETE_PREV_CHAR: if (el->el_search.patlen > 1) done++; - else + else term_beep(el); break; @@ -284,15 +284,15 @@ ce_inc_search(el, dir) for (cp = &el->el_search.patbuf[1]; ; cp++) if (cp >= &el->el_search.patbuf[el->el_search.patlen]) { el->el_line.cursor += el->el_search.patlen - 1; - cp = c__next_word(el->el_line.cursor, + cp = c__next_word(el->el_line.cursor, el->el_line.lastchar, 1, ce__isword); - while (el->el_line.cursor < cp && + while (el->el_line.cursor < cp && *el->el_line.cursor != '\n') { if (el->el_search.patlen > EL_BUFSIZ - 3) { term_beep(el); break; } - el->el_search.patbuf[el->el_search.patlen++] = + el->el_search.patbuf[el->el_search.patlen++] = *el->el_line.cursor; *el->el_line.lastchar++ = *el->el_line.cursor++; } @@ -305,10 +305,10 @@ ce_inc_search(el, dir) break; } break; - + default: /* Terminate and execute cmd */ endcmd[0] = ch; - el_push(el, endcmd); + el_push(el, endcmd); /*FALLTHROUGH*/ case 0033: /* ESC: Terminate */ @@ -319,7 +319,7 @@ ce_inc_search(el, dir) break; } - while (el->el_line.lastchar > el->el_line.buffer && + while (el->el_line.lastchar > el->el_line.buffer && *el->el_line.lastchar != '\n') *el->el_line.lastchar-- = '\0'; *el->el_line.lastchar = '\0'; @@ -327,7 +327,7 @@ ce_inc_search(el, dir) if (!done) { /* Can't search if unmatched '[' */ - for (cp = &el->el_search.patbuf[el->el_search.patlen-1], ch = ']'; + for (cp = &el->el_search.patbuf[el->el_search.patlen-1], ch = ']'; cp > el->el_search.patbuf; cp--) if (*cp == '[' || *cp == ']') { ch = *cp; @@ -337,7 +337,7 @@ ce_inc_search(el, dir) if (el->el_search.patlen > 1 && ch != '[') { if (redo && newdir == dir) { if (pchar == '?') { /* wrap around */ - el->el_history.eventno = + el->el_history.eventno = newdir == ED_SEARCH_PREV_HISTORY ? 0 : 0x7fffffff; if (hist_get(el) == CC_ERROR) /* el->el_history.eventno was fixed by first call */ @@ -345,7 +345,7 @@ ce_inc_search(el, dir) el->el_line.cursor = newdir == ED_SEARCH_PREV_HISTORY ? el->el_line.lastchar : el->el_line.buffer; } else - el->el_line.cursor += + el->el_line.cursor += newdir == ED_SEARCH_PREV_HISTORY ? -1 : 1; } #ifdef ANCHOR @@ -353,19 +353,19 @@ ce_inc_search(el, dir) el->el_search.patbuf[el->el_search.patlen++] = '*'; #endif el->el_search.patbuf[el->el_search.patlen] = '\0'; - if (el->el_line.cursor < el->el_line.buffer || + if (el->el_line.cursor < el->el_line.buffer || el->el_line.cursor > el->el_line.lastchar || - (ret = ce_search_line(el, &el->el_search.patbuf[1], + (ret = ce_search_line(el, &el->el_search.patbuf[1], newdir)) == CC_ERROR) { /* avoid c_setpat */ - el->el_state.lastcmd = (el_action_t) newdir; + el->el_state.lastcmd = (el_action_t) newdir; ret = newdir == ED_SEARCH_PREV_HISTORY ? - ed_search_prev_history(el, 0) : + ed_search_prev_history(el, 0) : ed_search_next_history(el, 0); if (ret != CC_ERROR) { el->el_line.cursor = newdir == ED_SEARCH_PREV_HISTORY ? el->el_line.lastchar : el->el_line.buffer; - (void) ce_search_line(el, &el->el_search.patbuf[1], + (void) ce_search_line(el, &el->el_search.patbuf[1], newdir); } } @@ -386,7 +386,7 @@ ce_inc_search(el, dir) ret = ce_inc_search(el, newdir); - if (ret == CC_ERROR && pchar == '?' && oldpchar == ':') + if (ret == CC_ERROR && pchar == '?' && oldpchar == ':') /* break abort of failed search at last non-failed */ ret = CC_NORM; @@ -484,7 +484,7 @@ cv_search(el, dir) } el->el_state.lastcmd = (el_action_t) dir; /* avoid c_setpat */ el->el_line.cursor = el->el_line.lastchar = el->el_line.buffer; - if ((dir == ED_SEARCH_PREV_HISTORY ? ed_search_prev_history(el, 0) : + if ((dir == ED_SEARCH_PREV_HISTORY ? ed_search_prev_history(el, 0) : ed_search_next_history(el, 0)) == CC_ERROR) { re_refresh(el); return CC_ERROR; @@ -522,7 +522,7 @@ ce_search_line(el, pattern, dir) } return CC_ERROR; } else { - for (cp = el->el_line.cursor; *cp != '\0' && + for (cp = el->el_line.cursor; *cp != '\0' && cp < el->el_line.limit; cp++) if (el_match(cp, pattern)) { el->el_line.cursor = cp; @@ -542,7 +542,7 @@ cv_repeat_srch(el, c) int c; { #ifdef SDEBUG - (void) fprintf(el->el_errfile, "dir %d patlen %d patbuf %s\n", + (void) fprintf(el->el_errfile, "dir %d patlen %d patbuf %s\n", c, el->el_search.patlen, el->el_search.patbuf); #endif @@ -572,9 +572,9 @@ cv_csearch_back(el, ch, count, tflag) cp = el->el_line.cursor; while (count--) { - if (*cp == ch) + if (*cp == ch) cp--; - while (cp > el->el_line.buffer && *cp != ch) + while (cp > el->el_line.buffer && *cp != ch) cp--; } @@ -609,9 +609,9 @@ cv_csearch_fwd(el, ch, count, tflag) cp = el->el_line.cursor; while (count--) { - if(*cp == ch) + if(*cp == ch) cp++; - while (cp < el->el_line.lastchar && *cp != ch) + while (cp < el->el_line.lastchar && *cp != ch) cp++; } diff --git a/lib/libedit/search.h b/lib/libedit/search.h index 51c58b4..346b38c 100644 --- a/lib/libedit/search.h +++ b/lib/libedit/search.h @@ -39,8 +39,8 @@ /* * el.search.h: Line and history searching utilities */ -#ifndef _h_el_search -#define _h_el_search +#ifndef _h_el_search +#define _h_el_search #include "histedit.h" diff --git a/lib/libedit/sig.c b/lib/libedit/sig.c index 94ab4bb..a16f5f1 100644 --- a/lib/libedit/sig.c +++ b/lib/libedit/sig.c @@ -91,7 +91,7 @@ sig_handler(signo) break; } - for (i = 0; sighdl[i] != -1; i++) + for (i = 0; sighdl[i] != -1; i++) if (signo == sighdl[i]) break; @@ -120,7 +120,7 @@ sig_init(el) #define SIGSIZE (sizeof(sighdl) / sizeof(sighdl[0]) * sizeof(sig_t)) el->el_signal = (sig_t *) el_malloc(SIGSIZE); - for (i = 0; sighdl[i] != -1; i++) + for (i = 0; sighdl[i] != -1; i++) el->el_signal[i] = BADSIG; (void) sigprocmask(SIG_SETMASK, &oset, NULL); @@ -184,7 +184,7 @@ sig_clr(el) #undef _DO (void) sigprocmask(SIG_BLOCK, &nset, &oset); - for (i = 0; sighdl[i] != -1; i++) + for (i = 0; sighdl[i] != -1; i++) if (el->el_signal[i] != BADSIG) (void) signal(sighdl[i], el->el_signal[i]); diff --git a/lib/libedit/term.c b/lib/libedit/term.c index 053f052..8d641f0 100644 --- a/lib/libedit/term.c +++ b/lib/libedit/term.c @@ -177,7 +177,7 @@ private struct termcapstr { { "ho", "home cursor" }, #define T_ic 13 { "ic", "insert character" }, -#define T_im 14 +#define T_im 14 { "im", "start insert mode" }, #define T_ip 15 { "ip", "insert padding" }, @@ -251,7 +251,7 @@ private void term_rebuffer_display __P((EditLine *)); private void term_free_display __P((EditLine *)); private void term_alloc_display __P((EditLine *)); private void term_alloc __P((EditLine *, - struct termcapstr *, char *)); + struct termcapstr *, char *)); private void term_init_arrow __P((EditLine *)); private void term_reset_arrow __P((EditLine *)); @@ -267,7 +267,7 @@ term_setflags(el) EditLine *el; { EL_FLAGS = 0; - if (el->el_tty.t_tabs) + if (el->el_tty.t_tabs) EL_FLAGS |= (Val(T_pt) && !Val(T_xt)) ? TERM_CAN_TAB : 0; EL_FLAGS |= (Val(T_km) || Val(T_MT)) ? TERM_HAS_META : 0; @@ -485,7 +485,7 @@ term_free_display(el) protected void term_move_to_line(el, where) EditLine *el; - int where; + int where; { int del, i; @@ -494,7 +494,7 @@ term_move_to_line(el, where) if (where > el->el_term.t_size.v) { #ifdef DEBUG_SCREEN - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "term_move_to_line: where is ridiculous: %d\r\n", where); #endif /* DEBUG_SCREEN */ return; @@ -538,7 +538,7 @@ mc_again: if (where > (el->el_term.t_size.h + 1)) { #ifdef DEBUG_SCREEN - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "term_move_to_char: where is riduculous: %d\r\n", where); #endif /* DEBUG_SCREEN */ return; @@ -563,7 +563,7 @@ mc_again: if (EL_CAN_TAB) { /* if I can do tabs, use them */ if ((el->el_cursor.h & 0370) != (where & 0370)) { /* if not within tab stop */ - for (i = (el->el_cursor.h & 0370); + for (i = (el->el_cursor.h & 0370); i < (where & 0370); i += 8) term__putc('\t'); /* then tab over */ el->el_cursor.h = where & 0370; @@ -572,8 +572,8 @@ mc_again: /* it's usually cheaper to just write the chars, so we do. */ /* NOTE THAT term_overwrite() WILL CHANGE el->el_cursor.h!!! */ - term_overwrite(el, - &el->el_display[el->el_cursor.v][el->el_cursor.h], + term_overwrite(el, + &el->el_display[el->el_cursor.v][el->el_cursor.h], where - el->el_cursor.h); } @@ -644,7 +644,7 @@ term_deletechars(el, num) if (num > el->el_term.t_size.h) { #ifdef DEBUG_SCREEN - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "term_deletechars: num is riduculous: %d\r\n", num); #endif /* DEBUG_SCREEN */ return; @@ -669,11 +669,11 @@ term_deletechars(el, num) /* term_insertwrite(): - * Puts terminal in insert character mode or inserts num - * characters in the line + * Puts terminal in insert character mode or inserts num + * characters in the line */ protected void -term_insertwrite(el, cp, num) +term_insertwrite(el, cp, num) EditLine *el; char *cp; int num; @@ -705,7 +705,7 @@ term_insertwrite(el, cp, num) (void) tputs(Str(T_im), 1, term__putc); el->el_cursor.h += num; - do + do term__putc(*cp++); while (--num); @@ -732,10 +732,10 @@ term_insertwrite(el, cp, num) /* term_clear_EOL(): - * clear to end of line. There are num characters to clear + * clear to end of line. There are num characters to clear */ protected void -term_clear_EOL(el, num) +term_clear_EOL(el, num) EditLine *el; int num; { @@ -752,7 +752,7 @@ term_clear_EOL(el, num) /* term_clear_screen(): - * Clear the screen + * Clear the screen */ protected void term_clear_screen(el) @@ -839,14 +839,14 @@ term_set(el, term) i = tgetent(el->el_term.t_cap, term); if (i <= 0) { - if (i == -1) + if (i == -1) #ifdef __FreeBSD__ (void) fprintf(el->el_errfile, "Cannot open /usr/share/misc/termcap.\n"); #else (void) fprintf(el->el_errfile, "Cannot open /etc/termcap.\n"); #endif - else if (i == 0) - (void) fprintf(el->el_errfile, + else if (i == 0) + (void) fprintf(el->el_errfile, "No entry for terminal type \"%s\"\n", term); (void) fprintf(el->el_errfile, "using dumb terminal settings.\n"); Val(T_co) = 80; /* do a dumb terminal */ @@ -889,7 +889,7 @@ term_set(el, term) /* term_get_size(): * Return the new window size in lines and cols, and - * true if the size was changed. + * true if the size was changed. */ protected int term_get_size(el, lins, cols) @@ -977,7 +977,7 @@ term_init_arrow(el) * Reset arrow key bindings */ private void -term_reset_arrow(el) +term_reset_arrow(el) EditLine *el; { fkey_t *arrow = el->el_term.t_fkey; @@ -1101,8 +1101,8 @@ term_bind_arrow(el) /* * Assign the arrow keys only if: * - * 1. They are multi-character arrow keys and the user - * has not re-assigned the leading character, or + * 1. They are multi-character arrow keys and the user + * has not re-assigned the leading character, or * has re-assigned the leading character to be * ED_SEQUENCE_LEAD_IN * 2. They are single arrow keys pointing to an unassigned key. @@ -1110,7 +1110,7 @@ term_bind_arrow(el) if (arrow[i].type == XK_NOD) key_clear(el, map, p); else { - if (p[1] && (dmap[j] == map[j] || + if (p[1] && (dmap[j] == map[j] || map[j] == ED_SEQUENCE_LEAD_IN)) { key_add(el, p, &arrow[i].fun, arrow[i].type); map[j] = ED_SEQUENCE_LEAD_IN; @@ -1167,21 +1167,21 @@ term_telltc(el, argc, argv) (void) fprintf(el->el_outfile, "\tfollowing characteristics:\n\n"); (void) fprintf(el->el_outfile, "\tIt has %d columns and %d lines\n", Val(T_co), Val(T_li)); - (void) fprintf(el->el_outfile, + (void) fprintf(el->el_outfile, "\tIt has %s meta key\n", EL_HAS_META ? "a" : "no"); - (void) fprintf(el->el_outfile, + (void) fprintf(el->el_outfile, "\tIt can%suse tabs\n", EL_CAN_TAB ? " " : "not "); #ifdef notyet - (void) fprintf(el->el_outfile, "\tIt %s automatic margins\n", + (void) fprintf(el->el_outfile, "\tIt %s automatic margins\n", (T_Margin&MARGIN_AUTO)? "has": "does not have"); if (T_Margin & MARGIN_AUTO) - (void) fprintf(el->el_outfile, "\tIt %s magic margins\n", + (void) fprintf(el->el_outfile, "\tIt %s magic margins\n", (T_Margin&MARGIN_MAGIC)?"has":"does not have"); #endif for (t = tstr, ts = el->el_term.t_str; t->name != NULL; t++, ts++) - (void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n", t->long_name, - t->name, *ts && **ts ? + (void) fprintf(el->el_outfile, "\t%25s (%s) == %s\n", t->long_name, + t->name, *ts && **ts ? key__decode_str(*ts, upbuf, "") : "(empty)"); (void) fputc('\n', el->el_outfile); return 0; @@ -1229,7 +1229,7 @@ term_settc(el, argc, argv) break; if (tv->name != NULL) { - if (tv == &tval[T_pt] || tv == &tval[T_km] + if (tv == &tval[T_pt] || tv == &tval[T_km] #ifdef notyet || tv == &tval[T_am] || tv == &tval[T_xn] #endif @@ -1309,12 +1309,12 @@ term_echotc(el, argc, argv) } #ifdef notyet else if (strcmp(*argv, "xn") == 0) { - (void) fprintf(el->el_outfile, fmts, T_Margin & MARGIN_MAGIC ? + (void) fprintf(el->el_outfile, fmts, T_Margin & MARGIN_MAGIC ? "yes" : "no"); return 0; } else if (strcmp(*argv, "am") == 0) { - (void) fprintf(el->el_outfile, fmts, T_Margin & MARGIN_AUTO ? + (void) fprintf(el->el_outfile, fmts, T_Margin & MARGIN_AUTO ? "yes" : "no"); return 0; } @@ -1339,7 +1339,7 @@ term_echotc(el, argc, argv) return 0; } - /* + /* * Try to use our local definition first */ scap = NULL; @@ -1352,7 +1352,7 @@ term_echotc(el, argc, argv) scap = tgetstr(*argv, &area); if (!scap || scap[0] == '\0') { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Termcap parameter `%s' not found.\n", *argv); return -1; } @@ -1383,7 +1383,7 @@ term_echotc(el, argc, argv) * hpux has lot's of them... */ if (verbose) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: unknown termcap %% `%c'.\n", *cap); /* This is bad, but I won't complain */ break; @@ -1394,7 +1394,7 @@ term_echotc(el, argc, argv) argv++; if (*argv && *argv[0]) { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: Extra argument `%s'.\n", *argv); return -1; } @@ -1404,7 +1404,7 @@ term_echotc(el, argc, argv) argv++; if (!*argv || *argv[0] == '\0') { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: Missing argument.\n"); return -1; } @@ -1413,7 +1413,7 @@ term_echotc(el, argc, argv) argv++; if (*argv && *argv[0]) { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: Extra argument `%s'.\n", *argv); return -1; } @@ -1422,15 +1422,15 @@ term_echotc(el, argc, argv) default: /* This is wrong, but I will ignore it... */ if (verbose) - (void) fprintf(el->el_errfile, - "echotc: Warning: Too many required arguments (%d).\n", + (void) fprintf(el->el_errfile, + "echotc: Warning: Too many required arguments (%d).\n", arg_need); /*FALLTHROUGH*/ case 2: argv++; if (!*argv || *argv[0] == '\0') { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: Missing argument.\n"); return -1; } @@ -1438,7 +1438,7 @@ term_echotc(el, argc, argv) argv++; if (!*argv || *argv[0] == '\0') { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: Missing argument.\n"); return -1; } @@ -1446,7 +1446,7 @@ term_echotc(el, argc, argv) argv++; if (*argv && *argv[0]) { if (!silent) - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "echotc: Warning: Extra argument `%s'.\n", *argv); return -1; } diff --git a/lib/libedit/term.h b/lib/libedit/term.h index 416e73e..26da7c3 100644 --- a/lib/libedit/term.h +++ b/lib/libedit/term.h @@ -92,7 +92,7 @@ protected int term_init __P((EditLine *)); protected void term_bind_arrow __P((EditLine *)); protected void term_print_arrow __P((EditLine *, char *)); protected int term_clear_arrow __P((EditLine *, char *)); -protected int term_set_arrow __P((EditLine *, char *, +protected int term_set_arrow __P((EditLine *, char *, key_value_t *, int)); protected void term_end __P((EditLine *)); protected int term_set __P((EditLine *, char *)); diff --git a/lib/libedit/tokenizer.c b/lib/libedit/tokenizer.c index 41095fa..bbe847e 100644 --- a/lib/libedit/tokenizer.c +++ b/lib/libedit/tokenizer.c @@ -155,7 +155,7 @@ tok_end(tok) * 3: Quoted return * 2: Unmatched double quote * 1: Unmatched single quote - * 0: Ok + * 0: Ok */ public int tok_line(tok, line, argc, argv) @@ -225,7 +225,7 @@ tok_line(tok, line, argc, argv) *tok->wptr++ = *ptr; break; - default: + default: return(-1); } break; @@ -242,7 +242,7 @@ tok_line(tok, line, argc, argv) tok->quote = Q_doubleone;/* Quote next character */ break; - case Q_one: + case Q_one: *tok->wptr++ = *ptr; tok->quote = Q_none; /* Quote this, restore state */ break; @@ -274,7 +274,7 @@ tok_line(tok, line, argc, argv) case Q_double: *tok->wptr++ = *ptr; /* Add the return */ break; - + case Q_doubleone: tok->flags |= TOK_EAT; tok->quote = Q_double; /* Back to double, eat the '\n' */ @@ -377,7 +377,7 @@ tok_line(tok, line, argc, argv) if (tok->argc >= tok->amax - 4) { tok->amax += AINCR; - tok->argv = (char **) tok_realloc(tok->argv, + tok->argv = (char **) tok_realloc(tok->argv, tok->amax * sizeof(char*)); } diff --git a/lib/libedit/tokenizer.h b/lib/libedit/tokenizer.h index d495dc6..86911e1 100644 --- a/lib/libedit/tokenizer.h +++ b/lib/libedit/tokenizer.h @@ -47,7 +47,7 @@ typedef struct tokenizer Tokenizer; Tokenizer *tok_init __P((const char *)); void tok_reset __P((Tokenizer *)); void tok_end __P((Tokenizer *)); -int tok_line __P((Tokenizer *, const char *, +int tok_line __P((Tokenizer *, const char *, int *, char ***)); #endif /* _h_tokenizer */ diff --git a/lib/libedit/tty.c b/lib/libedit/tty.c index ac99843..6fdf5ea 100644 --- a/lib/libedit/tty.c +++ b/lib/libedit/tty.c @@ -38,7 +38,7 @@ static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; #endif /* not lint && not SCCSID */ -/* +/* * tty.c: tty interface stuff */ #include "sys.h" @@ -57,7 +57,7 @@ typedef struct ttymap_t { } ttymap_t; -private ttyperm_t ttyperm = { +private ttyperm_t ttyperm = { { { "iflag:", ICRNL, (INLCR|IGNCR) }, { "oflag:", (OPOST|ONLCR), ONLRET }, @@ -87,8 +87,8 @@ private ttyperm_t ttyperm = { private ttychar_t ttychar = { { - CINTR, CQUIT, CERASE, CKILL, - CEOF, CEOL, CEOL2, CSWTCH, + CINTR, CQUIT, CERASE, CKILL, + CEOF, CEOL, CEOL2, CSWTCH, CDSWTCH, CERASE2, CSTART, CSTOP, CWERASE, CSUSP, CDSUSP, CREPRINT, CDISCARD, CLNEXT, CSTATUS, CPAGE, @@ -96,15 +96,15 @@ private ttychar_t ttychar = { CTIME }, { - CINTR, CQUIT, CERASE, CKILL, - _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, - _POSIX_VDISABLE, CERASE2, CSTART, CSTOP, - _POSIX_VDISABLE, CSUSP, _POSIX_VDISABLE, _POSIX_VDISABLE, - CDISCARD, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, + CINTR, CQUIT, CERASE, CKILL, + _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, + _POSIX_VDISABLE, CERASE2, CSTART, CSTOP, + _POSIX_VDISABLE, CSUSP, _POSIX_VDISABLE, _POSIX_VDISABLE, + CDISCARD, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, _POSIX_VDISABLE, 1, 0 }, - { + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -117,38 +117,38 @@ private ttychar_t ttychar = { private ttymap_t tty_map[] = { #ifdef VERASE - { C_ERASE, VERASE, + { C_ERASE, VERASE, { ED_DELETE_PREV_CHAR, VI_DELETE_PREV_CHAR, ED_PREV_CHAR } }, #endif /* VERASE */ #ifdef VERASE2 - { C_ERASE2, VERASE2, + { C_ERASE2, VERASE2, { ED_DELETE_PREV_CHAR, VI_DELETE_PREV_CHAR, ED_PREV_CHAR } }, #endif /* VERASE2 */ #ifdef VKILL - { C_KILL, VKILL, + { C_KILL, VKILL, { EM_KILL_LINE, VI_KILL_LINE_PREV, ED_UNASSIGNED } }, #endif /* VKILL */ #ifdef VKILL2 - { C_KILL2, VKILL2, + { C_KILL2, VKILL2, { EM_KILL_LINE, VI_KILL_LINE_PREV, ED_UNASSIGNED } }, #endif /* VKILL2 */ #ifdef VEOF - { C_EOF, VEOF, + { C_EOF, VEOF, { EM_DELETE_OR_LIST, VI_LIST_OR_EOF, ED_UNASSIGNED } }, #endif /* VEOF */ #ifdef VWERASE - { C_WERASE, VWERASE, + { C_WERASE, VWERASE, { ED_DELETE_PREV_WORD, ED_DELETE_PREV_WORD, ED_PREV_WORD } }, #endif /* VWERASE */ #ifdef VREPRINT - { C_REPRINT, VREPRINT, + { C_REPRINT, VREPRINT, { ED_REDISPLAY, ED_INSERT, ED_REDISPLAY } }, #endif /* VREPRINT */ #ifdef VLNEXT - { C_LNEXT, VLNEXT, + { C_LNEXT, VLNEXT, { ED_QUOTED_INSERT, ED_QUOTED_INSERT, ED_UNASSIGNED } }, #endif /* VLNEXT */ - { -1, -1, + { -1, -1, { ED_UNASSIGNED, ED_UNASSIGNED, ED_UNASSIGNED } } }; @@ -359,7 +359,7 @@ private ttymodes_t ttymodes[] = { { "extproc",EXTPROC, M_LIN }, # endif /* EXTPROC */ -# if defined(VINTR) +# if defined(VINTR) { "intr", C_SH(C_INTR), M_CHAR }, # endif /* VINTR */ # if defined(VQUIT) @@ -422,7 +422,7 @@ private ttymodes_t ttymodes[] = { # if defined(VPGOFF) { "pgoff", C_SH(C_PGOFF), M_CHAR }, # endif /* VPGOFF */ -# if defined(VKILL2) +# if defined(VKILL2) { "kill2", C_SH(C_KILL2), M_CHAR }, # endif /* VKILL2 */ # if defined(VBRK) @@ -440,7 +440,7 @@ private ttymodes_t ttymodes[] = { #define tty_getty(el, td) tcgetattr((el)->el_infd, (td)) -#define tty_setty(el, td) tcsetattr((el)->el_infd, TCSADRAIN, (td)) +#define tty_setty(el, td) tcsetattr((el)->el_infd, TCSADRAIN, (td)) #define tty__gettabs(td) ((((td)->c_oflag & TAB3) == TAB3) ? 0 : 1) #define tty__geteightbit(td) (((td)->c_cflag & CSIZE) == CS8) @@ -457,14 +457,14 @@ private int tty_setup __P((EditLine *)); /* tty_setup(): * Get the tty parameters and initialize the editing state */ -private int +private int tty_setup(el) EditLine *el; { int rst = 1; if (tty_getty(el, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, + (void) fprintf(el->el_errfile, "tty_setup: tty_getty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return(-1); @@ -509,7 +509,7 @@ tty_setup(el) tty__setchar(&el->el_tty.t_ex, el->el_tty.t_c[EX_IO]); if (tty_setty(el, &el->el_tty.t_ex) == -1) { #ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "tty_setup: tty_setty: %s\n", + (void) fprintf(el->el_errfile, "tty_setup: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return(-1); @@ -580,7 +580,7 @@ private void tty__getchar(td, s) struct termios *td; unsigned char *s; -{ +{ # ifdef VINTR s[C_INTR] = td->c_cc[VINTR]; # endif /* VINTR */ @@ -663,7 +663,7 @@ private void tty__setchar(td, s) struct termios *td; unsigned char *s; -{ +{ # ifdef VINTR td->c_cc[VINTR] = s[C_INTR]; # endif /* VINTR */ @@ -810,7 +810,7 @@ tty_rawmode(el) el->el_tty.t_eight = tty__geteightbit(&el->el_tty.t_ts); el->el_tty.t_speed = tty__getspeed(&el->el_tty.t_ts); - if (tty__getspeed(&el->el_tty.t_ex) != el->el_tty.t_speed || + if (tty__getspeed(&el->el_tty.t_ex) != el->el_tty.t_speed || tty__getspeed(&el->el_tty.t_ed) != el->el_tty.t_speed) { (void) cfsetispeed(&el->el_tty.t_ex, el->el_tty.t_speed); (void) cfsetospeed(&el->el_tty.t_ex, el->el_tty.t_speed); @@ -819,7 +819,7 @@ tty_rawmode(el) } if (tty__cooked_mode(&el->el_tty.t_ts)) { - if (el->el_tty.t_ts.c_cflag != el->el_tty.t_ex.c_cflag) { + if (el->el_tty.t_ts.c_cflag != el->el_tty.t_ex.c_cflag) { el->el_tty.t_ex.c_cflag = el->el_tty.t_ts.c_cflag; el->el_tty.t_ex.c_cflag &= ~el->el_tty.t_t[EX_IO][M_CTL].t_clrmask; el->el_tty.t_ex.c_cflag |= el->el_tty.t_t[EX_IO][M_CTL].t_setmask; @@ -862,9 +862,9 @@ tty_rawmode(el) el->el_tty.t_ed.c_oflag |= el->el_tty.t_t[ED_IO][M_OUT].t_setmask; } - if (tty__gettabs(&el->el_tty.t_ex) == 0) + if (tty__gettabs(&el->el_tty.t_ex) == 0) el->el_tty.t_tabs = 0; - else + else el->el_tty.t_tabs = EL_CAN_TAB ? 1 : 0; { @@ -879,7 +879,7 @@ tty_rawmode(el) for (i = 0; i < C_NCC; i++) if (el->el_tty.t_c[TS_IO][i] != el->el_tty.t_c[EX_IO][i]) break; - + if (i != C_NCC) { /* * Propagate changes only to the unprotected chars @@ -910,7 +910,7 @@ tty_rawmode(el) if (tty_setty(el, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "tty_rawmode: tty_setty: %s\n", + (void) fprintf(el->el_errfile, "tty_rawmode: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return -1; @@ -932,7 +932,7 @@ tty_cookedmode(el) if (tty_setty(el, &el->el_tty.t_ex) == -1) { #ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "tty_cookedmode: tty_setty: %s\n", + (void) fprintf(el->el_errfile, "tty_cookedmode: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return -1; @@ -968,7 +968,7 @@ tty_quotemode(el) if (tty_setty(el, &el->el_tty.t_qu) == -1) { #ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "QuoteModeOn: tty_setty: %s\n", + (void) fprintf(el->el_errfile, "QuoteModeOn: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return -1; @@ -989,7 +989,7 @@ tty_noquotemode(el) return 0; if (tty_setty(el, &el->el_tty.t_ed) == -1) { #ifdef DEBUG_TTY - (void) fprintf(el->el_errfile, "QuoteModeOff: tty_setty: %s\n", + (void) fprintf(el->el_errfile, "QuoteModeOff: tty_setty: %s\n", strerror(errno)); #endif /* DEBUG_TTY */ return -1; @@ -1019,7 +1019,7 @@ tty_stty(el, argc, argv) return -1; name = *argv++; - while (argv && *argv && argv[0][0] == '-' && argv[0][2] == '\0') + while (argv && *argv && argv[0][0] == '-' && argv[0][2] == '\0') switch (argv[0][1]) { case 'a': aflag++; @@ -1048,7 +1048,7 @@ tty_stty(el, argc, argv) int len = 0, st = 0, cu; for (m = ttymodes; m->m_name; m++) { if (m->m_type != i) { - (void) fprintf(el->el_outfile, "%s%s", i != -1 ? "\n" : "", + (void) fprintf(el->el_outfile, "%s%s", i != -1 ? "\n" : "", el->el_tty.t_t[z][m->m_type].t_name); i = m->m_type; st = len = strlen(el->el_tty.t_t[z][m->m_type].t_name); @@ -1065,7 +1065,7 @@ tty_stty(el, argc, argv) (void) fprintf(el->el_outfile, "\n%*s", st, ""); len = st + cu; } - else + else len += cu; if (x != '\0') @@ -1131,7 +1131,7 @@ tty_printchar(el, s) int i; for (i = 0; i < C_NCC; i++) { - for (m = el->el_tty.t_t; m->m_name; m++) + for (m = el->el_tty.t_t; m->m_name; m++) if (m->m_type == M_CHAR && C_SH(i) == m->m_value) break; if (m->m_name) @@ -1139,6 +1139,6 @@ tty_printchar(el, s) if (i % 5 == 0) (void) fprintf(el->el_errfile, "\n"); } - (void) fprintf(el->el_errfile, "\n"); + (void) fprintf(el->el_errfile, "\n"); } #endif /* notyet */ diff --git a/lib/libedit/tty.h b/lib/libedit/tty.h index 12da50d..14ba109 100644 --- a/lib/libedit/tty.h +++ b/lib/libedit/tty.h @@ -46,7 +46,7 @@ #include <termios.h> /* Define our own since everyone gets it wrong! */ -#define CONTROL(A) ((A) & 037) +#define CONTROL(A) ((A) & 037) /* * Aix compatible names @@ -444,7 +444,7 @@ #define M_CHAR 4 #define M_NN 5 -typedef struct { +typedef struct { char *t_name; int t_setmask; int t_clrmask; diff --git a/lib/libedit/vi.c b/lib/libedit/vi.c index 030ee22..1a46780 100644 --- a/lib/libedit/vi.c +++ b/lib/libedit/vi.c @@ -59,7 +59,7 @@ cv_action(el, c) if (el->el_chared.c_vcmd.action & DELETE) { el->el_chared.c_vcmd.action = NOP; el->el_chared.c_vcmd.pos = 0; - + el->el_chared.c_undo.isize = 0; el->el_chared.c_undo.dsize = 0; kp = el->el_chared.c_undo.buf; @@ -67,14 +67,14 @@ cv_action(el, c) *kp++ = *cp; el->el_chared.c_undo.dsize++; } - + el->el_chared.c_undo.action = INSERT; el->el_chared.c_undo.ptr = el->el_line.buffer; el->el_line.lastchar = el->el_line.buffer; el->el_line.cursor = el->el_line.buffer; if (c & INSERT) el->el_map.current = el->el_map.key; - + return CC_REFRESH; } @@ -111,7 +111,7 @@ cv_paste(el, c) char *ptr; c_undo_t *un = &el->el_chared.c_undo; #ifdef DEBUG_PASTE - (void) fprintf(el->el_errfile, "Paste: %x \"%s\" +%d -%d\n", + (void) fprintf(el->el_errfile, "Paste: %x \"%s\" +%d -%d\n", un->action, un->buf, un->isize, un->dsize); #endif if (un->isize == 0) @@ -120,7 +120,7 @@ cv_paste(el, c) if (!c && el->el_line.cursor < el->el_line.lastchar) el->el_line.cursor++; ptr = el->el_line.cursor; - + c_insert(el, un->isize); if (el->el_line.cursor + un->isize > el->el_line.lastchar) return CC_ERROR; @@ -129,7 +129,7 @@ cv_paste(el, c) } -/* vi_paste_next(): +/* vi_paste_next(): * Vi paste previous deletion to the right of the cursor * [p] */ @@ -143,7 +143,7 @@ vi_paste_next(el, c) } -/* vi_paste_prev(): +/* vi_paste_prev(): * Vi paste previous deletion to the left of the cursor * [P] */ @@ -157,7 +157,7 @@ vi_paste_prev(el, c) } -/* vi_prev_space_word(): +/* vi_prev_space_word(): * Vi move to the previous space delimited word * [B] */ @@ -170,10 +170,10 @@ vi_prev_space_word(el, c) if (el->el_line.cursor == el->el_line.buffer) return CC_ERROR; - el->el_line.cursor = cv_prev_word(el, el->el_line.cursor, - el->el_line.buffer, - el->el_state.argument, - cv__isword); + el->el_line.cursor = cv_prev_word(el, el->el_line.cursor, + el->el_line.buffer, + el->el_state.argument, + cv__isword); if (el->el_chared.c_vcmd.action & DELETE) { cv_delfini(el); @@ -184,7 +184,7 @@ vi_prev_space_word(el, c) } -/* vi_prev_word(): +/* vi_prev_word(): * Vi move to the previous word * [B] */ @@ -197,10 +197,10 @@ vi_prev_word(el, c) if (el->el_line.cursor == el->el_line.buffer) return CC_ERROR; - el->el_line.cursor = cv_prev_word(el, el->el_line.cursor, - el->el_line.buffer, - el->el_state.argument, - ce__isword); + el->el_line.cursor = cv_prev_word(el, el->el_line.cursor, + el->el_line.buffer, + el->el_state.argument, + ce__isword); if (el->el_chared.c_vcmd.action & DELETE) { cv_delfini(el); @@ -211,7 +211,7 @@ vi_prev_word(el, c) } -/* vi_next_space_word(): +/* vi_next_space_word(): * Vi move to the next space delimited word * [W] */ @@ -224,9 +224,9 @@ vi_next_space_word(el, c) if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; - el->el_line.cursor = cv_next_word(el, el->el_line.cursor, - el->el_line.lastchar, - el->el_state.argument, + el->el_line.cursor = cv_next_word(el, el->el_line.cursor, + el->el_line.lastchar, + el->el_state.argument, cv__isword); if (el->el_map.type == MAP_VI) @@ -238,7 +238,7 @@ vi_next_space_word(el, c) return CC_CURSOR; } -/* vi_next_word(): +/* vi_next_word(): * Vi move to the next word * [w] */ @@ -251,8 +251,8 @@ vi_next_word(el, c) if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; - el->el_line.cursor = cv_next_word(el, el->el_line.cursor, - el->el_line.lastchar, + el->el_line.cursor = cv_next_word(el, el->el_line.cursor, + el->el_line.lastchar, el->el_state.argument, ce__isword); @@ -267,7 +267,7 @@ vi_next_word(el, c) -/* vi_change_case(): +/* vi_change_case(): * Vi change case of character under the cursor and advance one character * [~] */ @@ -291,7 +291,7 @@ vi_change_case(el, c) } -/* vi_change_meta(): +/* vi_change_meta(): * Vi change prefix command * [c] */ @@ -309,7 +309,7 @@ vi_change_meta(el, c) } -/* vi_insert_at_bol(): +/* vi_insert_at_bol(): * Vi enter insert mode at the beginning of line * [I] */ @@ -330,7 +330,7 @@ vi_insert_at_bol(el, c) } -/* vi_replace_char(): +/* vi_replace_char(): * Vi replace character under the cursor with the next character typed * [r] */ @@ -350,7 +350,7 @@ vi_replace_char(el, c) } -/* vi_replace_mode(): +/* vi_replace_mode(): * Vi enter replace mode * [R] */ @@ -370,7 +370,7 @@ vi_replace_mode(el, c) } -/* vi_substitute_char(): +/* vi_substitute_char(): * Vi replace character under the cursor and enter insert mode * [r] */ @@ -386,7 +386,7 @@ vi_substitute_char(el, c) } -/* vi_substitute_line(): +/* vi_substitute_line(): * Vi substitute entire line * [S] */ @@ -402,7 +402,7 @@ vi_substitute_line(el, c) } -/* vi_change_to_eol(): +/* vi_change_to_eol(): * Vi change to end of line * [C] */ @@ -439,7 +439,7 @@ vi_insert(el, c) /* vi_add(): - * Vi enter insert mode after the cursor + * Vi enter insert mode after the cursor * [a] */ protected el_action_t @@ -481,7 +481,7 @@ vi_add_at_eol(el, c) el->el_line.cursor = el->el_line.lastchar; /* Mark where insertion begins */ - el->el_chared.c_vcmd.ins = el->el_line.lastchar; + el->el_chared.c_vcmd.ins = el->el_line.lastchar; el->el_chared.c_undo.ptr = el->el_line.lastchar; el->el_chared.c_undo.action = DELETE; return CC_CURSOR; @@ -489,7 +489,7 @@ vi_add_at_eol(el, c) /* vi_delete_meta(): - * Vi delete prefix command + * Vi delete prefix command * [d] */ protected el_action_t @@ -503,8 +503,8 @@ vi_delete_meta(el, c) /* vi_end_word(): - * Vi move to the end of the current space delimited word - * [E] + * Vi move to the end of the current space delimited word + * [E] */ protected el_action_t /*ARGSUSED*/ @@ -515,7 +515,7 @@ vi_end_word(el, c) if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; - el->el_line.cursor = cv__endword(el->el_line.cursor, el->el_line.lastchar, + el->el_line.cursor = cv__endword(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument); if (el->el_chared.c_vcmd.action & DELETE) { @@ -541,7 +541,7 @@ vi_to_end_word(el, c) if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; - el->el_line.cursor = cv__endword(el->el_line.cursor, el->el_line.lastchar, + el->el_line.cursor = cv__endword(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument); if (el->el_chared.c_vcmd.action & DELETE) { @@ -570,12 +570,12 @@ vi_undo(el, c) c_undo_t *un = &el->el_chared.c_undo; #ifdef DEBUG_UNDO - (void) fprintf(el->el_errfile, "Undo: %x \"%s\" +%d -%d\n", + (void) fprintf(el->el_errfile, "Undo: %x \"%s\" +%d -%d\n", un->action, un->buf, un->isize, un->dsize); #endif switch (un->action) { case DELETE: - if (un->dsize == 0) + if (un->dsize == 0) return CC_NORM; (void) memcpy(un->buf, un->ptr, un->dsize); @@ -584,7 +584,7 @@ vi_undo(el, c) el->el_line.lastchar -= un->dsize; el->el_line.cursor = un->ptr; - + un->action = INSERT; un->isize = un->dsize; un->dsize = 0; @@ -592,9 +592,9 @@ vi_undo(el, c) case DELETE|INSERT: size = un->isize - un->dsize; - if (size > 0) + if (size > 0) i = un->dsize; - else + else i = un->isize; cp = un->ptr; kp = un->buf; @@ -627,7 +627,7 @@ vi_undo(el, c) break; case INSERT: - if (un->isize == 0) + if (un->isize == 0) return CC_NORM; el->el_line.cursor = un->ptr; @@ -639,11 +639,11 @@ vi_undo(el, c) break; case CHANGE: - if (un->isize == 0) + if (un->isize == 0) return CC_NORM; el->el_line.cursor = un->ptr; - size = (int) (el->el_line.cursor - el->el_line.lastchar); + size = (int) (el->el_line.cursor - el->el_line.lastchar); if (size < un->isize) size = un->isize; cp = un->ptr; @@ -677,7 +677,7 @@ vi_command_mode(el, c) int size; /* [Esc] cancels pending action */ el->el_chared.c_vcmd.ins = 0; - el->el_chared.c_vcmd.action = NOP; + el->el_chared.c_vcmd.action = NOP; el->el_chared.c_vcmd.pos = 0; el->el_state.doingarg = 0; @@ -700,7 +700,7 @@ vi_command_mode(el, c) } /* vi_zero(): - * Vi move to the beginning of line + * Vi move to the beginning of line * [0] */ protected el_action_t @@ -711,7 +711,7 @@ vi_zero(el, c) if (el->el_state.doingarg) { if (el->el_state.argument > 1000000) return CC_ERROR; - el->el_state.argument = + el->el_state.argument = (el->el_state.argument * 10) + (c - '0'); return CC_ARGHACK; } @@ -727,23 +727,23 @@ vi_zero(el, c) /* vi_delete_prev_char(): - * Vi move to previous character (backspace) + * Vi move to previous character (backspace) * [^H] - */ + */ protected el_action_t /*ARGSUSED*/ vi_delete_prev_char(el, c) EditLine *el; int c; { - if (el->el_chared.c_vcmd.ins == 0) + if (el->el_chared.c_vcmd.ins == 0) return CC_ERROR; - if (el->el_chared.c_vcmd.ins > + if (el->el_chared.c_vcmd.ins > el->el_line.cursor - el->el_state.argument) return CC_ERROR; - c_delbefore(el, el->el_state.argument); + c_delbefore(el, el->el_state.argument); el->el_line.cursor -= el->el_state.argument; return CC_REFRESH; @@ -761,7 +761,7 @@ vi_list_or_eof(el, c) int c; { #ifdef notyet - if (el->el_line.cursor == el->el_line.lastchar && + if (el->el_line.cursor == el->el_line.lastchar && el->el_line.cursor == el->el_line.buffer) { #endif term_overwrite(el, STReof, 4); /* then do a EOF */ @@ -779,7 +779,7 @@ vi_list_or_eof(el, c) /* vi_kill_line_prev(): - * Vi cut from beginning of line to cursor + * Vi cut from beginning of line to cursor * [^U] */ protected el_action_t @@ -839,7 +839,7 @@ vi_repeat_search_next(el, c) EditLine *el; int c; { - if (el->el_search.patlen == 0) + if (el->el_search.patlen == 0) return CC_ERROR; else return cv_repeat_srch(el, el->el_search.patdir); @@ -856,10 +856,10 @@ vi_repeat_search_prev(el, c) EditLine *el; int c; { - if (el->el_search.patlen == 0) + if (el->el_search.patlen == 0) return CC_ERROR; else - return cv_repeat_srch(el, + return cv_repeat_srch(el, el->el_search.patdir == ED_SEARCH_PREV_HISTORY ? ED_SEARCH_NEXT_HISTORY : ED_SEARCH_PREV_HISTORY); } @@ -961,8 +961,8 @@ vi_repeat_next_char(el, c) if (el->el_search.chacha == 0) return CC_ERROR; - return el->el_search.chadir == CHAR_FWD ? - cv_csearch_fwd(el, el->el_search.chacha, el->el_state.argument, 0) : + return el->el_search.chadir == CHAR_FWD ? + cv_csearch_fwd(el, el->el_search.chacha, el->el_state.argument, 0) : cv_csearch_back(el, el->el_search.chacha, el->el_state.argument, 0); } @@ -980,7 +980,7 @@ vi_repeat_prev_char(el, c) if (el->el_search.chacha == 0) return CC_ERROR; - return el->el_search.chadir == CHAR_BACK ? - cv_csearch_fwd(el, el->el_search.chacha, el->el_state.argument, 0) : + return el->el_search.chadir == CHAR_BACK ? + cv_csearch_fwd(el, el->el_search.chacha, el->el_state.argument, 0) : cv_csearch_back(el, el->el_search.chacha, el->el_state.argument, 0); } |