]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - scripts/kconfig/conf.c
Merge branch 'kbuild/rc-fixes' into kbuild/kconfig
[net-next-2.6.git] / scripts / kconfig / conf.c
index 274f2716b03e9d4b0a5865a86a09b11799359523..5459a38be866064ae103ba5903859a6b53200d40 100644 (file)
@@ -108,7 +108,7 @@ static int conf_askvalue(struct symbol *sym, const char *def)
                check_stdin();
        case oldaskconfig:
                fflush(stdout);
-               fgets(line, 128, stdin);
+               xfgets(line, 128, stdin);
                return 1;
        default:
                break;
@@ -306,7 +306,7 @@ static int conf_choice(struct menu *menu)
                        check_stdin();
                case oldaskconfig:
                        fflush(stdout);
-                       fgets(line, 128, stdin);
+                       xfgets(line, 128, stdin);
                        strip(line);
                        if (line[0] == '?') {
                                print_help(menu);
@@ -425,9 +425,9 @@ static void check_conf(struct menu *menu)
                    (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
                        if (input_mode == listnewconfig) {
                                if (sym->name && !sym_is_choice_value(sym)) {
-                                       printf("CONFIG_%s\n", sym->name);
+                                       printf("%s%s\n", CONFIG_, sym->name);
                                }
-                       } else {
+                       } else if (input_mode != oldnoconfig) {
                                if (!conf_cnt++)
                                        printf(_("*\n* Restart config...\n*\n"));
                                rootEntry = menu_get_parent_menu(menu);
@@ -466,7 +466,7 @@ int main(int ac, char **av)
        bindtextdomain(PACKAGE, LOCALEDIR);
        textdomain(PACKAGE);
 
-       while ((opt = getopt_long_only(ac, av, "", long_opts, NULL)) != -1) {
+       while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
                input_mode = (enum input_mode)opt;
                switch (opt) {
                case silentoldconfig:
@@ -508,8 +508,7 @@ int main(int ac, char **av)
                name = conf_get_configname();
                if (stat(name, &tmpstat)) {
                        fprintf(stderr, _("***\n"
-                               "*** You have not yet configured your kernel!\n"
-                               "*** (missing kernel config file \"%s\")\n"
+                               "*** Configuration file \"%s\" not found!\n"
                                "***\n"
                                "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
                                "*** \"make menuconfig\" or \"make xconfig\").\n"
@@ -571,7 +570,7 @@ int main(int ac, char **av)
                        name = getenv("KCONFIG_NOSILENTUPDATE");
                        if (name && *name) {
                                fprintf(stderr,
-                                       _("\n*** Kernel configuration requires explicit update.\n\n"));
+                                       _("\n*** The configuration requires explicit update.\n\n"));
                                return 1;
                        }
                }
@@ -623,11 +622,11 @@ int main(int ac, char **av)
                 * All other commands are only used to generate a config.
                 */
                if (conf_get_changed() && conf_write(NULL)) {
-                       fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
+                       fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
                        exit(1);
                }
                if (conf_write_autoconf()) {
-                       fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n"));
+                       fprintf(stderr, _("\n*** Error during update of the configuration.\n\n"));
                        return 1;
                }
        } else if (input_mode == savedefconfig) {
@@ -638,9 +637,20 @@ int main(int ac, char **av)
                }
        } else if (input_mode != listnewconfig) {
                if (conf_write(NULL)) {
-                       fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
+                       fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
                        exit(1);
                }
        }
        return 0;
 }
+/*
+ * Helper function to facilitate fgets() by Jean Sacren.
+ */
+void xfgets(str, size, in)
+       char *str;
+       int size;
+       FILE *in;
+{
+       if (fgets(str, size, in) == NULL)
+               fprintf(stderr, "\nError in reading or end of file.\n");
+}