summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/mconf.c
diff options
context:
space:
mode:
authorWang YanQing <udknight@gmail.com>2012-12-19 09:50:58 +0800
committerYann E. MORIN <yann.morin.1998@free.fr>2013-01-16 00:00:34 +0100
commit6364fd0cb1e4c7f72b974613e0cf5744ae4d2cb2 (patch)
tree82ddce27af13bb046b75b89470bb505908affb2b /scripts/kconfig/mconf.c
parent87727d453b4677a21312712c8a4bb5dcd81a1ebe (diff)
downloadlinux-6364fd0cb1e4c7f72b974613e0cf5744ae4d2cb2.tar.bz2
menuconfig: Add Save/Load buttons
If menuconfig have Save/Load button like alternative .config editors, xconfig, nconfig, etc.We will have a obvious benefit when use menuconfig just like when we use others, we can Save/Load our .config quickly and conveniently. This patch add the Save/Load button for menuconfig. [remove trailing space while at it for below line: "*) Formerly when I used Page Down and Page Up, the cursor would be set" ] Changes: V1-V2: 1:use PATH_MAX instead of hard code suggested by Yann E. MORIN 2:drop the spurious empty-line removal suggested by Yann E. MORIN V2-V3: 1:ajust buttons position well centered reported by Yann E. MORIN Signed-off-by: Wang YanQing <udknight@gmail.com> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Diffstat (limited to 'scripts/kconfig/mconf.c')
-rw-r--r--scripts/kconfig/mconf.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 5f29618d1845..88e806857dc3 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -280,6 +280,7 @@ static struct menu *current_menu;
static int child_count;
static int single_menu_mode;
static int show_all_options;
+static int save_and_exit;
static void conf(struct menu *menu, struct menu *active_menu);
static void conf_choice(struct menu *menu);
@@ -657,6 +658,12 @@ static void conf(struct menu *menu, struct menu *active_menu)
show_helptext(_("README"), _(mconf_readme));
break;
case 3:
+ conf_save();
+ break;
+ case 4:
+ conf_load();
+ break;
+ case 5:
if (item_is_tag('t')) {
if (sym_set_tristate_value(sym, yes))
break;
@@ -664,24 +671,24 @@ static void conf(struct menu *menu, struct menu *active_menu)
show_textbox(NULL, setmod_text, 6, 74);
}
break;
- case 4:
+ case 6:
if (item_is_tag('t'))
sym_set_tristate_value(sym, no);
break;
- case 5:
+ case 7:
if (item_is_tag('t'))
sym_set_tristate_value(sym, mod);
break;
- case 6:
+ case 8:
if (item_is_tag('t'))
sym_toggle_tristate_value(sym);
else if (item_is_tag('m'))
conf(submenu, NULL);
break;
- case 7:
+ case 9:
search_conf();
break;
- case 8:
+ case 10:
show_all_options = !show_all_options;
break;
}
@@ -708,6 +715,17 @@ static void show_helptext(const char *title, const char *text)
show_textbox(title, text, 0, 0);
}
+static void conf_message_callback(const char *fmt, va_list ap)
+{
+ char buf[PATH_MAX+1];
+
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ if (save_and_exit)
+ printf("%s", buf);
+ else
+ show_textbox(NULL, buf, 6, 60);
+}
+
static void show_help(struct menu *menu)
{
struct gstr help = str_new();
@@ -876,6 +894,7 @@ static int handle_exit(void)
{
int res;
+ save_and_exit = 1;
dialog_clear();
if (conf_get_changed())
res = dialog_yesno(NULL,
@@ -947,6 +966,7 @@ int main(int ac, char **av)
}
set_config_filename(conf_get_configname());
+ conf_set_message_callback(conf_message_callback);
do {
conf(&rootmenu, NULL);
res = handle_exit();