From: Benno Schulenberg Date: Mon, 30 Jun 2014 18:04:33 +0000 (+0000) Subject: Making 'meta_key' and 'func_key' into global variables, instead of X-Git-Tag: v2.3.5~21 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=7e5324d1646c03b481175f638ca31519d0c8a447;p=nano.git Making 'meta_key' and 'func_key' into global variables, instead of having them declared everywhere and passing them around endlessly. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5039 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index d9dcaf70..638d848b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,8 @@ with --ignorercfiles, do not try to find one, because that would lead to the magic database being searched, which slows down startup a lot. * src/color.c (color_update): Move some variables to a better place. + * src/*: Make 'meta_key' and 'func_key' into global variables, instead + of having them declared everywhere and passing them around endlessly. 2014-06-29 Benno Schulenberg * src/rcfile.c: Fix compilation with --enable-tiny --enable-nanorc. diff --git a/src/browser.c b/src/browser.c index dfbb32ec..8d1d5eba 100644 --- a/src/browser.c +++ b/src/browser.c @@ -50,7 +50,7 @@ char *do_browser(char *path, DIR *dir) { char *retval = NULL; int kbinput; - bool meta_key, func_key, old_const_update = ISSET(CONST_UPDATE); + bool old_const_update = ISSET(CONST_UPDATE); char *prev_dir = NULL; /* The directory we were in, if any, before backing up via * browsing to "..". */ @@ -122,7 +122,7 @@ char *do_browser(char *path, DIR *dir) old_selected = selected; - kbinput = get_kbinput(edit, &meta_key, &func_key); + kbinput = get_kbinput(edit); #ifndef DISABLE_MOUSE if (kbinput == KEY_MOUSE) { @@ -158,8 +158,8 @@ char *do_browser(char *path, DIR *dir) } #endif /* !DISABLE_MOUSE */ - parse_browser_input(&kbinput, &meta_key); - s = get_shortcut(MBROWSER, &kbinput, &meta_key); + parse_browser_input(&kbinput); + s = get_shortcut(MBROWSER, &kbinput); if (!s) continue; f = sctofunc((sc *) s); @@ -204,7 +204,6 @@ char *do_browser(char *path, DIR *dir) FALSE, #endif MGOTODIR, ans, - &meta_key, &func_key, #ifndef DISABLE_HISTORIES NULL, #endif @@ -529,9 +528,9 @@ void browser_init(const char *path, DIR *dir) /* Convert certain non-shortcut keys into their corresponding shortcut * sequences, for compatibility with Pico. */ -void parse_browser_input(int *kbinput, bool *meta_key) +void parse_browser_input(int *kbinput) { - if (!*meta_key) { + if (!meta_key) { switch (*kbinput) { case ' ': *kbinput = KEY_NPAGE; @@ -741,7 +740,6 @@ int filesearch_init(void) { int i = 0; char *buf; - bool meta_key, func_key; const sc *s; static char *backupstring = NULL; /* The search string we'll be using. */ @@ -775,7 +773,6 @@ int filesearch_init(void) TRUE, #endif MWHEREISFILE, backupstring, - &meta_key, &func_key, #ifndef DISABLE_HISTORIES &search_history, #endif @@ -805,7 +802,7 @@ int filesearch_init(void) statusbar(_("Cancelled")); return -1; } else { - s = get_shortcut(MBROWSER, &i, &meta_key); + s = get_shortcut(MBROWSER, &i); if (i == -2 || i == 0) { #ifdef HAVE_REGEX_H /* Use last_search if answer is an empty string, or diff --git a/src/files.c b/src/files.c index 9867c40b..dfd32f08 100644 --- a/src/files.c +++ b/src/files.c @@ -1009,7 +1009,7 @@ void do_insertfile( filestruct *edittop_save = openfile->edittop; size_t current_x_save = openfile->current_x; ssize_t current_y_save = openfile->current_y; - bool edittop_inside = FALSE, meta_key = FALSE, func_key = FALSE; + bool edittop_inside = FALSE; const sc *s; #ifndef NANO_TINY bool right_side_up = FALSE, single_line = FALSE; @@ -1045,7 +1045,6 @@ void do_insertfile( execute ? MEXTCMD : #endif MINSERTFILE, ans, - &meta_key, &func_key, #ifndef DISABLE_HISTORIES NULL, #endif @@ -1072,7 +1071,7 @@ void do_insertfile( ans = mallocstrcpy(ans, answer); - s = get_shortcut(currmenu, &i, &meta_key); + s = get_shortcut(currmenu, &i); #ifndef NANO_TINY #ifndef DISABLE_MULTIBUFFER @@ -2218,7 +2217,7 @@ bool do_writeout(bool exiting) #ifndef DISABLE_EXTRA static bool did_credits = FALSE; #endif - bool retval = FALSE, meta_key = FALSE, func_key = FALSE; + bool retval = FALSE; const sc *s; currmenu = MWRITEFILE; @@ -2273,7 +2272,6 @@ bool do_writeout(bool exiting) TRUE, #endif MWRITEFILE, ans, - &meta_key, &func_key, #ifndef DISABLE_HISTORIES NULL, #endif @@ -2293,7 +2291,7 @@ bool do_writeout(bool exiting) break; } else { ans = mallocstrcpy(ans, answer); - s = get_shortcut(currmenu, &i, &meta_key); + s = get_shortcut(currmenu, &i); #ifndef DISABLE_BROWSER if (s && s->scfunc == to_files_void) { diff --git a/src/global.c b/src/global.c index 0f436e28..9a01ae96 100644 --- a/src/global.c +++ b/src/global.c @@ -38,6 +38,11 @@ bool jump_buf_main = FALSE; * SIGWINCH? */ #endif +bool meta_key; + /* Whether the current keystroke is a Meta key. */ +bool func_key; + /* Whether the current keystroke is an extended keypad value. */ + #ifndef DISABLE_WRAPJUSTIFY ssize_t fill = 0; /* The column where we will wrap lines. */ diff --git a/src/help.c b/src/help.c index ceaff06a..6b5b97f3 100644 --- a/src/help.c +++ b/src/help.c @@ -37,7 +37,7 @@ static char *help_text = NULL; void do_help(void (*refresh_func)(void)) { int kbinput = ERR; - bool meta_key, func_key, old_no_help = ISSET(NO_HELP); + bool old_no_help = ISSET(NO_HELP); size_t line = 0; /* The line number in help_text of the first displayed help * line. This variable is zero-based. */ @@ -123,7 +123,7 @@ void do_help(void (*refresh_func)(void)) old_line = line; - kbinput = get_kbinput(edit, &meta_key, &func_key); + kbinput = get_kbinput(edit); #ifndef DISABLE_MOUSE if (kbinput == KEY_MOUSE) { @@ -133,8 +133,8 @@ void do_help(void (*refresh_func)(void)) } #endif - parse_help_input(&kbinput, &meta_key); - s = get_shortcut(MHELP, &kbinput, &meta_key); + parse_help_input(&kbinput); + s = get_shortcut(MHELP, &kbinput); if (!s) continue; f = sctofunc((sc *) s); @@ -478,9 +478,9 @@ void help_init(void) /* Convert certain non-shortcut keys into their corresponding shortcut * sequences. */ -void parse_help_input(int *kbinput, bool *meta_key) +void parse_help_input(int *kbinput) { - if (!*meta_key) { + if (!meta_key) { switch (*kbinput) { /* For consistency with the file browser. */ case ' ': diff --git a/src/nano.c b/src/nano.c index 395e3046..3af5f3f4 100644 --- a/src/nano.c +++ b/src/nano.c @@ -1583,11 +1583,10 @@ void terminal_init(void) } /* Read in a character, interpret it as a shortcut or toggle if - * necessary, and return it. Set meta_key to TRUE if the character is a - * meta sequence, set func_key to TRUE if the character is a function key. + * necessary, and return it. * If allow_funcs is FALSE, don't actually run any functions associated * with shortcut keys. */ -int do_input(bool *meta_key, bool *func_key, bool allow_funcs) +int do_input(bool allow_funcs) { int input; /* The character we read in. */ @@ -1601,15 +1600,15 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs) bool have_shortcut; /* Read in a character. */ - input = get_kbinput(edit, meta_key, func_key); + input = get_kbinput(edit); #ifndef DISABLE_MOUSE - if (*func_key && input == KEY_MOUSE) { + if (func_key && input == KEY_MOUSE) { /* We received a mouse click. */ if (do_mouse() == 1) /* The click was on a shortcut -- read in the character * that it was converted into. */ - input = get_kbinput(edit, meta_key, func_key); + input = get_kbinput(edit); else /* The click was invalid or has been handled -- get out. */ return ERR; @@ -1617,7 +1616,7 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs) #endif /* Check for a shortcut in the main list. */ - s = get_shortcut(MMAIN, &input, meta_key); + s = get_shortcut(MMAIN, &input); /* If we got a shortcut from the main list, or a "universal" * edit window shortcut, set have_shortcut to TRUE. */ @@ -1626,11 +1625,11 @@ int do_input(bool *meta_key, bool *func_key, bool allow_funcs) /* If we got a non-high-bit control key, a meta key sequence, or a * function key, and it's not a shortcut or toggle, throw it out. */ if (!have_shortcut) { - if (is_ascii_cntrl_char(input) || *meta_key || *func_key) { + if (is_ascii_cntrl_char(input) || meta_key || func_key) { statusbar(_("Unknown Command")); beep(); - *meta_key = FALSE; - *func_key = FALSE; + meta_key = FALSE; + func_key = FALSE; input = ERR; } } @@ -2791,8 +2790,6 @@ int main(int argc, char **argv) display_buffer(); while (TRUE) { - bool meta_key, func_key; - /* Make sure the cursor is in the edit window. */ reset_cursor(); wnoutrefresh(edit); @@ -2821,7 +2818,7 @@ int main(int argc, char **argv) currmenu = MMAIN; /* Read in and interpret characters. */ - do_input(&meta_key, &func_key, TRUE); + do_input(TRUE); } /* We should never get here. */ diff --git a/src/prompt.c b/src/prompt.c index d1fa3f94..e9ffd48c 100644 --- a/src/prompt.c +++ b/src/prompt.c @@ -42,14 +42,13 @@ static bool reset_statusbar_x = FALSE; * prompt? */ /* Read in a character, interpret it as a shortcut or toggle if - * necessary, and return it. Set meta_key to TRUE if the character is a - * meta sequence, set func_key to TRUE if the character is a function - * key, set ran_func to TRUE if we ran a function associated with a + * necessary, and return it. + * Set ran_func to TRUE if we ran a function associated with a * shortcut key, and set finished to TRUE if we're done after running * or trying to run a function associated with a shortcut key. * refresh_func is the function we will call to refresh the edit window. */ -int do_statusbar_input(bool *meta_key, bool *func_key, - bool *ran_func, bool *finished, void (*refresh_func)(void)) +int do_statusbar_input(bool *ran_func, bool *finished, + void (*refresh_func)(void)) { int input; /* The character we read in. */ @@ -65,24 +64,24 @@ int do_statusbar_input(bool *meta_key, bool *func_key, *finished = FALSE; /* Read in a character. */ - input = get_kbinput(bottomwin, meta_key, func_key); + input = get_kbinput(bottomwin); #ifndef DISABLE_MOUSE /* If we got a mouse click and it was on a shortcut, read in the * shortcut character. */ - if (*func_key && input == KEY_MOUSE) { + if (func_key && input == KEY_MOUSE) { if (do_statusbar_mouse() == 1) - input = get_kbinput(bottomwin, meta_key, func_key); + input = get_kbinput(bottomwin); else { - *meta_key = FALSE; - *func_key = FALSE; + meta_key = FALSE; + func_key = FALSE; input = ERR; } } #endif /* Check for a shortcut in the current list. */ - s = get_shortcut(currmenu, &input, meta_key); + s = get_shortcut(currmenu, &input); /* If we got a shortcut from the current list, or a "universal" * statusbar prompt shortcut, set have_shortcut to TRUE. */ @@ -91,10 +90,10 @@ int do_statusbar_input(bool *meta_key, bool *func_key, /* If we got a non-high-bit control key, a meta key sequence, or a * function key, and it's not a shortcut or toggle, throw it out. */ if (!have_shortcut) { - if (is_ascii_cntrl_char(input) || *meta_key || *func_key) { + if (is_ascii_cntrl_char(input) || meta_key || func_key) { beep(); - *meta_key = FALSE; - *func_key = FALSE; + meta_key = FALSE; + func_key = FALSE; input = ERR; } } @@ -727,7 +726,6 @@ const sc *get_prompt_string(int *actual, bool allow_tabs, bool allow_files, #endif const char *curranswer, - bool *meta_key, bool *func_key, #ifndef DISABLE_HISTORIES filestruct **history_list, #endif @@ -800,11 +798,10 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe * this case, disable all keys that would change the text if the * filename isn't blank and we're at the "Write File" prompt. */ while (TRUE) { - kbinput = do_statusbar_input(meta_key, func_key, - &ran_func, &finished, refresh_func); + kbinput = do_statusbar_input(&ran_func, &finished, refresh_func); assert(statusbar_x <= strlen(answer)); - s = get_shortcut(currmenu, &kbinput, meta_key); + s = get_shortcut(currmenu, &kbinput); if (s) if (s->scfunc == do_cancel || s->scfunc == do_enter_void) @@ -963,7 +960,6 @@ int do_prompt(bool allow_tabs, bool allow_files, #endif int menu, const char *curranswer, - bool *meta_key, bool *func_key, #ifndef DISABLE_HISTORIES filestruct **history_list, #endif @@ -995,7 +991,6 @@ int do_prompt(bool allow_tabs, allow_files, #endif curranswer, - meta_key, func_key, #ifndef DISABLE_HISTORIES history_list, #endif @@ -1119,14 +1114,13 @@ int do_yesno_prompt(bool all, const char *msg) do { int kbinput; - bool meta_key, func_key; #ifndef DISABLE_MOUSE int mouse_x, mouse_y; #endif currmenu = MYESNO; - kbinput = get_kbinput(bottomwin, &meta_key, &func_key); - s = get_shortcut(currmenu, &kbinput, &meta_key); + kbinput = get_kbinput(bottomwin); + s = get_shortcut(currmenu, &kbinput); if (s && s->scfunc == do_cancel) ok = -1; diff --git a/src/proto.h b/src/proto.h index 6ab681dc..a60fe6a8 100644 --- a/src/proto.h +++ b/src/proto.h @@ -32,6 +32,9 @@ extern sigjmp_buf jump_buf; extern bool jump_buf_main; #endif +extern bool meta_key; +extern bool func_key; + #ifndef DISABLE_WRAPJUSTIFY extern ssize_t fill; extern ssize_t wrap_at; @@ -141,7 +144,7 @@ extern char *homedir; char *do_browser(char *path, DIR *dir); char *do_browse_from(const char *inpath); void browser_init(const char *path, DIR *dir); -void parse_browser_input(int *kbinput, bool *meta_key); +void parse_browser_input(int *kbinput); void browser_refresh(void); bool browser_select_filename(const char *needle); int filesearch_init(void); @@ -369,7 +372,7 @@ void thanks_for_all_the_fish(void); #ifndef DISABLE_HELP void do_help(void (*refresh_func)(void)); void help_init(void); -void parse_help_input(int *kbinput, bool *meta_key); +void parse_help_input(int *kbinput); size_t help_line_len(const char *ptr); #endif void do_help_void(void); @@ -487,15 +490,15 @@ void enable_signals(void); void disable_flow_control(void); void enable_flow_control(void); void terminal_init(void); -int do_input(bool *meta_key, bool *func_key, bool allow_funcs); +int do_input(bool allow_funcs); #ifndef DISABLE_MOUSE int do_mouse(void); #endif void do_output(char *output, size_t output_len, bool allow_cntrls); /* All functions in prompt.c. */ -int do_statusbar_input(bool *meta_key, bool *func_key, - bool *ran_func, bool *finished, void (*refresh_func)(void)); +int do_statusbar_input(bool *ran_func, bool *finished, + void (*refresh_func)(void)); #ifndef DISABLE_MOUSE int do_statusbar_mouse(void); #endif @@ -524,7 +527,6 @@ const sc *get_prompt_string(int *value, bool allow_tabs, bool allow_files, #endif const char *curranswer, - bool *meta_key, bool *func_key, #ifndef DISABLE_HISTORIES filestruct **history_list, #endif @@ -538,7 +540,6 @@ int do_prompt(bool allow_tabs, bool allow_files, #endif int menu, const char *curranswer, - bool *meta_key, bool *func_key, #ifndef DISABLE_HISTORIES filestruct **history_list, #endif @@ -750,10 +751,10 @@ void dump_filestruct_reverse(void); void get_key_buffer(WINDOW *win); size_t get_key_buffer_len(void); void unget_input(int *input, size_t input_len); -void unget_kbinput(int kbinput, bool meta_key, bool func_key); +void unget_kbinput(int kbinput, bool metakey, bool funckey); int *get_input(WINDOW *win, size_t input_len); -int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key); -int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key); +int get_kbinput(WINDOW *win); +int parse_kbinput(WINDOW *win); int get_escape_seq_kbinput(const int *seq, size_t seq_len); int get_escape_seq_abcd(int kbinput); int parse_escape_seq_kbinput(WINDOW *win, int kbinput); @@ -769,7 +770,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len); #ifndef DISABLE_MOUSE int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts); #endif -const sc *get_shortcut(int menu, int *kbinput, bool *meta_key); +const sc *get_shortcut(int menu, int *kbinput); void blank_line(WINDOW *win, int y, int x, int n); void blank_titlebar(void); void blank_topbar(void); diff --git a/src/search.c b/src/search.c index 06d0208e..cdde40f1 100644 --- a/src/search.c +++ b/src/search.c @@ -138,7 +138,6 @@ int search_init(bool replacing, bool use_answer) int i = 0; char *buf; sc *s; - bool meta_key = FALSE, func_key = FALSE; static char *backupstring = NULL; /* The search string we'll be using. */ @@ -177,7 +176,6 @@ int search_init(bool replacing, bool use_answer) TRUE, #endif replacing ? MREPLACE : MWHEREIS, backupstring, - &meta_key, &func_key, #ifndef DISABLE_HISTORIES &search_history, #endif @@ -910,7 +908,6 @@ void do_replace(void) { filestruct *edittop_save, *begin; size_t begin_x, pww_save; - bool meta_key = FALSE, func_key = FALSE; ssize_t numreplaced; int i; @@ -953,7 +950,6 @@ void do_replace(void) TRUE, #endif MREPLACEWITH, last_replace, - &meta_key, &func_key, #ifndef DISABLE_HISTORIES &replace_history, #endif @@ -1027,7 +1023,6 @@ void goto_line_posx(ssize_t line, size_t pos_x) void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, bool interactive, bool save_pos, bool allow_update) { - bool meta_key = FALSE, func_key = FALSE; const sc *s; if (interactive) { @@ -1039,7 +1034,6 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, TRUE, #endif MGOTOLINE, use_answer ? ans : "", - &meta_key, &func_key, #ifndef DISABLE_HISTORIES NULL, #endif @@ -1055,7 +1049,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, return; } - s = get_shortcut(currmenu, &i, &meta_key); + s = get_shortcut(currmenu, &i); if (s && s->scfunc == gototext_void) { /* Keep answer up on the statusbar. */ diff --git a/src/text.c b/src/text.c index cb050e2a..008da02c 100644 --- a/src/text.c +++ b/src/text.c @@ -1874,7 +1874,6 @@ void do_justify(bool full_justify) bool modified_save = openfile->modified; int kbinput; - bool meta_key, func_key; const sc *s; /* Move to the beginning of the current line, so that justifying at @@ -2193,8 +2192,8 @@ void do_justify(bool full_justify) /* Now get a keystroke and see if it's unjustify. If not, put back * the keystroke and return. */ - kbinput = do_input(&meta_key, &func_key, FALSE); - s = get_shortcut(MMAIN, &kbinput, &meta_key); + kbinput = do_input(FALSE); + s = get_shortcut(MMAIN, &kbinput); if (s && s->scfunc == do_uncut_text) { /* Splice the justify buffer back into the file, but only if we @@ -2286,7 +2285,6 @@ bool do_int_spell_fix(const char *word) char *save_search, *save_replace; size_t match_len, current_x_save = openfile->current_x; size_t pww_save = openfile->placewewant; - bool meta_key = FALSE, func_key = FALSE; filestruct *edittop_save = openfile->edittop; filestruct *current_save = openfile->current; /* Save where we are. */ @@ -2374,7 +2372,6 @@ bool do_int_spell_fix(const char *word) TRUE, #endif MSPELL, word, - &meta_key, &func_key, #ifndef DISABLE_HISTORIES NULL, #endif @@ -3117,7 +3114,6 @@ void do_linter(void) while (1) { ssize_t tmpcol = 1; int kbinput; - bool meta_key, func_key; if (curlint->colno > 0) tmpcol = curlint->colno; @@ -3172,8 +3168,8 @@ void do_linter(void) bottombars(MLINTER); } - kbinput = get_kbinput(bottomwin, &meta_key, &func_key); - s = get_shortcut(currmenu, &kbinput, &meta_key); + kbinput = get_kbinput(bottomwin); + s = get_shortcut(currmenu, &kbinput); tmplint = curlint; if (!s) diff --git a/src/winio.c b/src/winio.c index 58dfe8f8..b232f3a6 100644 --- a/src/winio.c +++ b/src/winio.c @@ -224,17 +224,17 @@ void unget_input(int *input, size_t input_len) } /* Put back the character stored in kbinput, putting it in byte range - * beforehand. If meta_key is TRUE, put back the Escape character after - * putting back kbinput. If func_key is TRUE, put back the function key + * beforehand. If metakey is TRUE, put back the Escape character after + * putting back kbinput. If funckey is TRUE, put back the function key * (a value outside byte range) without putting it in byte range. */ -void unget_kbinput(int kbinput, bool meta_key, bool func_key) +void unget_kbinput(int kbinput, bool metakey, bool funckey) { - if (!func_key) + if (!funckey) kbinput = (char)kbinput; unget_input(&kbinput, 1); - if (meta_key) { + if (metakey) { kbinput = NANO_CONTROL_3; unget_input(&kbinput, 1); } @@ -298,20 +298,19 @@ int *get_input(WINDOW *win, size_t input_len) /* Read in a single character. If it's ignored, swallow it and go on. * Otherwise, try to translate it from ASCII, meta key sequences, escape - * sequences, and/or extended keypad values. Set meta_key to TRUE when - * we get a meta key sequence, and set func_key to TRUE when we get an - * extended keypad value. Supported extended keypad values consist of + * sequences, and/or extended keypad values. Supported extended keypad + * values consist of * [arrow key], Ctrl-[arrow key], Shift-[arrow key], Enter, Backspace, * the editing keypad (Insert, Delete, Home, End, PageUp, and PageDown), * the function keypad (F1-F16), and the numeric keypad with NumLock * off. */ -int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key) +int get_kbinput(WINDOW *win) { int kbinput; /* Read in a character and interpret it. Continue doing this until * we get a recognized value or sequence. */ - while ((kbinput = parse_kbinput(win, meta_key, func_key)) == ERR) + while ((kbinput = parse_kbinput(win)) == ERR) ; /* If we read from the edit window, blank the statusbar if we need @@ -326,13 +325,13 @@ int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key) * sequences into their corresponding key values. Set meta_key to TRUE * when we get a meta key sequence, and set func_key to TRUE when we get * a function key. */ -int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key) +int parse_kbinput(WINDOW *win) { static int escapes = 0, byte_digits = 0; int *kbinput, retval = ERR; - *meta_key = FALSE; - *func_key = FALSE; + meta_key = FALSE; + func_key = FALSE; /* Read in a character. */ if (nodelay_mode) { @@ -379,7 +378,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key) * meta key sequence mode. Set meta_key to * TRUE, and save the lowercase version of the * non-escape character as the result. */ - *meta_key = TRUE; + meta_key = TRUE; retval = tolower(*kbinput); } else /* One escape followed by a non-escape, and @@ -469,7 +468,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key) * escape counter, set meta_key to TRUE, and * interpret the escape sequence. */ escapes = 0; - *meta_key = TRUE; + meta_key = TRUE; retval = parse_escape_seq_kbinput(win, *kbinput); } @@ -649,11 +648,11 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key) /* If our result is an extended keypad value (i.e. a value * outside of byte range), set func_key to TRUE. */ if (retval != ERR) - *func_key = !is_byte(retval); + func_key = !is_byte(retval); } #ifdef DEBUG - fprintf(stderr, "parse_kbinput(): kbinput = %d, meta_key = %s, func_key = %s, escapes = %d, byte_digits = %d, retval = %d\n", *kbinput, *meta_key ? "TRUE" : "FALSE", *func_key ? "TRUE" : "FALSE", escapes, byte_digits, retval); + fprintf(stderr, "parse_kbinput(): kbinput = %d, meta_key = %s, func_key = %s, escapes = %d, byte_digits = %d, retval = %d\n", *kbinput, meta_key ? "TRUE" : "FALSE", func_key ? "TRUE" : "FALSE", escapes, byte_digits, retval); #endif free(kbinput); @@ -1791,26 +1790,26 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts) * key itself) and meta_key (whether the key is a meta sequence). The * returned shortcut will be the first in the list that corresponds to * the given sequence. */ -const sc *get_shortcut(int menu, int *kbinput, bool *meta_key) +const sc *get_shortcut(int menu, int *kbinput) { sc *s; #ifdef DEBUG - fprintf(stderr, "get_shortcut(): kbinput = %d, meta_key = %s -- ", *kbinput, *meta_key ? "TRUE" : "FALSE"); + fprintf(stderr, "get_shortcut(): kbinput = %d, meta_key = %s -- ", *kbinput, meta_key ? "TRUE" : "FALSE"); #endif for (s = sclist; s != NULL; s = s->next) { if ((menu & s->menu) && *kbinput == s->seq - && *meta_key == (s->type == META)) { + && meta_key == (s->type == META)) { #ifdef DEBUG fprintf (stderr, "matched seq \"%s\", and btw meta was %d (menu is %x from %x)\n", - s->keystr, *meta_key, menu, s->menu); + s->keystr, meta_key, menu, s->menu); #endif return s; } } #ifdef DEBUG - fprintf (stderr, "matched nothing, btw meta was %d\n", *meta_key); + fprintf (stderr, "matched nothing, btw meta was %d\n", meta_key); #endif return NULL; @@ -1820,14 +1819,13 @@ const sc *get_shortcut(int menu, int *kbinput, bool *meta_key) const subnfunc *getfuncfromkey(WINDOW *win) { int kbinput; - bool func_key = FALSE, meta_key = FALSE; const sc *s; - kbinput = parse_kbinput(win, &meta_key, &func_key); + kbinput = parse_kbinput(win); if (kbinput == 0) return NULL; - s = get_shortcut(currmenu, &kbinput, &meta_key); + s = get_shortcut(currmenu, &kbinput); if (!s) return NULL;