4
0
mirror of https://github.com/RT-Thread/rt-thread.git synced 2025-02-21 01:07:18 +08:00

[tools]: add menconfig silent mode

This commit is contained in:
SummerGift 2018-09-12 20:50:02 +08:00
parent fe77341621
commit c831fae96d

View File

@ -954,20 +954,31 @@ static void conf_save(void)
static int handle_exit(void) static int handle_exit(void)
{ {
int res; int res = 0;
save_and_exit = 1; save_and_exit = 1;
reset_subtitle(); reset_subtitle();
dialog_clear(); dialog_clear();
if (conf_get_changed()) if (conf_get_changed())
{
if (silent)
{
/* save change */
res = 0;
}
else
{
res = dialog_yesno(NULL, res = dialog_yesno(NULL,
_("Do you wish to save your new configuration?\n" _("Do you wish to save your new configuration?\n"
"(Press <ESC><ESC> to continue kernel configuration.)"), "(Press <ESC><ESC> to continue kernel configuration.)"),
6, 60); 6, 60);
}
}
else else
res = -1; res = -1;
end_dialog(saved_x, saved_y); if (!silent) end_dialog(saved_x, saved_y);
switch (res) { switch (res) {
case 0: case 0:
@ -1038,6 +1049,18 @@ int main(int ac, char **av)
set_config_filename(conf_get_configname()); set_config_filename(conf_get_configname());
conf_set_message_callback(conf_message_callback); 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 { do {
conf(&rootmenu, NULL); conf(&rootmenu, NULL);
res = handle_exit(); res = handle_exit();