summaryrefslogtreecommitdiff
path: root/kconfig/mconf.c
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-05-08 12:14:40 (GMT)
committerYann E. MORIN" <yann.morin.1998@anciens.enib.fr>2011-05-08 12:14:40 (GMT)
commit084a8e18f5abd15c9da9c56ada4fad8d0d18102c (patch)
treefea23cce64bf8c7522358126a344b9c807e548f0 /kconfig/mconf.c
parentdb796067af710f04e73eecdd46a8403ac7ce89f9 (diff)
kconfig: update from linux-next
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Diffstat (limited to 'kconfig/mconf.c')
-rw-r--r--kconfig/mconf.c194
1 files changed, 67 insertions, 127 deletions
diff --git a/kconfig/mconf.c b/kconfig/mconf.c
index d196edc..d433c7a 100644
--- a/kconfig/mconf.c
+++ b/kconfig/mconf.c
@@ -25,11 +25,9 @@
static const char mconf_readme[] = N_(
"Overview\n"
"--------\n"
-"Some kernel features may be built directly into the kernel.\n"
-"Some may be made into loadable runtime modules. Some features\n"
-"may be completely removed altogether. There are also certain\n"
-"kernel parameters which are not really features, but must be\n"
-"entered in as decimal or hexadecimal numbers or possibly text.\n"
+"This interface let you select features and parameters for the build.\n"
+"Features can either be built-in, modularized, or ignored. Parameters\n"
+"must be entered in as decimal or hexadecimal numbers or text.\n"
"\n"
"Menu items beginning with following braces represent features that\n"
" [ ] can be built in or removed\n"
@@ -67,13 +65,15 @@ static const char mconf_readme[] = N_(
" there is a delayed response which you may find annoying.\n"
"\n"
" Also, the <TAB> and cursor keys will cycle between <Select>,\n"
-" <Exit> and <Help>\n"
+" <Exit> and <Help>.\n"
"\n"
"o To get help with an item, use the cursor keys to highlight <Help>\n"
-" and Press <ENTER>.\n"
+" and press <ENTER>.\n"
"\n"
" Shortcut: Press <H> or <?>.\n"
"\n"
+"o To toggle the display of hidden options, press <Z>.\n"
+"\n"
"\n"
"Radiolists (Choice lists)\n"
"-----------\n"
@@ -115,7 +115,7 @@ static const char mconf_readme[] = N_(
"-----------------------------\n"
"Menuconfig supports the use of alternate configuration files for\n"
"those who, for various reasons, find it necessary to switch\n"
-"between different kernel configurations.\n"
+"between different configurations.\n"
"\n"
"At the end of the main menu you will find two options. One is\n"
"for saving the current configuration to a file of your choosing.\n"
@@ -148,9 +148,9 @@ static const char mconf_readme[] = N_(
"\n"
"Optional personality available\n"
"------------------------------\n"
-"If you prefer to have all of the kernel options listed in a single\n"
-"menu, rather than the default multimenu hierarchy, run the menuconfig\n"
-"with MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
+"If you prefer to have all of the options listed in a single menu, rather\n"
+"than the default multimenu hierarchy, run the menuconfig with\n"
+"MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
"\n"
"make MENUCONFIG_MODE=single_menu menuconfig\n"
"\n"
@@ -199,30 +199,28 @@ inputbox_instructions_string[] = N_(
setmod_text[] = N_(
"This feature depends on another which has been configured as a module.\n"
"As a result, this feature will be built as a module."),
-nohelp_text[] = N_(
- "There is no help available for this kernel option.\n"),
load_config_text[] = N_(
"Enter the name of the configuration file you wish to load. "
"Accept the name shown to restore the configuration you "
"last retrieved. Leave blank to abort."),
load_config_help[] = N_(
"\n"
- "For various reasons, one may wish to keep several different kernel\n"
+ "For various reasons, one may wish to keep several different\n"
"configurations available on a single machine.\n"
"\n"
"If you have saved a previous configuration in a file other than the\n"
- "kernel's default, entering the name of the file here will allow you\n"
- "to modify that configuration.\n"
+ "default one, entering its name here will allow you to modify that\n"
+ "configuration.\n"
"\n"
"If you are uncertain, then you have probably never used alternate\n"
- "configuration files. You should therefor leave this blank to abort.\n"),
+ "configuration files. You should therefore leave this blank to abort.\n"),
save_config_text[] = N_(
"Enter a filename to which this configuration should be saved "
"as an alternate. Leave blank to abort."),
save_config_help[] = N_(
"\n"
- "For various reasons, one may wish to keep different kernel\n"
- "configurations available on a single machine.\n"
+ "For various reasons, one may wish to keep different configurations\n"
+ "available on a single machine.\n"
"\n"
"Entering a file name here will allow you to later retrieve, modify\n"
"and use the current configuration as an alternate to whatever\n"
@@ -232,7 +230,7 @@ save_config_help[] = N_(
"leave this blank.\n"),
search_help[] = N_(
"\n"
- "Search for CT_ symbols and display their relations.\n"
+ "Search for symbols and display their relations.\n"
"Regular expressions are allowed.\n"
"Example: search for \"^FOO\"\n"
"Result:\n"
@@ -249,7 +247,7 @@ search_help[] = N_(
"Selected by: BAR\n"
"-----------------------------------------------------------------\n"
"o The line 'Prompt:' shows the text used in the menu structure for\n"
- " this CT_ symbol\n"
+ " this symbol\n"
"o The 'Defined at' line tell at what file / line number the symbol\n"
" is defined\n"
"o The 'Depends on:' line tell what symbols needs to be defined for\n"
@@ -265,15 +263,16 @@ search_help[] = N_(
"Only relevant lines are shown.\n"
"\n\n"
"Search examples:\n"
- "Examples: USB => find all CT_ symbols containing USB\n"
- " ^USB => find all CT_ symbols starting with USB\n"
- " USB$ => find all CT_ symbols ending with USB\n"
+ "Examples: USB => find all symbols containing USB\n"
+ " ^USB => find all symbols starting with USB\n"
+ " USB$ => find all symbols ending with USB\n"
"\n");
static int indent;
static struct menu *current_menu;
static int child_count;
static int single_menu_mode;
+static int show_all_options;
static void conf(struct menu *menu);
static void conf_choice(struct menu *menu);
@@ -284,91 +283,14 @@ static void show_textbox(const char *title, const char *text, int r, int c);
static void show_helptext(const char *title, const char *text);
static void show_help(struct menu *menu);
-static void get_prompt_str(struct gstr *r, struct property *prop)
-{
- int i, j;
- struct menu *submenu[8], *menu;
-
- str_printf(r, _("Prompt: %s\n"), _(prop->text));
- str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
- prop->menu->lineno);
- if (!expr_is_yes(prop->visible.expr)) {
- str_append(r, _(" Depends on: "));
- expr_gstr_print(prop->visible.expr, r);
- str_append(r, "\n");
- }
- menu = prop->menu->parent;
- for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
- submenu[i++] = menu;
- if (i > 0) {
- str_printf(r, _(" Location:\n"));
- for (j = 4; --i >= 0; j += 2) {
- menu = submenu[i];
- str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu)));
- if (menu->sym) {
- str_printf(r, " (%s [=%s])", menu->sym->name ?
- menu->sym->name : _("<choice>"),
- sym_get_string_value(menu->sym));
- }
- str_append(r, "\n");
- }
- }
-}
-
-static void get_symbol_str(struct gstr *r, struct symbol *sym)
-{
- bool hit;
- struct property *prop;
-
- if (sym && sym->name)
- str_printf(r, "Symbol: %s [=%s]\n", sym->name,
- sym_get_string_value(sym));
- for_all_prompts(sym, prop)
- get_prompt_str(r, prop);
- hit = false;
- for_all_properties(sym, prop, P_SELECT) {
- if (!hit) {
- str_append(r, " Selects: ");
- hit = true;
- } else
- str_printf(r, " && ");
- expr_gstr_print(prop->expr, r);
- }
- if (hit)
- str_append(r, "\n");
- if (sym->rev_dep.expr) {
- str_append(r, _(" Selected by: "));
- expr_gstr_print(sym->rev_dep.expr, r);
- str_append(r, "\n");
- }
- str_append(r, "\n\n");
-}
-
-static struct gstr get_relations_str(struct symbol **sym_arr)
-{
- struct symbol *sym;
- struct gstr res = str_new();
- int i;
-
- for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
- get_symbol_str(&res, sym);
- if (!i)
- str_append(&res, _("No matches found.\n"));
- 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("PROJECTVERSION", 0);
- sym_calc_value(sym);
size = snprintf(menu_backtitle, sizeof(menu_backtitle),
- _(PACKAGE " v%s Configuration - %s"),
- sym_get_string_value(sym), config_filename);
+ "%s - %s", config_filename, rootmenu.prompt->text);
if (size >= sizeof(menu_backtitle))
menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
set_dialog_backtitle(menu_backtitle);
@@ -388,8 +310,8 @@ static void search_conf(void)
again:
dialog_clear();
dres = dialog_inputbox(_("Search Configuration Parameter"),
- _("Enter CT_ (sub)string to search for "
- "(with or without \"CT\")"),
+ _("Enter " CONFIG_ " (sub)string to search for "
+ "(with or without \"" CONFIG_ "\")"),
10, 75, "");
switch (dres) {
case 0:
@@ -401,10 +323,10 @@ again:
return;
}
- /* strip CT_ if necessary */
+ /* strip the prefix if necessary */
dialog_input = dialog_input_result;
- if (strncasecmp(dialog_input_result, "CT_", 3) == 0)
- dialog_input += 7;
+ if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
+ dialog_input += strlen(CONFIG_);
sym_arr = sym_re_search(dialog_input);
res = get_relations_str(sym_arr);
@@ -421,8 +343,16 @@ static void build_conf(struct menu *menu)
int type, tmp, doint = 2;
tristate val;
char ch;
-
- if (!menu_is_visible(menu))
+ bool visible;
+
+ /*
+ * note: menu_is_visible() has side effect that it will
+ * recalc the value of the symbol.
+ */
+ visible = menu_is_visible(menu);
+ if (show_all_options && !menu_has_prompt(menu))
+ return;
+ else if (!show_all_options && !visible)
return;
sym = menu->sym;
@@ -681,6 +611,9 @@ static void conf(struct menu *menu)
case 7:
search_conf();
break;
+ case 8:
+ show_all_options = !show_all_options;
+ break;
}
}
}
@@ -699,19 +632,10 @@ static void show_helptext(const char *title, const char *text)
static void show_help(struct menu *menu)
{
struct gstr help = str_new();
- struct symbol *sym = menu->sym;
-
- if (menu_has_help(menu))
- {
- if (sym->name) {
- str_printf(&help, "CT_%s:\n\n", sym->name);
- str_append(&help, _(menu_get_help(menu)));
- str_append(&help, "\n");
- }
- } else {
- str_append(&help, nohelp_text);
- }
- get_symbol_str(&help, sym);
+
+ help.max_width = getmaxx(stdscr) - 10;
+ menu_get_ext_help(menu, &help);
+
show_helptext(_(menu_get_prompt(menu)), str_get(&help));
str_free(&help);
}
@@ -732,7 +656,12 @@ static void conf_choice(struct menu *menu)
for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child))
continue;
- item_make("%s", _(menu_get_prompt(child)));
+ if (child->sym)
+ item_make("%s", _(menu_get_prompt(child)));
+ else {
+ item_make("*** %s ***", _(menu_get_prompt(child)));
+ item_set_tag(':');
+ }
item_set_data(child);
if (child->sym == active)
item_set_selected(1);
@@ -748,6 +677,9 @@ static void conf_choice(struct menu *menu)
case 0:
if (selected) {
child = item_data();
+ if (!child->sym)
+ break;
+
sym_set_tristate_value(child->sym, yes);
}
return;
@@ -880,6 +812,8 @@ int main(int ac, char **av)
single_menu_mode = 1;
}
+ initscr();
+
getyx(stdscr, saved_y, saved_x);
if (init_dialog(NULL)) {
fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
@@ -894,7 +828,7 @@ int main(int ac, char **av)
if (conf_get_changed())
res = dialog_yesno(NULL,
_("Do you wish to save your "
- "new " PACKAGE " configuration?\n"
+ "new configuration?\n"
"<ESC><ESC> to continue."),
6, 60);
else
@@ -906,15 +840,21 @@ int main(int ac, char **av)
case 0:
if (conf_write(filename)) {
fprintf(stderr, _("\n\n"
- "Error during writing of " PACKAGE " configuration.\n"
- "Your " PACKAGE " configuration changes were NOT saved."
+ "Error while writing of the configuration.\n"
+ "Your configuration changes were NOT saved."
"\n\n"));
return 1;
}
case -1:
+ printf(_("\n\n"
+ "*** End of the configuration.\n"
+ "*** Execute 'make' to start the build or try 'make help'."
+ "\n\n"));
break;
default:
- fprintf(stderr, _("Your configuration changes were NOT saved.\n"));
+ fprintf(stderr, _("\n\n"
+ "Your configuration changes were NOT saved."
+ "\n\n"));
}
return 0;