]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - scripts/kconfig/conf.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
[linux-2.6-omap-h63xx.git] / scripts / kconfig / conf.c
index 8012d1076876bb1f4ee9766a63720f0e53d9f829..8be6a4269e63b8864a0a6472443381f2372cbe55 100644 (file)
@@ -37,6 +37,14 @@ static struct menu *rootEntry;
 
 static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n");
 
+static const char *get_help(struct menu *menu)
+{
+       if (menu_has_help(menu))
+               return menu_get_help(menu);
+       else
+               return nohelp_text;
+}
+
 static void strip(char *str)
 {
        char *p = str;
@@ -171,7 +179,7 @@ static void conf_askvalue(struct symbol *sym, const char *def)
 int conf_string(struct menu *menu)
 {
        struct symbol *sym = menu->sym;
-       const char *def, *help;
+       const char *def;
 
        while (1) {
                printf("%*s%s ", indent - 1, "", menu->prompt->text);
@@ -186,10 +194,7 @@ int conf_string(struct menu *menu)
                case '?':
                        /* print help */
                        if (line[1] == '\n') {
-                               help = nohelp_text;
-                               if (menu->sym->help)
-                                       help = menu->sym->help;
-                               printf("\n%s\n", menu->sym->help);
+                               printf("\n%s\n", get_help(menu));
                                def = NULL;
                                break;
                        }
@@ -207,7 +212,6 @@ static int conf_sym(struct menu *menu)
        struct symbol *sym = menu->sym;
        int type;
        tristate oldval, newval;
-       const char *help;
 
        while (1) {
                printf("%*s%s ", indent - 1, "", menu->prompt->text);
@@ -233,7 +237,7 @@ static int conf_sym(struct menu *menu)
                        printf("/m");
                if (oldval != yes && sym_tristate_within_range(sym, yes))
                        printf("/y");
-               if (sym->help)
+               if (menu_has_help(menu))
                        printf("/?");
                printf("] ");
                conf_askvalue(sym, sym_get_string_value(sym));
@@ -269,10 +273,7 @@ static int conf_sym(struct menu *menu)
                if (sym_set_tristate_value(sym, newval))
                        return 0;
 help:
-               help = nohelp_text;
-               if (sym->help)
-                       help = sym->help;
-               printf("\n%s\n", help);
+               printf("\n%s\n", get_help(menu));
        }
 }
 
@@ -342,7 +343,7 @@ static int conf_choice(struct menu *menu)
                        goto conf_childs;
                }
                printf("[1-%d", cnt);
-               if (sym->help)
+               if (menu_has_help(menu))
                        printf("?");
                printf("]: ");
                switch (input_mode) {
@@ -359,8 +360,7 @@ static int conf_choice(struct menu *menu)
                        fgets(line, 128, stdin);
                        strip(line);
                        if (line[0] == '?') {
-                               printf("\n%s\n", menu->sym->help ?
-                                       menu->sym->help : nohelp_text);
+                               printf("\n%s\n", get_help(menu));
                                continue;
                        }
                        if (!line[0])
@@ -391,8 +391,7 @@ static int conf_choice(struct menu *menu)
                if (!child)
                        continue;
                if (line[strlen(line) - 1] == '?') {
-                       printf("\n%s\n", child->sym->help ?
-                               child->sym->help : nohelp_text);
+                       printf("\n%s\n", get_help(child));
                        continue;
                }
                sym_set_choice_value(sym, child->sym);
@@ -539,6 +538,7 @@ int main(int ac, char **av)
        name = av[i];
        if (!name) {
                printf(_("%s: Kconfig file missing\n"), av[0]);
+               exit(1);
        }
        conf_parse(name);
        //zconfdump(stdout);
@@ -557,6 +557,7 @@ int main(int ac, char **av)
                if (stat(".config", &tmpstat)) {
                        printf(_("***\n"
                                "*** You have not yet configured your kernel!\n"
+                               "*** (missing kernel .config file)\n"
                                "***\n"
                                "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
                                "*** \"make menuconfig\" or \"make xconfig\").\n"
@@ -573,7 +574,7 @@ int main(int ac, char **av)
        case set_random:
                name = getenv("KCONFIG_ALLCONFIG");
                if (name && !stat(name, &tmpstat)) {
-                       conf_read_simple(name);
+                       conf_read_simple(name, S_DEF_USER);
                        break;
                }
                switch (input_mode) {
@@ -584,9 +585,9 @@ int main(int ac, char **av)
                default: break;
                }
                if (!stat(name, &tmpstat))
-                       conf_read_simple(name);
+                       conf_read_simple(name, S_DEF_USER);
                else if (!stat("all.config", &tmpstat))
-                       conf_read_simple("all.config");
+                       conf_read_simple("all.config", S_DEF_USER);
                break;
        default:
                break;
@@ -599,7 +600,15 @@ int main(int ac, char **av)
                        input_mode = ask_silent;
                        valid_stdin = 1;
                }
-       }
+       } else if (conf_get_changed()) {
+               name = getenv("KCONFIG_NOSILENTUPDATE");
+               if (name && *name) {
+                       fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n"));
+                       return 1;
+               }
+       } else
+               goto skip_check;
+
        do {
                conf_cnt = 0;
                check_conf(&rootmenu);
@@ -608,5 +617,11 @@ int main(int ac, char **av)
                fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
                return 1;
        }
+skip_check:
+       if (input_mode == ask_silent && conf_write_autoconf()) {
+               fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
+               return 1;
+       }
+
        return 0;
 }