summaryrefslogtreecommitdiff
path: root/scripts/kconfig/mconf.c
Side-by-side diff
Diffstat (limited to 'scripts/kconfig/mconf.c') (more/less context) (ignore whitespace changes)
-rw-r--r--scripts/kconfig/mconf.c101
1 files changed, 85 insertions, 16 deletions
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index dec8603..eba5ff7 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -3,2 +3,5 @@
* Released under the terms of the GNU GPL v2.0.
+ *
+ * Introduced single menu mode (show all sub-menus in one large tree).
+ * 2002-11-06 Petr Baudis <pasky@ucw.cz>
*/
@@ -10,2 +13,3 @@
#include <fcntl.h>
+#include <limits.h>
#include <signal.h>
@@ -14,2 +18,3 @@
#include <string.h>
+#include <termios.h>
#include <unistd.h>
@@ -46,3 +51,3 @@ setmod_text[] =
nohelp_text[] =
- "There is no help available for this option.\n",
+ "There is no help available for this kernel option.\n",
load_config_text[] =
@@ -53,3 +58,3 @@ load_config_help[] =
"\n"
- "For various reasons, one may wish to keep several different\n"
+ "For various reasons, one may wish to keep several different kernel\n"
"configurations available on a single machine.\n"
@@ -57,3 +62,3 @@ load_config_help[] =
"If you have saved a previous configuration in a file other than the\n"
- "default, entering the name of the file here will allow you\n"
+ "kernel's default, entering the name of the file here will allow you\n"
"to modify that configuration.\n"
@@ -67,3 +72,3 @@ save_config_help[] =
"\n"
- "For various reasons, one may wish to keep different\n"
+ "For various reasons, one may wish to keep different kernel\n"
"configurations available on a single machine.\n"
@@ -80,4 +85,6 @@ static char buf[4096], *bufptr = buf;
static char input_buf[4096];
+static char filename[PATH_MAX+1] = ".config";
static char *args[1024], **argptr = args;
static int indent = 0;
+static struct termios ios_org;
static int rows, cols;
@@ -86,2 +93,3 @@ static int child_count;
static int do_resize;
+static int single_menu_mode;
@@ -105,2 +113,3 @@ static void init_wsize(void)
struct winsize ws;
+ char *env;
@@ -112,2 +121,16 @@ static void init_wsize(void)
cols = ws.ws_col;
+ if (!rows) {
+ env = getenv("LINES");
+ if (env)
+ rows = atoi(env);
+ if (!rows)
+ rows = 24;
+ }
+ if (!cols) {
+ env = getenv("COLUMNS");
+ if (env)
+ cols = atoi(env);
+ if (!cols)
+ cols = 80;
+ }
}
@@ -276,6 +299,16 @@ static void build_conf(struct menu *menu)
cprint("m%p", menu);
- if (menu->parent != &rootmenu)
- cprint1(" %*c", indent + 1, ' ');
- cprint1("%s --->", prompt);
+
+ if (single_menu_mode) {
+ cprint1("%s%*c%s",
+ menu->data ? "-->" : "++>",
+ indent + 1, ' ', prompt);
+ } else {
+ if (menu->parent != &rootmenu)
+ cprint1(" %*c", indent + 1, ' ');
+ cprint1("%s --->", prompt);
+ }
+
cprint_done();
+ if (single_menu_mode && menu->data)
+ goto conf_childs;
return;
@@ -394,2 +427,3 @@ static void conf(struct menu *menu)
+ unlink("lxdialog.scrltmp");
active_entry[0] = 0;
@@ -444,3 +478,6 @@ static void conf(struct menu *menu)
case 'm':
- conf(submenu);
+ if (single_menu_mode)
+ submenu->data = (void *) !submenu->data;
+ else
+ conf(submenu);
break;
@@ -486,2 +523,4 @@ static void conf(struct menu *menu)
sym_toggle_tristate_value(sym);
+ else if (type == 'm')
+ conf(submenu);
break;
@@ -520,7 +559,15 @@ static void show_help(struct menu *menu)
const char *help;
+ char *helptext;
+ struct symbol *sym = menu->sym;
- help = menu->sym->help;
+ help = sym->help;
if (!help)
help = nohelp_text;
- show_helptext(menu_get_prompt(menu), help);
+ if (sym->name) {
+ helptext = malloc(strlen(sym->name) + strlen(help) + 16);
+ sprintf(helptext, "CONFIG_%s:\n\n%s", sym->name, help);
+ show_helptext(menu_get_prompt(menu), helptext);
+ free(helptext);
+ } else
+ show_helptext(menu_get_prompt(menu), help);
}
@@ -633,3 +680,3 @@ static void conf_load(void)
cprint("55");
- cprint("%s", conf_filename);
+ cprint("%s", filename);
stat = exec_conf();
@@ -662,3 +709,3 @@ static void conf_save(void)
cprint("55");
- cprint("%s", conf_filename);
+ cprint("%s", filename);
stat = exec_conf();
@@ -681,5 +728,15 @@ static void conf_save(void)
+static void conf_cleanup(void)
+{
+ tcsetattr(1, TCSAFLUSH, &ios_org);
+ unlink(".help.tmp");
+ unlink("lxdialog.scrltmp");
+}
+
int main(int ac, char **av)
{
+ struct symbol *sym;
+ char *mode;
int stat;
+
conf_parse(av[1]);
@@ -687,4 +744,15 @@ int main(int ac, char **av)
- sprintf(menu_backtitle, "Configuration");
+ sym = sym_lookup("KERNELRELEASE", 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"))
+ single_menu_mode = 1;
+ }
+ tcgetattr(1, &ios_org);
+ atexit(conf_cleanup);
init_wsize();
@@ -704,6 +772,7 @@ int main(int ac, char **av)
printf("\n\n"
- "*** End of configuration.\n"
- "*** Check the top-level Makefile for additional configuration.\n");
+ "*** End of Linux kernel configuration.\n"
+ "*** Check the top-level Makefile for additional configuration.\n"
+ "*** Next, you may run 'make bzImage', 'make bzdisk', or 'make install'.\n\n");
} else
- printf("\n\nYour configuration changes were NOT saved.\n\n");
+ printf("\n\nYour kernel configuration changes were NOT saved.\n\n");