MCPcopy Create free account
hub / github.com/Entware/Entware / conf_choice

Function conf_choice

scripts/config/nconf.c:1323–1450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1321}
1322
1323static void conf_choice(struct menu *menu)
1324{
1325 const char *prompt = menu_get_prompt(menu);
1326 struct menu *child = NULL;
1327 struct symbol *active;
1328 struct property *prop;
1329 int selected_index = 0;
1330 int last_top_row = 0;
1331 int res, i = 0;
1332 struct match_state match_state = {
1333 .in_search = 0,
1334 .match_direction = MATCH_TINKER_PATTERN_DOWN,
1335 .pattern = "",
1336 };
1337
1338 active = sym_get_choice_value(menu->sym);
1339 /* this is mostly duplicated from the conf() function. */
1340 while (!global_exit) {
1341 reset_menu();
1342
1343 for (i = 0, child = menu->list; child; child = child->next) {
1344 if (!show_all_items && !menu_is_visible(child))
1345 continue;
1346
1347 if (child->sym == sym_get_choice_value(menu->sym))
1348 item_make(child, ':', "<X> %s",
1349 menu_get_prompt(child));
1350 else if (child->sym)
1351 item_make(child, ':', " %s",
1352 menu_get_prompt(child));
1353 else
1354 item_make(child, ':', "*** %s ***",
1355 menu_get_prompt(child));
1356
1357 if (child->sym == active){
1358 last_top_row = top_row(curses_menu);
1359 selected_index = i;
1360 }
1361 i++;
1362 }
1363 show_menu(prompt ? prompt : "Choice Menu",
1364 radiolist_instructions,
1365 selected_index,
1366 &last_top_row);
1367 while (!global_exit) {
1368 if (match_state.in_search) {
1369 mvprintw(0, 0, "searching: %s",
1370 match_state.pattern);
1371 clrtoeol();
1372 }
1373 refresh_all_windows(main_window);
1374 res = wgetch(menu_win(curses_menu));
1375 if (!res)
1376 break;
1377 if (do_match(res, &match_state, &selected_index) == 0) {
1378 if (selected_index != -1)
1379 center_item(selected_index,
1380 &last_top_row);

Callers 1

selected_confFunction · 0.70

Calls 15

menu_get_promptFunction · 0.85
sym_get_choice_valueFunction · 0.85
reset_menuFunction · 0.85
menu_is_visibleFunction · 0.85
show_menuFunction · 0.85
refresh_all_windowsFunction · 0.85
do_matchFunction · 0.85
center_itemFunction · 0.85
process_special_keysFunction · 0.85
sym_get_tristate_valueFunction · 0.85
expr_calc_valueFunction · 0.85
conf_resetFunction · 0.85

Tested by

no test coverage detected