int show_colorschemes_menu(FileView *view) { static menu_info m; init_menu_info(&m, strdup("Choose the default Color Scheme"), strdup("No color schemes found")); m.execute_handler = &execute_colorscheme_cb; m.items = list_color_schemes(&m.len); qsort(m.items, m.len, sizeof(*m.items), &sorter); /* It's safe to set m.pos to negative value, since menus.c handles this * correctly. */ #ifndef _WIN32 m.pos = string_array_pos(m.items, m.len, cfg.cs.name); #else m.pos = string_array_pos_case(m.items, m.len, cfg.cs.name); #endif return display_menu(&m, view); }
int is_in_string_array_case(char *array[], size_t len, const char item[]) { const int pos = string_array_pos_case(array, len, item); return pos >= 0; }