[tools]: add menconfig silent mode

This commit is contained in:
SummerGift 2018-09-12 20:50:02 +08:00
parent fe77341621
commit c831fae96d
1 changed files with 734 additions and 711 deletions

View File

@ -954,20 +954,31 @@ static void conf_save(void)
static int handle_exit(void)
{
int res;
int res = 0;
save_and_exit = 1;
reset_subtitle();
dialog_clear();
if (conf_get_changed())
{
if (silent)
{
/* save change */
res = 0;
}
else
{
res = dialog_yesno(NULL,
_("Do you wish to save your new configuration?\n"
"(Press <ESC><ESC> to continue kernel configuration.)"),
6, 60);
}
}
else
res = -1;
end_dialog(saved_x, saved_y);
if (!silent) end_dialog(saved_x, saved_y);
switch (res) {
case 0:
@ -1038,6 +1049,18 @@ int main(int ac, char **av)
set_config_filename(conf_get_configname());
conf_set_message_callback(conf_message_callback);
if (ac > 2 && strcmp(av[2], "-n") == 0)
{
fprintf(stderr, N_("Debug mode,don't display menuconfig window.\n"));
silent = 1;
/* Silence conf_read() until the real callback is set up */
conf_set_message_callback(NULL);
av++;
res = handle_exit();
return 1;
}
do {
conf(&rootmenu, NULL);
res = handle_exit();