X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=scripts%2Fkconfig%2Fconf.c;h=b86c64f90c943676c45f8e814f3a86953b3a5e50;hp=70e7264c69420427097ca27788efd31053ad632d;hb=40aee729b350672c2550640622416a855e27938f;hpb=07342d623b8e1ac9501a36a0da55cbce1117aeaf diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 70e7264c6942..b86c64f90c94 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c @@ -31,14 +31,14 @@ char *defconfig_file; static int indent = 1; static int valid_stdin = 1; static int conf_cnt; -static signed char line[128]; +static char line[128]; static struct menu *rootEntry; static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n"); -static void strip(signed char *str) +static void strip(char *str) { - signed char *p = str; + char *p = str; int l; while ((isspace(*p))) @@ -63,6 +63,20 @@ static void check_stdin(void) } } +static char *fgets_check_stream(char *s, int size, FILE *stream) +{ + char *ret = fgets(s, size, stream); + + if (ret == NULL && feof(stream)) { + printf(_("aborted!\n\n")); + printf(_("Console input is closed. ")); + printf(_("Run 'make oldconfig' to update configuration.\n\n")); + exit(1); + } + + return ret; +} + static void conf_askvalue(struct symbol *sym, const char *def) { enum symbol_type type = sym_get_type(sym); @@ -82,6 +96,15 @@ static void conf_askvalue(struct symbol *sym, const char *def) } switch (input_mode) { + case set_no: + case set_mod: + case set_yes: + case set_random: + if (sym_has_value(sym)) { + printf("%s\n", def); + return; + } + break; case ask_new: case ask_silent: if (sym_has_value(sym)) { @@ -91,7 +114,7 @@ static void conf_askvalue(struct symbol *sym, const char *def) check_stdin(); case ask_all: fflush(stdout); - fgets(line, 128, stdin); + fgets_check_stream(line, 128, stdin); return; case set_default: printf("%s\n", def); @@ -305,8 +328,7 @@ static int conf_choice(struct menu *menu) printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); def_sym = sym_get_choice_value(sym); cnt = def = 0; - line[0] = '0'; - line[1] = 0; + line[0] = 0; for (child = menu->list; child; child = child->next) { if (!menu_is_visible(child)) continue; @@ -347,7 +369,7 @@ static int conf_choice(struct menu *menu) check_stdin(); case ask_all: fflush(stdout); - fgets(line, 128, stdin); + fgets_check_stream(line, 128, stdin); strip(line); if (line[0] == '?') { printf("\n%s\n", menu->sym->help ? @@ -467,15 +489,14 @@ static void check_conf(struct menu *menu) return; sym = menu->sym; - if (sym) { - if (sym_is_changable(sym) && !sym_has_value(sym)) { + if (sym && !sym_has_value(sym)) { + if (sym_is_changable(sym) || + (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { if (!conf_cnt++) printf(_("*\n* Restart config...\n*\n")); rootEntry = menu_get_parent_menu(menu); conf(rootEntry); } - if (sym_is_choice(sym) && sym_get_tristate_value(sym) != mod) - return; } for (child = menu->list; child; child = child->next) @@ -559,6 +580,27 @@ int main(int ac, char **av) case ask_new: conf_read(NULL); break; + case set_no: + case set_mod: + case set_yes: + case set_random: + name = getenv("KCONFIG_ALLCONFIG"); + if (name && !stat(name, &tmpstat)) { + conf_read_simple(name); + break; + } + switch (input_mode) { + case set_no: name = "allno.config"; break; + case set_mod: name = "allmod.config"; break; + case set_yes: name = "allyes.config"; break; + case set_random: name = "allrandom.config"; break; + default: break; + } + if (!stat(name, &tmpstat)) + conf_read_simple(name); + else if (!stat("all.config", &tmpstat)) + conf_read_simple("all.config"); + break; default: break; }