diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-08-05 02:18:25 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-08-05 02:18:25 +0000 |
commit | 72d8e444f0e9e002b16328e73464ef9015979048 (patch) | |
tree | d1d99e668617e95836a1f767257e1263963feaa5 /scripts/config/mconf.c | |
parent | 461c279ac176a28dec40d1e40ebaffe4f0ac688d (diff) | |
download | busybox-w32-72d8e444f0e9e002b16328e73464ef9015979048.tar.gz busybox-w32-72d8e444f0e9e002b16328e73464ef9015979048.tar.bz2 busybox-w32-72d8e444f0e9e002b16328e73464ef9015979048.zip |
Merge/rework config system per the latest from linux-2.6.0-test2.
Fix the config bugs revealed by the updated config system.
-Erik
Diffstat (limited to 'scripts/config/mconf.c')
-rw-r--r-- | scripts/config/mconf.c | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/scripts/config/mconf.c b/scripts/config/mconf.c index 1ea512eff..739b3b480 100644 --- a/scripts/config/mconf.c +++ b/scripts/config/mconf.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #define LKC_DIRECT_LINK | 28 | #define LKC_DIRECT_LINK |
29 | #include "lkc.h" | 29 | #include "lkc.h" |
30 | 30 | ||
31 | static char menu_backtitle[128]; | ||
31 | static const char menu_instructions[] = | 32 | static const char menu_instructions[] = |
32 | "Arrow keys navigate the menu. " | 33 | "Arrow keys navigate the menu. " |
33 | "<Enter> selects submenus --->. " | 34 | "<Enter> selects submenus --->. " |
@@ -65,7 +66,7 @@ load_config_help[] = | |||
65 | "configurations available on a single machine.\n" | 66 | "configurations available on a single machine.\n" |
66 | "\n" | 67 | "\n" |
67 | "If you have saved a previous configuration in a file other than the\n" | 68 | "If you have saved a previous configuration in a file other than the\n" |
68 | "BusyBox default, entering the name of the file here will allow you\n" | 69 | "BusyBox's default, entering the name of the file here will allow you\n" |
69 | "to modify that configuration.\n" | 70 | "to modify that configuration.\n" |
70 | "\n" | 71 | "\n" |
71 | "If you are uncertain, then you have probably never used alternate\n" | 72 | "If you are uncertain, then you have probably never used alternate\n" |
@@ -120,6 +121,7 @@ static void show_readme(void); | |||
120 | static void init_wsize(void) | 121 | static void init_wsize(void) |
121 | { | 122 | { |
122 | struct winsize ws; | 123 | struct winsize ws; |
124 | char *env; | ||
123 | 125 | ||
124 | if (ioctl(1, TIOCGWINSZ, &ws) == -1) { | 126 | if (ioctl(1, TIOCGWINSZ, &ws) == -1) { |
125 | rows = 24; | 127 | rows = 24; |
@@ -127,6 +129,20 @@ static void init_wsize(void) | |||
127 | } else { | 129 | } else { |
128 | rows = ws.ws_row; | 130 | rows = ws.ws_row; |
129 | cols = ws.ws_col; | 131 | cols = ws.ws_col; |
132 | if (!rows) { | ||
133 | env = getenv("LINES"); | ||
134 | if (env) | ||
135 | rows = atoi(env); | ||
136 | if (!rows) | ||
137 | rows = 24; | ||
138 | } | ||
139 | if (!cols) { | ||
140 | env = getenv("COLUMNS"); | ||
141 | if (env) | ||
142 | cols = atoi(env); | ||
143 | if (!cols) | ||
144 | cols = 80; | ||
145 | } | ||
130 | } | 146 | } |
131 | 147 | ||
132 | if (rows < 19 || cols < 80) { | 148 | if (rows < 19 || cols < 80) { |
@@ -226,9 +242,7 @@ static void build_conf(struct menu *menu) | |||
226 | menu->data ? "-->" : "++>", | 242 | menu->data ? "-->" : "++>", |
227 | indent + 1, ' ', prompt); | 243 | indent + 1, ' ', prompt); |
228 | } else { | 244 | } else { |
229 | if (menu->parent != &rootmenu) | 245 | cprint_name(" %*c%s --->", indent + 1, ' ', prompt); |
230 | cprint_name(" %*c", indent + 1, ' '); | ||
231 | cprint_name("%s --->", prompt); | ||
232 | } | 246 | } |
233 | 247 | ||
234 | if (single_menu_mode && menu->data) | 248 | if (single_menu_mode && menu->data) |
@@ -303,7 +317,10 @@ static void build_conf(struct menu *menu) | |||
303 | switch (type) { | 317 | switch (type) { |
304 | case S_BOOLEAN: | 318 | case S_BOOLEAN: |
305 | cprint_tag("t%p", menu); | 319 | cprint_tag("t%p", menu); |
306 | cprint_name("[%c]", val == no ? ' ' : '*'); | 320 | if (sym_is_changable(sym)) |
321 | cprint_name("[%c]", val == no ? ' ' : '*'); | ||
322 | else | ||
323 | cprint_name("---"); | ||
307 | break; | 324 | break; |
308 | case S_TRISTATE: | 325 | case S_TRISTATE: |
309 | cprint_tag("t%p", menu); | 326 | cprint_tag("t%p", menu); |
@@ -312,7 +329,10 @@ static void build_conf(struct menu *menu) | |||
312 | case mod: ch = 'M'; break; | 329 | case mod: ch = 'M'; break; |
313 | default: ch = ' '; break; | 330 | default: ch = ' '; break; |
314 | } | 331 | } |
315 | cprint_name("<%c>", ch); | 332 | if (sym_is_changable(sym)) |
333 | cprint_name("<%c>", ch); | ||
334 | else | ||
335 | cprint_name("---"); | ||
316 | break; | 336 | break; |
317 | default: | 337 | default: |
318 | cprint_tag("s%p", menu); | 338 | cprint_tag("s%p", menu); |
@@ -321,12 +341,18 @@ static void build_conf(struct menu *menu) | |||
321 | if (tmp < 0) | 341 | if (tmp < 0) |
322 | tmp = 0; | 342 | tmp = 0; |
323 | cprint_name("%*c%s%s", tmp, ' ', menu_get_prompt(menu), | 343 | cprint_name("%*c%s%s", tmp, ' ', menu_get_prompt(menu), |
324 | sym_has_value(sym) ? "" : " (NEW)"); | 344 | (sym_has_value(sym) || !sym_is_changable(sym)) ? |
345 | "" : " (NEW)"); | ||
325 | goto conf_childs; | 346 | goto conf_childs; |
326 | } | 347 | } |
327 | } | 348 | } |
328 | cprint_name("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), | 349 | cprint_name("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), |
329 | sym_has_value(sym) ? "" : " (NEW)"); | 350 | (sym_has_value(sym) || !sym_is_changable(sym)) ? |
351 | "" : " (NEW)"); | ||
352 | if (menu->prompt->type == P_MENU) { | ||
353 | cprint_name(" --->"); | ||
354 | return; | ||
355 | } | ||
330 | } | 356 | } |
331 | 357 | ||
332 | conf_childs: | 358 | conf_childs: |
@@ -390,13 +416,15 @@ static void conf(struct menu *menu) | |||
390 | switch (type) { | 416 | switch (type) { |
391 | case 'm': | 417 | case 'm': |
392 | if (single_menu_mode) | 418 | if (single_menu_mode) |
393 | submenu->data = (submenu->data)? NULL : (void *)1; | 419 | submenu->data = (void *) (long) !submenu->data; |
394 | else | 420 | else |
395 | conf(submenu); | 421 | conf(submenu); |
396 | break; | 422 | break; |
397 | case 't': | 423 | case 't': |
398 | if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) | 424 | if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) |
399 | conf_choice(submenu); | 425 | conf_choice(submenu); |
426 | else if (submenu->prompt->type == P_MENU) | ||
427 | conf(submenu); | ||
400 | break; | 428 | break; |
401 | case 's': | 429 | case 's': |
402 | conf_string(submenu); | 430 | conf_string(submenu); |
@@ -602,7 +630,6 @@ static void conf_cleanup(void) | |||
602 | { | 630 | { |
603 | tcsetattr(1, TCSAFLUSH, &ios_org); | 631 | tcsetattr(1, TCSAFLUSH, &ios_org); |
604 | unlink(".help.tmp"); | 632 | unlink(".help.tmp"); |
605 | unlink("lxdialog.scrltmp"); | ||
606 | } | 633 | } |
607 | 634 | ||
608 | static void winch_handler(int sig) | 635 | static void winch_handler(int sig) |
@@ -638,10 +665,9 @@ int main(int ac, char **av) | |||
638 | conf_parse(av[1]); | 665 | conf_parse(av[1]); |
639 | conf_read(NULL); | 666 | conf_read(NULL); |
640 | 667 | ||
641 | backtitle = malloc(128); | ||
642 | sym = sym_lookup("VERSION", 0); | 668 | sym = sym_lookup("VERSION", 0); |
643 | sym_calc_value(sym); | 669 | sym_calc_value(sym); |
644 | snprintf(backtitle, 128, "BusyBox v%s Configuration", | 670 | snprintf(menu_backtitle, 128, "BusyBox v%s Configuration", |
645 | sym_get_string_value(sym)); | 671 | sym_get_string_value(sym)); |
646 | 672 | ||
647 | mode = getenv("MENUCONFIG_MODE"); | 673 | mode = getenv("MENUCONFIG_MODE"); |