1
1

rcfile: accept also function names and menu names only in lowercase

Этот коммит содержится в:
Benno Schulenberg 2019-12-13 19:03:38 +01:00
родитель a7e11495bd
Коммит 0b1a766964

Просмотреть файл

@ -223,250 +223,250 @@ keystruct *strtosc(const char *input)
#endif #endif
#ifdef ENABLE_HELP #ifdef ENABLE_HELP
if (!strcasecmp(input, "help")) if (!strcmp(input, "help"))
s->func = do_help_void; s->func = do_help_void;
else else
#endif #endif
if (!strcasecmp(input, "cancel")) if (!strcmp(input, "cancel"))
s->func = do_cancel; s->func = do_cancel;
else if (!strcasecmp(input, "exit")) else if (!strcmp(input, "exit"))
s->func = do_exit; s->func = do_exit;
else if (!strcasecmp(input, "discardbuffer")) else if (!strcmp(input, "discardbuffer"))
s->func = discard_buffer; s->func = discard_buffer;
else if (!strcasecmp(input, "writeout")) else if (!strcmp(input, "writeout"))
s->func = do_writeout_void; s->func = do_writeout_void;
else if (!strcasecmp(input, "savefile")) else if (!strcmp(input, "savefile"))
s->func = do_savefile; s->func = do_savefile;
else if (!strcasecmp(input, "insert")) else if (!strcmp(input, "insert"))
s->func = do_insertfile_void; s->func = do_insertfile_void;
else if (!strcasecmp(input, "whereis")) else if (!strcmp(input, "whereis"))
s->func = do_search_forward; s->func = do_search_forward;
else if (!strcasecmp(input, "wherewas")) else if (!strcmp(input, "wherewas"))
s->func = do_search_backward; s->func = do_search_backward;
else if (!strcasecmp(input, "findprevious")) else if (!strcmp(input, "findprevious"))
s->func = do_findprevious; s->func = do_findprevious;
else if (!strcasecmp(input, "findnext")) else if (!strcmp(input, "findnext"))
s->func = do_findnext; s->func = do_findnext;
else if (!strcasecmp(input, "replace")) else if (!strcmp(input, "replace"))
s->func = do_replace; s->func = do_replace;
else if (!strcasecmp(input, "cut")) else if (!strcmp(input, "cut"))
s->func = cut_text; s->func = cut_text;
else if (!strcasecmp(input, "paste")) else if (!strcmp(input, "paste"))
s->func = paste_text; s->func = paste_text;
#ifndef NANO_TINY #ifndef NANO_TINY
else if (!strcasecmp(input, "cutrestoffile")) else if (!strcmp(input, "cutrestoffile"))
s->func = cut_till_eof; s->func = cut_till_eof;
else if (!strcasecmp(input, "copy")) else if (!strcmp(input, "copy"))
s->func = copy_text; s->func = copy_text;
else if (!strcasecmp(input, "zap")) else if (!strcmp(input, "zap"))
s->func = zap_text; s->func = zap_text;
else if (!strcasecmp(input, "mark")) else if (!strcmp(input, "mark"))
s->func = do_mark; s->func = do_mark;
#endif #endif
#ifdef ENABLE_SPELLER #ifdef ENABLE_SPELLER
else if (!strcasecmp(input, "tospell") || else if (!strcmp(input, "tospell") ||
!strcasecmp(input, "speller")) !strcmp(input, "speller"))
s->func = do_spell; s->func = do_spell;
#endif #endif
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
else if (!strcasecmp(input, "linter")) else if (!strcmp(input, "linter"))
s->func = do_linter; s->func = do_linter;
#ifdef ENABLE_SPELLER #ifdef ENABLE_SPELLER
else if (!strcasecmp(input, "formatter")) else if (!strcmp(input, "formatter"))
s->func = do_formatter; s->func = do_formatter;
#endif #endif
#endif #endif
else if (!strcasecmp(input, "curpos")) else if (!strcmp(input, "curpos"))
s->func = do_cursorpos_void; s->func = do_cursorpos_void;
else if (!strcasecmp(input, "gotoline")) else if (!strcmp(input, "gotoline"))
s->func = do_gotolinecolumn_void; s->func = do_gotolinecolumn_void;
#ifdef ENABLE_JUSTIFY #ifdef ENABLE_JUSTIFY
else if (!strcasecmp(input, "justify")) else if (!strcmp(input, "justify"))
s->func = do_justify_void; s->func = do_justify_void;
else if (!strcasecmp(input, "fulljustify")) else if (!strcmp(input, "fulljustify"))
s->func = do_full_justify; s->func = do_full_justify;
else if (!strcasecmp(input, "beginpara")) else if (!strcmp(input, "beginpara"))
s->func = do_para_begin_void; s->func = do_para_begin_void;
else if (!strcasecmp(input, "endpara")) else if (!strcmp(input, "endpara"))
s->func = do_para_end_void; s->func = do_para_end_void;
#endif #endif
#ifdef ENABLE_COMMENT #ifdef ENABLE_COMMENT
else if (!strcasecmp(input, "comment")) else if (!strcmp(input, "comment"))
s->func = do_comment; s->func = do_comment;
#endif #endif
#ifdef ENABLE_WORDCOMPLETION #ifdef ENABLE_WORDCOMPLETION
else if (!strcasecmp(input, "complete")) else if (!strcmp(input, "complete"))
s->func = complete_a_word; s->func = complete_a_word;
#endif #endif
#ifndef NANO_TINY #ifndef NANO_TINY
else if (!strcasecmp(input, "indent")) else if (!strcmp(input, "indent"))
s->func = do_indent; s->func = do_indent;
else if (!strcasecmp(input, "unindent")) else if (!strcmp(input, "unindent"))
s->func = do_unindent; s->func = do_unindent;
else if (!strcasecmp(input, "chopwordleft") || else if (!strcmp(input, "chopwordleft") ||
!strcasecmp(input, "cutwordleft")) /* Deprecated; remove in 2021. */ !strcmp(input, "cutwordleft")) /* Deprecated; remove in 2021. */
s->func = chop_previous_word; s->func = chop_previous_word;
else if (!strcasecmp(input, "chopwordright") || else if (!strcmp(input, "chopwordright") ||
!strcasecmp(input, "cutwordright")) /* Deprecated; remove in 2021. */ !strcmp(input, "cutwordright")) /* Deprecated; remove in 2021. */
s->func = chop_next_word; s->func = chop_next_word;
else if (!strcasecmp(input, "findbracket")) else if (!strcmp(input, "findbracket"))
s->func = do_find_bracket; s->func = do_find_bracket;
else if (!strcasecmp(input, "wordcount")) else if (!strcmp(input, "wordcount"))
s->func = do_wordlinechar_count; s->func = do_wordlinechar_count;
else if (!strcasecmp(input, "recordmacro")) else if (!strcmp(input, "recordmacro"))
s->func = record_macro; s->func = record_macro;
else if (!strcasecmp(input, "runmacro")) else if (!strcmp(input, "runmacro"))
s->func = run_macro; s->func = run_macro;
else if (!strcasecmp(input, "undo")) else if (!strcmp(input, "undo"))
s->func = do_undo; s->func = do_undo;
else if (!strcasecmp(input, "redo")) else if (!strcmp(input, "redo"))
s->func = do_redo; s->func = do_redo;
#endif #endif
else if (!strcasecmp(input, "left") || else if (!strcmp(input, "left") ||
!strcasecmp(input, "back")) !strcmp(input, "back"))
s->func = do_left; s->func = do_left;
else if (!strcasecmp(input, "right") || else if (!strcmp(input, "right") ||
!strcasecmp(input, "forward")) !strcmp(input, "forward"))
s->func = do_right; s->func = do_right;
else if (!strcasecmp(input, "up") || else if (!strcmp(input, "up") ||
!strcasecmp(input, "prevline")) !strcmp(input, "prevline"))
s->func = do_up; s->func = do_up;
else if (!strcasecmp(input, "down") || else if (!strcmp(input, "down") ||
!strcasecmp(input, "nextline")) !strcmp(input, "nextline"))
s->func = do_down; s->func = do_down;
#if !defined(NANO_TINY) || defined(ENABLE_HELP) #if !defined(NANO_TINY) || defined(ENABLE_HELP)
else if (!strcasecmp(input, "scrollup")) else if (!strcmp(input, "scrollup"))
s->func = do_scroll_up; s->func = do_scroll_up;
else if (!strcasecmp(input, "scrolldown")) else if (!strcmp(input, "scrolldown"))
s->func = do_scroll_down; s->func = do_scroll_down;
#endif #endif
else if (!strcasecmp(input, "prevword")) else if (!strcmp(input, "prevword"))
s->func = do_prev_word_void; s->func = do_prev_word_void;
else if (!strcasecmp(input, "nextword")) else if (!strcmp(input, "nextword"))
s->func = do_next_word_void; s->func = do_next_word_void;
else if (!strcasecmp(input, "home")) else if (!strcmp(input, "home"))
s->func = do_home; s->func = do_home;
else if (!strcasecmp(input, "end")) else if (!strcmp(input, "end"))
s->func = do_end; s->func = do_end;
else if (!strcasecmp(input, "prevblock")) else if (!strcmp(input, "prevblock"))
s->func = do_prev_block; s->func = do_prev_block;
else if (!strcasecmp(input, "nextblock")) else if (!strcmp(input, "nextblock"))
s->func = do_next_block; s->func = do_next_block;
else if (!strcasecmp(input, "pageup") || else if (!strcmp(input, "pageup") ||
!strcasecmp(input, "prevpage")) !strcmp(input, "prevpage"))
s->func = do_page_up; s->func = do_page_up;
else if (!strcasecmp(input, "pagedown") || else if (!strcmp(input, "pagedown") ||
!strcasecmp(input, "nextpage")) !strcmp(input, "nextpage"))
s->func = do_page_down; s->func = do_page_down;
else if (!strcasecmp(input, "firstline")) else if (!strcmp(input, "firstline"))
s->func = to_first_line; s->func = to_first_line;
else if (!strcasecmp(input, "lastline")) else if (!strcmp(input, "lastline"))
s->func = to_last_line; s->func = to_last_line;
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
else if (!strcasecmp(input, "prevbuf")) else if (!strcmp(input, "prevbuf"))
s->func = switch_to_prev_buffer; s->func = switch_to_prev_buffer;
else if (!strcasecmp(input, "nextbuf")) else if (!strcmp(input, "nextbuf"))
s->func = switch_to_next_buffer; s->func = switch_to_next_buffer;
#endif #endif
else if (!strcasecmp(input, "verbatim")) else if (!strcmp(input, "verbatim"))
s->func = do_verbatim_input; s->func = do_verbatim_input;
else if (!strcasecmp(input, "tab")) else if (!strcmp(input, "tab"))
s->func = do_tab; s->func = do_tab;
else if (!strcasecmp(input, "enter")) else if (!strcmp(input, "enter"))
s->func = do_enter; s->func = do_enter;
else if (!strcasecmp(input, "delete")) else if (!strcmp(input, "delete"))
s->func = do_delete; s->func = do_delete;
else if (!strcasecmp(input, "backspace")) else if (!strcmp(input, "backspace"))
s->func = do_backspace; s->func = do_backspace;
else if (!strcasecmp(input, "refresh")) else if (!strcmp(input, "refresh"))
s->func = total_refresh; s->func = total_refresh;
else if (!strcasecmp(input, "suspend")) else if (!strcmp(input, "suspend"))
s->func = do_suspend_void; s->func = do_suspend_void;
else if (!strcasecmp(input, "casesens")) else if (!strcmp(input, "casesens"))
s->func = case_sens_void; s->func = case_sens_void;
else if (!strcasecmp(input, "regexp")) else if (!strcmp(input, "regexp"))
s->func = regexp_void; s->func = regexp_void;
else if (!strcasecmp(input, "backwards")) else if (!strcmp(input, "backwards"))
s->func = backwards_void; s->func = backwards_void;
else if (!strcasecmp(input, "flipreplace")) else if (!strcmp(input, "flipreplace"))
s->func = flip_replace; s->func = flip_replace;
else if (!strcasecmp(input, "flipgoto")) else if (!strcmp(input, "flipgoto"))
s->func = flip_goto; s->func = flip_goto;
#ifdef ENABLE_HISTORIES #ifdef ENABLE_HISTORIES
else if (!strcasecmp(input, "older")) else if (!strcmp(input, "older"))
s->func = get_history_older_void; s->func = get_history_older_void;
else if (!strcasecmp(input, "newer")) else if (!strcmp(input, "newer"))
s->func = get_history_newer_void; s->func = get_history_newer_void;
#endif #endif
#ifndef NANO_TINY #ifndef NANO_TINY
else if (!strcasecmp(input, "dosformat")) else if (!strcmp(input, "dosformat"))
s->func = dos_format_void; s->func = dos_format_void;
else if (!strcasecmp(input, "macformat")) else if (!strcmp(input, "macformat"))
s->func = mac_format_void; s->func = mac_format_void;
else if (!strcasecmp(input, "append")) else if (!strcmp(input, "append"))
s->func = append_void; s->func = append_void;
else if (!strcasecmp(input, "prepend")) else if (!strcmp(input, "prepend"))
s->func = prepend_void; s->func = prepend_void;
else if (!strcasecmp(input, "backup")) else if (!strcmp(input, "backup"))
s->func = backup_file_void; s->func = backup_file_void;
else if (!strcasecmp(input, "flipexecute")) else if (!strcmp(input, "flipexecute"))
s->func = flip_execute; s->func = flip_execute;
else if (!strcasecmp(input, "flippipe")) else if (!strcmp(input, "flippipe"))
s->func = flip_pipe; s->func = flip_pipe;
else if (!strcasecmp(input, "flipconvert")) else if (!strcmp(input, "flipconvert"))
s->func = flip_convert; s->func = flip_convert;
#endif #endif
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
else if (!strcasecmp(input, "flipnewbuffer")) else if (!strcmp(input, "flipnewbuffer"))
s->func = flip_newbuffer; s->func = flip_newbuffer;
#endif #endif
#ifdef ENABLE_BROWSER #ifdef ENABLE_BROWSER
else if (!strcasecmp(input, "tofiles") || else if (!strcmp(input, "tofiles") ||
!strcasecmp(input, "browser")) !strcmp(input, "browser"))
s->func = to_files_void; s->func = to_files_void;
else if (!strcasecmp(input, "gotodir")) else if (!strcmp(input, "gotodir"))
s->func = goto_dir_void; s->func = goto_dir_void;
else if (!strcasecmp(input, "firstfile")) else if (!strcmp(input, "firstfile"))
s->func = to_first_file; s->func = to_first_file;
else if (!strcasecmp(input, "lastfile")) else if (!strcmp(input, "lastfile"))
s->func = to_last_file; s->func = to_last_file;
#endif #endif
else { else {
#ifndef NANO_TINY #ifndef NANO_TINY
s->func = do_toggle_void; s->func = do_toggle_void;
if (!strcasecmp(input, "nohelp")) if (!strcmp(input, "nohelp"))
s->toggle = NO_HELP; s->toggle = NO_HELP;
else if (!strcasecmp(input, "constantshow")) else if (!strcmp(input, "constantshow"))
s->toggle = CONSTANT_SHOW; s->toggle = CONSTANT_SHOW;
else if (!strcasecmp(input, "softwrap")) else if (!strcmp(input, "softwrap"))
s->toggle = SOFTWRAP; s->toggle = SOFTWRAP;
#ifdef ENABLE_LINENUMBERS #ifdef ENABLE_LINENUMBERS
else if (!strcasecmp(input, "linenumbers")) else if (!strcmp(input, "linenumbers"))
s->toggle = LINE_NUMBERS; s->toggle = LINE_NUMBERS;
#endif #endif
else if (!strcasecmp(input, "whitespacedisplay")) else if (!strcmp(input, "whitespacedisplay"))
s->toggle = WHITESPACE_DISPLAY; s->toggle = WHITESPACE_DISPLAY;
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
else if (!strcasecmp(input, "nosyntax")) else if (!strcmp(input, "nosyntax"))
s->toggle = NO_COLOR_SYNTAX; s->toggle = NO_COLOR_SYNTAX;
#endif #endif
else if (!strcasecmp(input, "smarthome")) else if (!strcmp(input, "smarthome"))
s->toggle = SMART_HOME; s->toggle = SMART_HOME;
else if (!strcasecmp(input, "autoindent")) else if (!strcmp(input, "autoindent"))
s->toggle = AUTOINDENT; s->toggle = AUTOINDENT;
else if (!strcasecmp(input, "cutfromcursor")) else if (!strcmp(input, "cutfromcursor"))
s->toggle = CUT_FROM_CURSOR; s->toggle = CUT_FROM_CURSOR;
#ifdef ENABLE_WRAPPING #ifdef ENABLE_WRAPPING
else if (!strcasecmp(input, "nowrap")) else if (!strcmp(input, "nowrap"))
s->toggle = BREAK_LONG_LINES; s->toggle = BREAK_LONG_LINES;
#endif #endif
else if (!strcasecmp(input, "tabstospaces")) else if (!strcmp(input, "tabstospaces"))
s->toggle = TABS_TO_SPACES; s->toggle = TABS_TO_SPACES;
#ifdef ENABLE_MOUSE #ifdef ENABLE_MOUSE
else if (!strcasecmp(input, "mouse")) else if (!strcmp(input, "mouse"))
s->toggle = USE_MOUSE; s->toggle = USE_MOUSE;
#endif #endif
else if (!strcasecmp(input, "suspendenable")) else if (!strcmp(input, "suspendenable"))
s->toggle = SUSPEND; s->toggle = SUSPEND;
else else
#endif /* !NANO_TINY */ #endif /* !NANO_TINY */
@ -484,7 +484,7 @@ int name_to_menu(const char *name)
int index = -1; int index = -1;
while (++index < NUMBER_OF_MENUS) while (++index < NUMBER_OF_MENUS)
if (strcasecmp(name, menunames[index]) == 0) if (strcmp(name, menunames[index]) == 0)
return menusymbols[index]; return menusymbols[index];
return -1; return -1;