summaryrefslogtreecommitdiff
path: root/scripts/kconfig/conf.c
Side-by-side diff
Diffstat (limited to 'scripts/kconfig/conf.c') (more/less context) (show whitespace changes)
-rw-r--r--scripts/kconfig/conf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 74c94c2..1602d5f 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -70,96 +70,97 @@ static void printo(const char *o)
putchar(' ');
sep = 0;
} else
printf("%s", o);
}
static void strip(char *str)
{
char *p = str;
int l;
while ((isspace(*p)))
p++;
l = strlen(p);
if (p != str)
memmove(str, p, l + 1);
if (!l)
return;
p = str + l - 1;
while ((isspace(*p)))
*p-- = 0;
}
static void conf_askvalue(struct symbol *sym, const char *def)
{
enum symbol_type type = sym_get_type(sym);
tristate val;
if (!sym_has_value(sym))
printf("(NEW) ");
line[0] = '\n';
line[1] = 0;
switch (input_mode) {
case ask_new:
case ask_silent:
if (sym_has_value(sym)) {
printf("%s\n", def);
return;
}
if (!valid_stdin && input_mode == ask_silent) {
printf("aborted!\n\n");
printf("Console input/output is redirected. ");
printf("Run 'make oldconfig' to update configuration.\n\n");
exit(1);
}
case ask_all:
+ fflush(stdout);
fgets(line, 128, stdin);
return;
case set_default:
printf("%s\n", def);
return;
default:
break;
}
switch (type) {
case S_INT:
case S_HEX:
case S_STRING:
printf("%s\n", def);
return;
default:
;
}
switch (input_mode) {
case set_yes:
if (sym_tristate_within_range(sym, yes)) {
line[0] = 'y';
line[1] = '\n';
line[2] = 0;
break;
}
case set_mod:
if (type == S_TRISTATE) {
if (sym_tristate_within_range(sym, mod)) {
line[0] = 'm';
line[1] = '\n';
line[2] = 0;
break;
}
} else {
if (sym_tristate_within_range(sym, yes)) {
line[0] = 'y';
line[1] = '\n';
line[2] = 0;
break;
}
}
case set_no:
if (sym_tristate_within_range(sym, no)) {
line[0] = 'n';
line[1] = '\n';
line[2] = 0;
break;
@@ -297,119 +298,121 @@ static int conf_choice(struct menu *menu)
const char *help;
int type, len;
bool is_new;
sym = menu->sym;
type = sym_get_type(sym);
is_new = !sym_has_value(sym);
if (sym_is_changable(sym)) {
conf_sym(menu);
sym_calc_value(sym);
switch (sym_get_tristate_value(sym)) {
case no:
return 1;
case mod:
return 0;
case yes:
break;
}
} else {
sym->def = sym->curr;
if (S_TRI(sym->curr) == mod) {
printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu));
return 0;
}
}
while (1) {
printf("%*s%s ", indent - 1, "", menu_get_prompt(menu));
def_sym = sym_get_choice_value(sym);
def_menu = NULL;
for (cmenu = menu->list; cmenu; cmenu = cmenu->next) {
if (!menu_is_visible(cmenu))
continue;
printo(menu_get_prompt(cmenu));
if (cmenu->sym == def_sym)
def_menu = cmenu;
}
printo(NULL);
if (def_menu)
printf("[%s] ", menu_get_prompt(def_menu));
else {
printf("\n");
return 1;
}
switch (input_mode) {
case ask_new:
case ask_silent:
case ask_all:
+ if (is_new)
+ sym->flags |= SYMBOL_NEW;
conf_askvalue(sym, menu_get_prompt(def_menu));
strip(line);
break;
default:
line[0] = 0;
printf("\n");
}
if (line[0] == '?' && !line[1]) {
help = nohelp_text;
if (menu->sym->help)
help = menu->sym->help;
printf("\n%s\n", help);
continue;
}
if (line[0]) {
- len = strlen(line) - 1;
+ len = strlen(line);
line[len] = 0;
def_menu = NULL;
for (cmenu = menu->list; cmenu; cmenu = cmenu->next) {
if (!cmenu->sym || !menu_is_visible(cmenu))
continue;
- if (!strncmp(line, menu_get_prompt(cmenu), len)) {
+ if (!strncasecmp(line, menu_get_prompt(cmenu), len)) {
def_menu = cmenu;
break;
}
}
}
if (def_menu) {
sym_set_choice_value(sym, def_menu->sym);
if (def_menu->list) {
indent += 2;
conf(def_menu->list);
indent -= 2;
}
return 1;
}
}
}
static void conf(struct menu *menu)
{
struct symbol *sym;
struct property *prop;
struct menu *child;
if (!menu_is_visible(menu))
return;
sym = menu->sym;
prop = menu->prompt;
if (prop) {
const char *prompt;
switch (prop->type) {
case P_MENU:
if (input_mode == ask_silent && rootEntry != menu) {
check_conf(menu);
return;
}
case P_COMMENT:
prompt = menu_get_prompt(menu);
if (prompt)
printf("%*c\n%*c %s\n%*c\n",
indent, '*',
indent, '*', prompt,
indent, '*');
default:
;
}
}