diff options
author | Michal Marek <mmarek@suse.cz> | 2010-10-28 00:54:25 +0200 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-10-28 00:54:25 +0200 |
commit | 70c74e59db7450d5c9164abeb3b6752f8045288b (patch) | |
tree | 1a9b3c6e3c0adee80c7ddc8e86dcf746574fb37b /scripts/kconfig/nconf.c | |
parent | b3235fe420edf7faf5e8e67b978b12d5524fb161 (diff) | |
parent | 42368c37fbd51f7b478d041ae55c5df000897158 (diff) | |
download | linux-70c74e59db7450d5c9164abeb3b6752f8045288b.tar.bz2 |
Merge branch 'message-callback' into kbuild/kconfig
Conflicts:
scripts/kconfig/nconf.c
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) return menu_backtitle; } -/* command = 0 is supress, 1 is restore */ -static void supress_stdout(int command) -{ - static FILE *org_stdout; - static FILE *org_stderr; - - if (command == 0) { - org_stdout = stdout; - org_stderr = stderr; - stdout = fopen("/dev/null", "a"); - stderr = fopen("/dev/null", "a"); - } else { - fclose(stdout); - fclose(stderr); - stdout = org_stdout; - stderr = org_stderr; - } -} - /* return = 0 means we are successful. * -1 means go on doing what you were doing */ @@ -688,9 +669,7 @@ static int do_exit(void) /* if we got here, the user really wants to exit */ switch (res) { case 0: - supress_stdout(0); res = conf_write(filename); - supress_stdout(1); if (res) btn_dialog( main_window, @@ -698,19 +677,6 @@ static int do_exit(void) "Your configuration changes were NOT saved."), 1, "<OK>"); - else { - char buf[1024]; - snprintf(buf, 1024, - _("Configuration written to %s\n" - "End of the configuration.\n" - "Execute 'make' to start the build or try" - " 'make help'."), filename); - btn_dialog( - main_window, - buf, - 1, - "<OK>"); - } break; default: btn_dialog( @@ -1246,6 +1212,14 @@ static void conf(struct menu *menu) } } +static void conf_message_callback(const char *fmt, va_list ap) +{ + char buf[1024]; + + vsnprintf(buf, sizeof(buf), fmt, ap); + btn_dialog(main_window, buf, 1, "<OK>"); +} + static void show_help(struct menu *menu) { struct gstr help = str_new(); @@ -1470,16 +1444,8 @@ static void conf_save(void) case 0: if (!dialog_input_result[0]) return; - supress_stdout(0); res = conf_write(dialog_input_result); - supress_stdout(1); if (!res) { - char buf[1024]; - sprintf(buf, "%s %s", - _("configuration file saved to: "), - dialog_input_result); - btn_dialog(main_window, - buf, 1, "<OK>"); set_config_filename(dialog_input_result); return; } @@ -1572,6 +1538,7 @@ int main(int ac, char **av) _(menu_no_f_instructions)); } + conf_set_message_callback(conf_message_callback); /* do the work */ while (!global_exit) { conf(&rootmenu); |