The world's most popular open source database
#include <config.h>#include "el.h"Include dependency graph for common.c:

Go to the source code of this file.
Functions | |
| protected el_action_t | ed_end_of_file (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_insert (EditLine *el, int c) |
| protected el_action_t | ed_delete_prev_word (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_delete_next_char (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_kill_line (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_move_to_end (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_move_to_beg (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_transpose_chars (EditLine *el, int c) |
| protected el_action_t | ed_next_char (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_prev_word (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_prev_char (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_quoted_insert (EditLine *el, int c) |
| protected el_action_t | ed_digit (EditLine *el, int c) |
| protected el_action_t | ed_argument_digit (EditLine *el, int c) |
| protected el_action_t | ed_unassigned (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_sigint (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_dsusp (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_flush_output (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_sigquit (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_sigtstp (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_stop_output (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_tty_start_output (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_newline (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_delete_prev_char (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_clear_screen (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_redisplay (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_start_over (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_sequence_lead_in (EditLine *el __attribute__((__unused__)), int c __attribute__((__unused__))) |
| protected el_action_t | ed_prev_history (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_next_history (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_search_prev_history (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_search_next_history (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_prev_line (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_next_line (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t | ed_command (EditLine *el, int c __attribute__((__unused__))) |
| protected el_action_t ed_argument_digit | ( | EditLine * | el, | |
| int | c | |||
| ) |
Definition at line 404 of file common.c.
References el_state_t::argument, CC_ARGHACK, CC_ERROR, el_state_t::doingarg, el, and editline::el_state.
Referenced by vi_zero().
00405 { 00406 00407 if (!isdigit(c)) 00408 return (CC_ERROR); 00409 00410 if (el->el_state.doingarg) { 00411 if (el->el_state.argument > 1000000) 00412 return (CC_ERROR); 00413 el->el_state.argument = (el->el_state.argument * 10) + 00414 (c - '0'); 00415 } else { /* else starting an argument */ 00416 el->el_state.argument = c - '0'; 00417 el->el_state.doingarg = 1; 00418 } 00419 return (CC_ARGHACK); 00420 }
Here is the caller graph for this function:

| protected el_action_t ed_clear_screen | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 580 of file common.c.
References CC_REFRESH, el, re_clear_display(), and term_clear_screen().
00581 { 00582 00583 term_clear_screen(el); /* clear the whole real screen */ 00584 re_clear_display(el); /* reset everything */ 00585 return (CC_REFRESH); 00586 }
Here is the call graph for this function:

| protected el_action_t ed_command | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 901 of file common.c.
References c_gets(), CC_REFRESH, el_map_t::current, el, EL_BUFSIZ, editline::el_map, el_map_t::key, parse_line(), re_clear_display(), term__putc(), and term_beep().
00902 { 00903 char tmpbuf[EL_BUFSIZ]; 00904 int tmplen; 00905 00906 tmplen = c_gets(el, tmpbuf, "\n: "); 00907 term__putc('\n'); 00908 00909 if (tmplen < 0 || (tmpbuf[tmplen] = 0, parse_line(el, tmpbuf)) == -1) 00910 term_beep(el); 00911 00912 el->el_map.current = el->el_map.key; 00913 re_clear_display(el); 00914 return CC_REFRESH; 00915 }
Here is the call graph for this function:

| protected el_action_t ed_delete_next_char | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 133 of file common.c.
References el_state_t::argument, el_line_t::buffer, c_delafter(), CC_EOF, CC_ERROR, CC_REFRESH, el_line_t::cursor, el, editline::el_line, editline::el_map, editline::el_state, el_line_t::lastchar, MAP_VI, STReof, term__flush(), term_overwrite(), and el_map_t::type.
00134 { 00135 #ifdef notdef /* XXX */ 00136 #define EL el->el_line 00137 (void) fprintf(el->el_errlfile, 00138 "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", 00139 EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar, 00140 EL.lastchar, EL.limit, EL.limit); 00141 #endif 00142 if (el->el_line.cursor == el->el_line.lastchar) { 00143 /* if I'm at the end */ 00144 if (el->el_map.type == MAP_VI) { 00145 if (el->el_line.cursor == el->el_line.buffer) { 00146 /* if I'm also at the beginning */ 00147 #ifdef KSHVI 00148 return (CC_ERROR); 00149 #else 00150 term_overwrite(el, STReof, 4); 00151 /* then do a EOF */ 00152 term__flush(); 00153 return (CC_EOF); 00154 #endif 00155 } else { 00156 #ifdef KSHVI 00157 el->el_line.cursor--; 00158 #else 00159 return (CC_ERROR); 00160 #endif 00161 } 00162 } else { 00163 if (el->el_line.cursor != el->el_line.buffer) 00164 el->el_line.cursor--; 00165 else 00166 return (CC_ERROR); 00167 } 00168 } 00169 c_delafter(el, el->el_state.argument); /* delete after dot */ 00170 if (el->el_line.cursor >= el->el_line.lastchar && 00171 el->el_line.cursor > el->el_line.buffer) 00172 /* bounds check */ 00173 el->el_line.cursor = el->el_line.lastchar - 1; 00174 return (CC_REFRESH); 00175 }
Here is the call graph for this function:

| protected el_action_t ed_delete_prev_char | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 560 of file common.c.
References el_state_t::argument, el_line_t::buffer, c_delbefore(), CC_ERROR, CC_REFRESH, el_line_t::cursor, el, editline::el_line, and editline::el_state.
00561 { 00562 00563 if (el->el_line.cursor <= el->el_line.buffer) 00564 return (CC_ERROR); 00565 00566 c_delbefore(el, el->el_state.argument); 00567 el->el_line.cursor -= el->el_state.argument; 00568 if (el->el_line.cursor < el->el_line.buffer) 00569 el->el_line.cursor = el->el_line.buffer; 00570 return (CC_REFRESH); 00571 }
Here is the call graph for this function:

| protected el_action_t ed_delete_prev_word | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 105 of file common.c.
References el_state_t::argument, c_kill_t::buf, el_line_t::buffer, c__prev_word(), c_delbefore(), el_chared_t::c_kill, CC_ERROR, CC_REFRESH, ce__isword(), lineinfo::cursor, el_line_t::cursor, el, editline::el_chared, el_line(), editline::el_line, editline::el_state, c_kill_t::last, and p.
00106 { 00107 char *cp, *p, *kp; 00108 00109 if (el->el_line.cursor == el->el_line.buffer) 00110 return (CC_ERROR); 00111 00112 cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, 00113 el->el_state.argument, ce__isword); 00114 00115 for (p = cp, kp = el->el_chared.c_kill.buf; p < el->el_line.cursor; p++) 00116 *kp++ = *p; 00117 el->el_chared.c_kill.last = kp; 00118 00119 c_delbefore(el, el->el_line.cursor - cp); /* delete before dot */ 00120 el->el_line.cursor = cp; 00121 if (el->el_line.cursor < el->el_line.buffer) 00122 el->el_line.cursor = el->el_line.buffer; /* bounds check */ 00123 return (CC_REFRESH); 00124 }
Here is the call graph for this function:

| protected el_action_t ed_digit | ( | EditLine * | el, | |
| int | c | |||
| ) |
Definition at line 376 of file common.c.
References el_state_t::argument, CC_ARGHACK, CC_ERROR, el_state_t::doingarg, ed_insert(), el, editline::el_state, and el_state_t::lastcmd.
00377 { 00378 00379 if (!isdigit(c)) 00380 return (CC_ERROR); 00381 00382 if (el->el_state.doingarg) { 00383 /* if doing an arg, add this in... */ 00384 if (el->el_state.lastcmd == EM_UNIVERSAL_ARGUMENT) 00385 el->el_state.argument = c - '0'; 00386 else { 00387 if (el->el_state.argument > 1000000) 00388 return (CC_ERROR); 00389 el->el_state.argument = 00390 (el->el_state.argument * 10) + (c - '0'); 00391 } 00392 return (CC_ARGHACK); 00393 } 00394 00395 return ed_insert(el, c); 00396 }
Here is the call graph for this function:

| protected el_action_t ed_end_of_file | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 48 of file common.c.
References CC_EOF, el, editline::el_line, el_line_t::lastchar, and re_goto_bottom().
Referenced by c_gets(), ce_inc_search(), cv_csearch(), and ed_quoted_insert().
00049 { 00050 00051 re_goto_bottom(el); 00052 *el->el_line.lastchar = '\0'; 00053 return (CC_EOF); 00054 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected el_action_t ed_insert | ( | EditLine * | el, | |
| int | c | |||
| ) |
Definition at line 62 of file common.c.
References el_state_t::argument, c_insert(), CC_ERROR, CC_NORM, ch_enlargebufs(), count, el_line_t::cursor, el, editline::el_line, editline::el_state, el_state_t::inputmode, el_line_t::lastchar, el_line_t::limit, MODE_INSERT, MODE_REPLACE_1, re_fastaddc(), re_refresh(), and vi_command_mode().
Referenced by ed_digit(), and ed_quoted_insert().
00063 { 00064 int count = el->el_state.argument; 00065 00066 if (c == '\0') 00067 return (CC_ERROR); 00068 00069 if (el->el_line.lastchar + el->el_state.argument >= 00070 el->el_line.limit) { 00071 /* end of buffer space, try to allocate more */ 00072 if (!ch_enlargebufs(el, (size_t) count)) 00073 return CC_ERROR; /* error allocating more */ 00074 } 00075 00076 if (count == 1) { 00077 if (el->el_state.inputmode == MODE_INSERT 00078 || el->el_line.cursor >= el->el_line.lastchar) 00079 c_insert(el, 1); 00080 00081 *el->el_line.cursor++ = c; 00082 re_fastaddc(el); /* fast refresh for one char. */ 00083 } else { 00084 if (el->el_state.inputmode != MODE_REPLACE_1) 00085 c_insert(el, el->el_state.argument); 00086 00087 while (count-- && el->el_line.cursor < el->el_line.lastchar) 00088 *el->el_line.cursor++ = c; 00089 re_refresh(el); 00090 } 00091 00092 if (el->el_state.inputmode == MODE_REPLACE_1) 00093 return vi_command_mode(el, 0); 00094 00095 return (CC_NORM); 00096 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected el_action_t ed_kill_line | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 184 of file common.c.
References c_kill_t::buf, el_chared_t::c_kill, CC_REFRESH, el_line_t::cursor, el, editline::el_chared, el_line(), editline::el_line, c_kill_t::last, el_line_t::lastchar, and lineinfo::lastchar.
Referenced by vi_change_to_eol().
00185 { 00186 char *kp, *cp; 00187 00188 cp = el->el_line.cursor; 00189 kp = el->el_chared.c_kill.buf; 00190 while (cp < el->el_line.lastchar) 00191 *kp++ = *cp++; /* copy it */ 00192 el->el_chared.c_kill.last = kp; 00193 /* zap! -- delete to end */ 00194 el->el_line.lastchar = el->el_line.cursor; 00195 return (CC_REFRESH); 00196 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected el_action_t ed_move_to_beg | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 228 of file common.c.
References c_vcmd_t::action, el_line_t::buffer, el_chared_t::c_vcmd, CC_CURSOR, CC_REFRESH, el_line_t::cursor, cv_delfini(), el, editline::el_chared, editline::el_line, editline::el_map, MAP_VI, NOP, and el_map_t::type.
00229 { 00230 00231 el->el_line.cursor = el->el_line.buffer; 00232 00233 if (el->el_map.type == MAP_VI) { 00234 /* We want FIRST non space character */ 00235 while (isspace((unsigned char) *el->el_line.cursor)) 00236 el->el_line.cursor++; 00237 if (el->el_chared.c_vcmd.action != NOP) { 00238 cv_delfini(el); 00239 return (CC_REFRESH); 00240 } 00241 } 00242 return (CC_CURSOR); 00243 }
Here is the call graph for this function:

| protected el_action_t ed_move_to_end | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 205 of file common.c.
References c_vcmd_t::action, el_chared_t::c_vcmd, CC_CURSOR, CC_REFRESH, el_line_t::cursor, cv_delfini(), el, editline::el_chared, editline::el_line, editline::el_map, el_line_t::lastchar, MAP_VI, NOP, and el_map_t::type.
00206 { 00207 00208 el->el_line.cursor = el->el_line.lastchar; 00209 if (el->el_map.type == MAP_VI) { 00210 #ifdef VI_MOVE 00211 el->el_line.cursor--; 00212 #endif 00213 if (el->el_chared.c_vcmd.action != NOP) { 00214 cv_delfini(el); 00215 return (CC_REFRESH); 00216 } 00217 } 00218 return (CC_CURSOR); 00219 }
Here is the call graph for this function:

| protected el_action_t ed_newline | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 544 of file common.c.
References CC_NEWLINE, el, editline::el_line, el_line_t::lastchar, and re_goto_bottom().
Referenced by cv_search(), vi_comment_out(), and vi_histedit().
00545 { 00546 00547 re_goto_bottom(el); 00548 *el->el_line.lastchar++ = '\n'; 00549 *el->el_line.lastchar = '\0'; 00550 return (CC_NEWLINE); 00551 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected el_action_t ed_next_char | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 277 of file common.c.
References c_vcmd_t::action, el_state_t::argument, el_chared_t::c_vcmd, CC_CURSOR, CC_ERROR, CC_REFRESH, el_line_t::cursor, cv_delfini(), el, editline::el_chared, editline::el_line, editline::el_map, editline::el_state, el_line_t::lastchar, MAP_VI, NOP, and el_map_t::type.
Referenced by vi_to_column().
00278 { 00279 char *lim = el->el_line.lastchar; 00280 00281 if (el->el_line.cursor >= lim || 00282 (el->el_line.cursor == lim - 1 && 00283 el->el_map.type == MAP_VI && 00284 el->el_chared.c_vcmd.action == NOP)) 00285 return (CC_ERROR); 00286 00287 el->el_line.cursor += el->el_state.argument; 00288 if (el->el_line.cursor > lim) 00289 el->el_line.cursor = lim; 00290 00291 if (el->el_map.type == MAP_VI) 00292 if (el->el_chared.c_vcmd.action != NOP) { 00293 cv_delfini(el); 00294 return (CC_REFRESH); 00295 } 00296 return (CC_CURSOR); 00297 }
Here is the call graph for this function:

Here is the caller graph for this function:

| protected el_action_t ed_next_history | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 675 of file common.c.
References el_state_t::argument, el_chared_t::c_undo, CC_REFRESH, CC_REFRESH_BEEP, el, editline::el_chared, editline::el_history, editline::el_line, editline::el_state, el_history_t::eventno, hist_get(), el_line_t::lastchar, and c_undo_t::len.
00676 { 00677 el_action_t beep = CC_REFRESH, rval; 00678 00679 el->el_chared.c_undo.len = -1; 00680 *el->el_line.lastchar = '\0'; /* just in case */ 00681 00682 el->el_history.eventno -= el->el_state.argument; 00683 00684 if (el->el_history.eventno < 0) { 00685 el->el_history.eventno = 0; 00686 beep = CC_REFRESH_BEEP; 00687 } 00688 rval = hist_get(el); 00689 if (rval == CC_REFRESH) 00690 return beep; 00691 return rval; 00692 00693 }
Here is the call graph for this function:

| protected el_action_t ed_next_line | ( | EditLine * | el, | |
| int c | __attribute__((__unused__)) | |||
| ) |
Definition at line 867 of file

