]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - scripts/kconfig/conf.c
kbuild: fix oldnoconfig to do the right thing
[net-next-2.6.git] / scripts / kconfig / conf.c
index 274f2716b03e9d4b0a5865a86a09b11799359523..7ef429cd5cb38f9bd07889aad8f5ab8f3983e27b 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);
@@ -427,7 +427,7 @@ static void check_conf(struct menu *menu)
                                if (sym->name && !sym_is_choice_value(sym)) {
                                        printf("CONFIG_%s\n", sym->name);
                                }
-                       } else {
+                       } else if (input_mode != oldnoconfig) {
                                if (!conf_cnt++)
                                        printf(_("*\n* Restart config...\n*\n"));
                                rootEntry = menu_get_parent_menu(menu);
@@ -644,3 +644,14 @@ int main(int ac, char **av)
        }
        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");
+}