diff options
Diffstat (limited to 'scripts/kconfig/conf.c')
-rw-r--r-- | scripts/kconfig/conf.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 274f2716b03e..5459a38be866 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -108,7 +108,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
108 | check_stdin(); | 108 | check_stdin(); |
109 | case oldaskconfig: | 109 | case oldaskconfig: |
110 | fflush(stdout); | 110 | fflush(stdout); |
111 | fgets(line, 128, stdin); | 111 | xfgets(line, 128, stdin); |
112 | return 1; | 112 | return 1; |
113 | default: | 113 | default: |
114 | break; | 114 | break; |
@@ -306,7 +306,7 @@ static int conf_choice(struct menu *menu) | |||
306 | check_stdin(); | 306 | check_stdin(); |
307 | case oldaskconfig: | 307 | case oldaskconfig: |
308 | fflush(stdout); | 308 | fflush(stdout); |
309 | fgets(line, 128, stdin); | 309 | xfgets(line, 128, stdin); |
310 | strip(line); | 310 | strip(line); |
311 | if (line[0] == '?') { | 311 | if (line[0] == '?') { |
312 | print_help(menu); | 312 | print_help(menu); |
@@ -425,9 +425,9 @@ static void check_conf(struct menu *menu) | |||
425 | (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { | 425 | (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { |
426 | if (input_mode == listnewconfig) { | 426 | if (input_mode == listnewconfig) { |
427 | if (sym->name && !sym_is_choice_value(sym)) { | 427 | if (sym->name && !sym_is_choice_value(sym)) { |
428 | printf("CONFIG_%s\n", sym->name); | 428 | printf("%s%s\n", CONFIG_, sym->name); |
429 | } | 429 | } |
430 | } else { | 430 | } else if (input_mode != oldnoconfig) { |
431 | if (!conf_cnt++) | 431 | if (!conf_cnt++) |
432 | printf(_("*\n* Restart config...\n*\n")); | 432 | printf(_("*\n* Restart config...\n*\n")); |
433 | rootEntry = menu_get_parent_menu(menu); | 433 | rootEntry = menu_get_parent_menu(menu); |
@@ -466,7 +466,7 @@ int main(int ac, char **av) | |||
466 | bindtextdomain(PACKAGE, LOCALEDIR); | 466 | bindtextdomain(PACKAGE, LOCALEDIR); |
467 | textdomain(PACKAGE); | 467 | textdomain(PACKAGE); |
468 | 468 | ||
469 | while ((opt = getopt_long_only(ac, av, "", long_opts, NULL)) != -1) { | 469 | while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { |
470 | input_mode = (enum input_mode)opt; | 470 | input_mode = (enum input_mode)opt; |
471 | switch (opt) { | 471 | switch (opt) { |
472 | case silentoldconfig: | 472 | case silentoldconfig: |
@@ -508,8 +508,7 @@ int main(int ac, char **av) | |||
508 | name = conf_get_configname(); | 508 | name = conf_get_configname(); |
509 | if (stat(name, &tmpstat)) { | 509 | if (stat(name, &tmpstat)) { |
510 | fprintf(stderr, _("***\n" | 510 | fprintf(stderr, _("***\n" |
511 | "*** You have not yet configured your kernel!\n" | 511 | "*** Configuration file \"%s\" not found!\n" |
512 | "*** (missing kernel config file \"%s\")\n" | ||
513 | "***\n" | 512 | "***\n" |
514 | "*** Please run some configurator (e.g. \"make oldconfig\" or\n" | 513 | "*** Please run some configurator (e.g. \"make oldconfig\" or\n" |
515 | "*** \"make menuconfig\" or \"make xconfig\").\n" | 514 | "*** \"make menuconfig\" or \"make xconfig\").\n" |
@@ -571,7 +570,7 @@ int main(int ac, char **av) | |||
571 | name = getenv("KCONFIG_NOSILENTUPDATE"); | 570 | name = getenv("KCONFIG_NOSILENTUPDATE"); |
572 | if (name && *name) { | 571 | if (name && *name) { |
573 | fprintf(stderr, | 572 | fprintf(stderr, |
574 | _("\n*** Kernel configuration requires explicit update.\n\n")); | 573 | _("\n*** The configuration requires explicit update.\n\n")); |
575 | return 1; | 574 | return 1; |
576 | } | 575 | } |
577 | } | 576 | } |
@@ -623,11 +622,11 @@ int main(int ac, char **av) | |||
623 | * All other commands are only used to generate a config. | 622 | * All other commands are only used to generate a config. |
624 | */ | 623 | */ |
625 | if (conf_get_changed() && conf_write(NULL)) { | 624 | if (conf_get_changed() && conf_write(NULL)) { |
626 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | 625 | fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n")); |
627 | exit(1); | 626 | exit(1); |
628 | } | 627 | } |
629 | if (conf_write_autoconf()) { | 628 | if (conf_write_autoconf()) { |
630 | fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n")); | 629 | fprintf(stderr, _("\n*** Error during update of the configuration.\n\n")); |
631 | return 1; | 630 | return 1; |
632 | } | 631 | } |
633 | } else if (input_mode == savedefconfig) { | 632 | } else if (input_mode == savedefconfig) { |
@@ -638,9 +637,20 @@ int main(int ac, char **av) | |||
638 | } | 637 | } |
639 | } else if (input_mode != listnewconfig) { | 638 | } else if (input_mode != listnewconfig) { |
640 | if (conf_write(NULL)) { | 639 | if (conf_write(NULL)) { |
641 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | 640 | fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n")); |
642 | exit(1); | 641 | exit(1); |
643 | } | 642 | } |
644 | } | 643 | } |
645 | return 0; | 644 | return 0; |
646 | } | 645 | } |
646 | /* | ||
647 | * Helper function to facilitate fgets() by Jean Sacren. | ||
648 | */ | ||
649 | void xfgets(str, size, in) | ||
650 | char *str; | ||
651 | int size; | ||
652 | FILE *in; | ||
653 | { | ||
654 | if (fgets(str, size, in) == NULL) | ||
655 | fprintf(stderr, "\nError in reading or end of file.\n"); | ||
656 | } | ||