X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=scripts%2Fkconfig%2Fmconf.c;h=bc5854ed60554e9459fca037ff507ed4f7e79d16;hb=b981d8b3f5e008ff10d993be633ad00564fc22cd;hp=3f9a1321b3e60caa47418b72beba0d27f6e118f3;hpb=ee2fae03d68e702866a8661fbee7ff2f2f3754d7;p=linux-2.6-omap-h63xx.git diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 3f9a1321b3e..bc5854ed605 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/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" @@ -271,7 +270,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; @@ -395,15 +393,39 @@ 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("KERNELVERSION", 0); + sym_calc_value(sym); + size = snprintf(menu_backtitle, sizeof(menu_backtitle), + _("%s - Linux Kernel 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; struct gstr res; + char *dialog_input; int dres; again: dialog_clear(); dres = dialog_inputbox(_("Search Configuration Parameter"), - _("Enter CONFIG_ (sub)string to search for (omit CONFIG_)"), + _("Enter CONFIG_ (sub)string to search for " + "(with or without \"CONFIG\")"), 10, 75, ""); switch (dres) { case 0: @@ -415,7 +437,12 @@ again: return; } - sym_arr = sym_re_search(dialog_input_result); + /* strip CONFIG_ if necessary */ + dialog_input = dialog_input_result; + if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0) + dialog_input += 7; + + sym_arr = sym_re_search(dialog_input); res = get_relations_str(sym_arr); free(sym_arr); show_textbox(_("Search Results"), str_get(&res), 0, 0); @@ -698,11 +725,11 @@ static void show_help(struct menu *menu) struct gstr help = str_new(); struct symbol *sym = menu->sym; - if (sym->help) + if (menu_has_help(menu)) { if (sym->name) { str_printf(&help, "CONFIG_%s:\n\n", sym->name); - str_append(&help, _(sym->help)); + str_append(&help, _(menu_get_help(menu))); str_append(&help, "\n"); } } else { @@ -816,8 +843,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: @@ -840,8 +869,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: @@ -860,7 +891,6 @@ static void conf_cleanup(void) int main(int ac, char **av) { - struct symbol *sym; char *mode; int res; @@ -871,11 +901,6 @@ int main(int ac, char **av) conf_parse(av[1]); conf_read(NULL); - sym = sym_lookup("KERNELVERSION", 0); - sym_calc_value(sym); - sprintf(menu_backtitle, _("Linux Kernel v%s Configuration"), - sym_get_string_value(sym)); - mode = getenv("MENUCONFIG_MODE"); if (mode) { if (!strcasecmp(mode, "single_menu")) @@ -886,7 +911,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(); @@ -903,7 +929,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 kernel configuration.\n" "Your kernel configuration changes were NOT saved."