aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/nconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/kconfig/nconf.c')
-rw-r--r--scripts/kconfig/nconf.c51
1 files changed, 9 insertions, 42 deletions
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 18a215de9f36..16233a9382c8 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -651,25 +651,6 @@ static const char *set_config_filename(const char *config_filename)
651 return menu_backtitle; 651 return menu_backtitle;
652} 652}
653 653
654/* command = 0 is supress, 1 is restore */
655static void supress_stdout(int command)
656{
657 static FILE *org_stdout;
658 static FILE *org_stderr;
659
660 if (command == 0) {
661 org_stdout = stdout;
662 org_stderr = stderr;
663 stdout = fopen("/dev/null", "a");
664 stderr = fopen("/dev/null", "a");
665 } else {
666 fclose(stdout);
667 fclose(stderr);
668 stdout = org_stdout;
669 stderr = org_stderr;
670 }
671}
672
673/* return = 0 means we are successful. 654/* return = 0 means we are successful.
674 * -1 means go on doing what you were doing 655 * -1 means go on doing what you were doing
675 */ 656 */
@@ -695,9 +676,7 @@ static int do_exit(void)
695 /* if we got here, the user really wants to exit */ 676 /* if we got here, the user really wants to exit */
696 switch (res) { 677 switch (res) {
697 case 0: 678 case 0:
698 supress_stdout(0);
699 res = conf_write(filename); 679 res = conf_write(filename);
700 supress_stdout(1);
701 if (res) 680 if (res)
702 btn_dialog( 681 btn_dialog(
703 main_window, 682 main_window,
@@ -707,19 +686,6 @@ static int do_exit(void)
707 "changes were NOT saved."), 686 "changes were NOT saved."),
708 1, 687 1,
709 "<OK>"); 688 "<OK>");
710 else {
711 char buf[1024];
712 snprintf(buf, 1024,
713 _("Configuration written to %s\n"
714 "End of Linux kernel configuration.\n"
715 "Execute 'make' to build the kernel or try"
716 " 'make help'."), filename);
717 btn_dialog(
718 main_window,
719 buf,
720 1,
721 "<OK>");
722 }
723 break; 689 break;
724 default: 690 default:
725 btn_dialog( 691 btn_dialog(
@@ -1255,6 +1221,14 @@ static void conf(struct menu *menu)
1255 } 1221 }
1256} 1222}
1257 1223
1224static void conf_message_callback(const char *fmt, va_list ap)
1225{
1226 char buf[1024];
1227
1228 vsnprintf(buf, sizeof(buf), fmt, ap);
1229 btn_dialog(main_window, buf, 1, "<OK>");
1230}
1231
1258static void show_help(struct menu *menu) 1232static void show_help(struct menu *menu)
1259{ 1233{
1260 struct gstr help = str_new(); 1234 struct gstr help = str_new();
@@ -1477,16 +1451,8 @@ static void conf_save(void)
1477 case 0: 1451 case 0:
1478 if (!dialog_input_result[0]) 1452 if (!dialog_input_result[0])
1479 return; 1453 return;
1480 supress_stdout(0);
1481 res = conf_write(dialog_input_result); 1454 res = conf_write(dialog_input_result);
1482 supress_stdout(1);
1483 if (!res) { 1455 if (!res) {
1484 char buf[1024];
1485 sprintf(buf, "%s %s",
1486 _("configuration file saved to: "),
1487 dialog_input_result);
1488 btn_dialog(main_window,
1489 buf, 1, "<OK>");
1490 set_config_filename(dialog_input_result); 1456 set_config_filename(dialog_input_result);
1491 return; 1457 return;
1492 } 1458 }
@@ -1579,6 +1545,7 @@ int main(int ac, char **av)
1579 _(menu_no_f_instructions)); 1545 _(menu_no_f_instructions));
1580 } 1546 }
1581 1547
1548 conf_set_message_callback(conf_message_callback);
1582 /* do the work */ 1549 /* do the work */
1583 while (!global_exit) { 1550 while (!global_exit) {
1584 conf(&rootmenu); 1551 conf(&rootmenu);