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

Function conf_choice

scripts/config/conf.c:450–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448}
449
450static int conf_choice(struct menu *menu)
451{
452 struct symbol *sym, *def_sym;
453 struct menu *child;
454 bool is_new;
455
456 sym = menu->sym;
457 is_new = !sym_has_value(sym);
458 if (sym_is_changeable(sym)) {
459 conf_sym(menu);
460 sym_calc_value(sym);
461 switch (sym_get_tristate_value(sym)) {
462 case no:
463 return 1;
464 case mod:
465 return 0;
466 case yes:
467 break;
468 }
469 } else {
470 switch (sym_get_tristate_value(sym)) {
471 case no:
472 return 1;
473 case mod:
474 printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
475 return 0;
476 case yes:
477 break;
478 }
479 }
480
481 while (1) {
482 int cnt, def;
483
484 printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
485 def_sym = sym_get_choice_value(sym);
486 cnt = def = 0;
487 line[0] = 0;
488 for (child = menu->list; child; child = child->next) {
489 if (!menu_is_visible(child))
490 continue;
491 if (!child->sym) {
492 printf("%*c %s\n", indent, '*', menu_get_prompt(child));
493 continue;
494 }
495 cnt++;
496 if (child->sym == def_sym) {
497 def = cnt;
498 printf("%*c", indent, '>');
499 } else
500 printf("%*c", indent, ' ');
501 printf(" %d. %s", cnt, menu_get_prompt(child));
502 if (child->sym->name)
503 printf(" (%s)", child->sym->name);
504 if (!sym_has_value(child->sym))
505 printf(" (NEW)");
506 printf("\n");
507 }

Callers 1

confFunction · 0.70

Calls 13

sym_has_valueFunction · 0.85
sym_is_changeableFunction · 0.85
conf_symFunction · 0.85
sym_calc_valueFunction · 0.85
sym_get_tristate_valueFunction · 0.85
menu_get_promptFunction · 0.85
sym_get_choice_valueFunction · 0.85
menu_is_visibleFunction · 0.85
xfgetsFunction · 0.85
stripFunction · 0.85
print_helpFunction · 0.85
sym_set_tristate_valueFunction · 0.85

Tested by

no test coverage detected