summaryrefslogtreecommitdiff
path: root/package/config/mconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'package/config/mconf.c')
-rw-r--r--package/config/mconf.c43
1 files changed, 31 insertions, 12 deletions
diff --git a/package/config/mconf.c b/package/config/mconf.c
index 3288822f1..9b7284757 100644
--- a/package/config/mconf.c
+++ b/package/config/mconf.c
@@ -26,7 +26,6 @@
#include "lkc.h"
#include "lxdialog/dialog.h"
-static char menu_backtitle[128];
static const char mconf_readme[] = N_(
"Overview\n"
"--------\n"
@@ -269,7 +268,6 @@ search_help[] = N_(
" USB$ => find all CONFIG_ symbols ending with USB\n"
"\n");
-static char filename[PATH_MAX+1] = ".config";
static int indent;
static struct termios ios_org;
static int rows = 0, cols = 0;
@@ -393,6 +391,28 @@ static struct gstr get_relations_str(struct symbol **sym_arr)
return res;
}
+static char filename[PATH_MAX+1];
+static void set_config_filename(const char *config_filename)
+{
+ static char menu_backtitle[PATH_MAX+128];
+ int size;
+ struct symbol *sym;
+
+ sym = sym_lookup("VERSION", 0);
+ sym_calc_value(sym);
+ size = snprintf(menu_backtitle, sizeof(menu_backtitle),
+ _("%s - buildroot v%s Configuration"),
+ config_filename, sym_get_string_value(sym));
+ if (size >= sizeof(menu_backtitle))
+ menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
+ set_dialog_backtitle(menu_backtitle);
+
+ size = snprintf(filename, sizeof(filename), "%s", config_filename);
+ if (size >= sizeof(filename))
+ filename[sizeof(filename)-1] = '\0';
+}
+
+
static void search_conf(void)
{
struct symbol **sym_arr;
@@ -814,8 +834,10 @@ static void conf_load(void)
case 0:
if (!dialog_input_result[0])
return;
- if (!conf_read(dialog_input_result))
+ if (!conf_read(dialog_input_result)) {
+ set_config_filename(dialog_input_result);
return;
+ }
show_textbox(NULL, _("File does not exist!"), 5, 38);
break;
case 1:
@@ -838,8 +860,10 @@ static void conf_save(void)
case 0:
if (!dialog_input_result[0])
return;
- if (!conf_write(dialog_input_result))
+ if (!conf_write(dialog_input_result)) {
+ set_config_filename(dialog_input_result);
return;
+ }
show_textbox(NULL, _("Can't create file! Probably a nonexistent directory."), 5, 60);
break;
case 1:
@@ -858,7 +882,6 @@ static void conf_cleanup(void)
int main(int ac, char **av)
{
- struct symbol *sym;
char *mode;
int res;
@@ -869,11 +892,6 @@ int main(int ac, char **av)
conf_parse(av[1]);
conf_read(NULL);
- sym = sym_lookup("VERSION", 0);
- sym_calc_value(sym);
- sprintf(menu_backtitle, _("Buildroot v%s Configuration"),
- sym_get_string_value(sym));
-
mode = getenv("MENUCONFIG_MODE");
if (mode) {
if (!strcasecmp(mode, "single_menu"))
@@ -884,7 +902,8 @@ int main(int ac, char **av)
atexit(conf_cleanup);
init_wsize();
reset_dialog();
- init_dialog(menu_backtitle);
+ init_dialog(NULL);
+ set_config_filename(conf_get_configname());
do {
conf(&rootmenu);
dialog_clear();
@@ -901,7 +920,7 @@ int main(int ac, char **av)
switch (res) {
case 0:
- if (conf_write(NULL)) {
+ if (conf_write(filename)) {
fprintf(stderr, _("\n\n"
"Error during writing of the Buildroot configuration.\n"
"Your Buildroot configuration changes were NOT saved."