diff options
Diffstat (limited to 'scripts/kconfig/nconf.c')
-rw-r--r-- | scripts/kconfig/nconf.c | 51 |
1 files changed, 9 insertions, 42 deletions
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index a2969fdc66b4..272a987f23e0 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c | |||
@@ -645,25 +645,6 @@ static const char *set_config_filename(const char *config_filename) | |||
645 | return menu_backtitle; | 645 | return menu_backtitle; |
646 | } | 646 | } |
647 | 647 | ||
648 | /* command = 0 is supress, 1 is restore */ | ||
649 | static void supress_stdout(int command) | ||
650 | { | ||
651 | static FILE *org_stdout; | ||
652 | static FILE *org_stderr; | ||
653 | |||
654 | if (command == 0) { | ||
655 | org_stdout = stdout; | ||
656 | org_stderr = stderr; | ||
657 | stdout = fopen("/dev/null", "a"); | ||
658 | stderr = fopen("/dev/null", "a"); | ||
659 | } else { | ||
660 | fclose(stdout); | ||
661 | fclose(stderr); | ||
662 | stdout = org_stdout; | ||
663 | stderr = org_stderr; | ||
664 | } | ||
665 | } | ||
666 | |||
667 | /* return = 0 means we are successful. | 648 | /* return = 0 means we are successful. |
668 | * -1 means go on doing what you were doing | 649 | * -1 means go on doing what you were doing |
669 | */ | 650 | */ |
@@ -688,9 +669,7 @@ static int do_exit(void) | |||
688 | /* if we got here, the user really wants to exit */ | 669 | /* if we got here, the user really wants to exit */ |
689 | switch (res) { | 670 | switch (res) { |
690 | case 0: | 671 | case 0: |
691 | supress_stdout(0); | ||
692 | res = conf_write(filename); | 672 | res = conf_write(filename); |
693 | supress_stdout(1); | ||
694 | if (res) | 673 | if (res) |
695 | btn_dialog( | 674 | btn_dialog( |
696 | main_window, | 675 | main_window, |
@@ -698,19 +677,6 @@ static int do_exit(void) | |||
698 | "Your configuration changes were NOT saved."), | 677 | "Your configuration changes were NOT saved."), |
699 | 1, | 678 | 1, |
700 | "<OK>"); | 679 | "<OK>"); |
701 | else { | ||
702 | char buf[1024]; | ||
703 | snprintf(buf, 1024, | ||
704 | _("Configuration written to %s\n" | ||
705 | "End of the configuration.\n" | ||
706 | "Execute 'make' to start the build or try" | ||
707 | " 'make help'."), filename); | ||
708 | btn_dialog( | ||
709 | main_window, | ||
710 | buf, | ||
711 | 1, | ||
712 | "<OK>"); | ||
713 | } | ||
714 | break; | 680 | break; |
715 | default: | 681 | default: |
716 | btn_dialog( | 682 | btn_dialog( |
@@ -1246,6 +1212,14 @@ static void conf(struct menu *menu) | |||
1246 | } | 1212 | } |
1247 | } | 1213 | } |
1248 | 1214 | ||
1215 | static void conf_message_callback(const char *fmt, va_list ap) | ||
1216 | { | ||
1217 | char buf[1024]; | ||
1218 | |||
1219 | vsnprintf(buf, sizeof(buf), fmt, ap); | ||
1220 | btn_dialog(main_window, buf, 1, "<OK>"); | ||
1221 | } | ||
1222 | |||
1249 | static void show_help(struct menu *menu) | 1223 | static void show_help(struct menu *menu) |
1250 | { | 1224 | { |
1251 | struct gstr help = str_new(); | 1225 | struct gstr help = str_new(); |
@@ -1470,16 +1444,8 @@ static void conf_save(void) | |||
1470 | case 0: | 1444 | case 0: |
1471 | if (!dialog_input_result[0]) | 1445 | if (!dialog_input_result[0]) |
1472 | return; | 1446 | return; |
1473 | supress_stdout(0); | ||
1474 | res = conf_write(dialog_input_result); | 1447 | res = conf_write(dialog_input_result); |
1475 | supress_stdout(1); | ||
1476 | if (!res) { | 1448 | if (!res) { |
1477 | char buf[1024]; | ||
1478 | sprintf(buf, "%s %s", | ||
1479 | _("configuration file saved to: "), | ||
1480 | dialog_input_result); | ||
1481 | btn_dialog(main_window, | ||
1482 | buf, 1, "<OK>"); | ||
1483 | set_config_filename(dialog_input_result); | 1449 | set_config_filename(dialog_input_result); |
1484 | return; | 1450 | return; |
1485 | } | 1451 | } |
@@ -1572,6 +1538,7 @@ int main(int ac, char **av) | |||
1572 | _(menu_no_f_instructions)); | 1538 | _(menu_no_f_instructions)); |
1573 | } | 1539 | } |
1574 | 1540 | ||
1541 | conf_set_message_callback(conf_message_callback); | ||
1575 | /* do the work */ | 1542 | /* do the work */ |
1576 | while (!global_exit) { | 1543 | while (!global_exit) { |
1577 | conf(&rootmenu); | 1544 | conf(&rootmenu); |