diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-29 06:46:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-29 06:46:14 -0500 |
commit | 5ea293a9048d3a58cb0c840fa719d85ad14cba47 (patch) | |
tree | 88d1dd1eece2cfcbd858ff2c00fb0240dcfab3c7 /scripts/kconfig/mconf.c | |
parent | 03bc26cfefd6db756e6bc7fcda11dc17ada7be16 (diff) | |
parent | d3883ecebbf9e095b9e379dabbbe8b2c1ee7a41c (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (79 commits)
Remove references to "make dep"
kconfig: document use of HAVE_*
Introduce new section reference annotations tags: __ref, __refdata, __refconst
kbuild: warn about ld added unique sections
kbuild: add verbose option to Section mismatch reporting in modpost
kconfig: tristate choices with mixed tristate and boolean values
asm-generic/vmlix.lds.h: simplify __mem{init,exit}* dependencies
remove __attribute_used__
kbuild: support ARCH=x86 in buildtar
kconfig: remove "enable"
kbuild: simplified warning report in modpost
kbuild: introduce a few helpers in modpost
kbuild: use simpler section mismatch warnings in modpost
kbuild: link vmlinux.o before kallsyms passes
kbuild: introduce new option to enhance section mismatch analysis
Use separate sections for __dev/__cpu/__mem code/data
compiler.h: introduce __section()
all archs: consolidate init and exit sections in vmlinux.lds.h
kbuild: check section names consistently in modpost
kbuild: introduce blacklisting in modpost
...
Diffstat (limited to 'scripts/kconfig/mconf.c')
-rw-r--r-- | scripts/kconfig/mconf.c | 112 |
1 files changed, 35 insertions, 77 deletions
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 47e226fdedd7..50e61c411bc0 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -8,17 +8,13 @@ | |||
8 | * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br> | 8 | * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br> |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include <sys/ioctl.h> | ||
12 | #include <sys/wait.h> | ||
13 | #include <ctype.h> | 11 | #include <ctype.h> |
14 | #include <errno.h> | 12 | #include <errno.h> |
15 | #include <fcntl.h> | 13 | #include <fcntl.h> |
16 | #include <limits.h> | 14 | #include <limits.h> |
17 | #include <signal.h> | ||
18 | #include <stdarg.h> | 15 | #include <stdarg.h> |
19 | #include <stdlib.h> | 16 | #include <stdlib.h> |
20 | #include <string.h> | 17 | #include <string.h> |
21 | #include <termios.h> | ||
22 | #include <unistd.h> | 18 | #include <unistd.h> |
23 | #include <locale.h> | 19 | #include <locale.h> |
24 | 20 | ||
@@ -275,8 +271,6 @@ search_help[] = N_( | |||
275 | "\n"); | 271 | "\n"); |
276 | 272 | ||
277 | static int indent; | 273 | static int indent; |
278 | static struct termios ios_org; | ||
279 | static int rows = 0, cols = 0; | ||
280 | static struct menu *current_menu; | 274 | static struct menu *current_menu; |
281 | static int child_count; | 275 | static int child_count; |
282 | static int single_menu_mode; | 276 | static int single_menu_mode; |
@@ -290,51 +284,16 @@ static void show_textbox(const char *title, const char *text, int r, int c); | |||
290 | static void show_helptext(const char *title, const char *text); | 284 | static void show_helptext(const char *title, const char *text); |
291 | static void show_help(struct menu *menu); | 285 | static void show_help(struct menu *menu); |
292 | 286 | ||
293 | static void init_wsize(void) | ||
294 | { | ||
295 | struct winsize ws; | ||
296 | char *env; | ||
297 | |||
298 | if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)) { | ||
299 | rows = ws.ws_row; | ||
300 | cols = ws.ws_col; | ||
301 | } | ||
302 | |||
303 | if (!rows) { | ||
304 | env = getenv("LINES"); | ||
305 | if (env) | ||
306 | rows = atoi(env); | ||
307 | if (!rows) | ||
308 | rows = 24; | ||
309 | } | ||
310 | if (!cols) { | ||
311 | env = getenv("COLUMNS"); | ||
312 | if (env) | ||
313 | cols = atoi(env); | ||
314 | if (!cols) | ||
315 | cols = 80; | ||
316 | } | ||
317 | |||
318 | if (rows < 19 || cols < 80) { | ||
319 | fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); | ||
320 | fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); | ||
321 | exit(1); | ||
322 | } | ||
323 | |||
324 | rows -= 4; | ||
325 | cols -= 5; | ||
326 | } | ||
327 | |||
328 | static void get_prompt_str(struct gstr *r, struct property *prop) | 287 | static void get_prompt_str(struct gstr *r, struct property *prop) |
329 | { | 288 | { |
330 | int i, j; | 289 | int i, j; |
331 | struct menu *submenu[8], *menu; | 290 | struct menu *submenu[8], *menu; |
332 | 291 | ||
333 | str_printf(r, "Prompt: %s\n", prop->text); | 292 | str_printf(r, _("Prompt: %s\n"), _(prop->text)); |
334 | str_printf(r, " Defined at %s:%d\n", prop->menu->file->name, | 293 | str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, |
335 | prop->menu->lineno); | 294 | prop->menu->lineno); |
336 | if (!expr_is_yes(prop->visible.expr)) { | 295 | if (!expr_is_yes(prop->visible.expr)) { |
337 | str_append(r, " Depends on: "); | 296 | str_append(r, _(" Depends on: ")); |
338 | expr_gstr_print(prop->visible.expr, r); | 297 | expr_gstr_print(prop->visible.expr, r); |
339 | str_append(r, "\n"); | 298 | str_append(r, "\n"); |
340 | } | 299 | } |
@@ -342,13 +301,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop) | |||
342 | for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) | 301 | for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) |
343 | submenu[i++] = menu; | 302 | submenu[i++] = menu; |
344 | if (i > 0) { | 303 | if (i > 0) { |
345 | str_printf(r, " Location:\n"); | 304 | str_printf(r, _(" Location:\n")); |
346 | for (j = 4; --i >= 0; j += 2) { | 305 | for (j = 4; --i >= 0; j += 2) { |
347 | menu = submenu[i]; | 306 | menu = submenu[i]; |
348 | str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu)); | 307 | str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); |
349 | if (menu->sym) { | 308 | if (menu->sym) { |
350 | str_printf(r, " (%s [=%s])", menu->sym->name ? | 309 | str_printf(r, " (%s [=%s])", menu->sym->name ? |
351 | menu->sym->name : "<choice>", | 310 | menu->sym->name : _("<choice>"), |
352 | sym_get_string_value(menu->sym)); | 311 | sym_get_string_value(menu->sym)); |
353 | } | 312 | } |
354 | str_append(r, "\n"); | 313 | str_append(r, "\n"); |
@@ -378,7 +337,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym) | |||
378 | if (hit) | 337 | if (hit) |
379 | str_append(r, "\n"); | 338 | str_append(r, "\n"); |
380 | if (sym->rev_dep.expr) { | 339 | if (sym->rev_dep.expr) { |
381 | str_append(r, " Selected by: "); | 340 | str_append(r, _(" Selected by: ")); |
382 | expr_gstr_print(sym->rev_dep.expr, r); | 341 | expr_gstr_print(sym->rev_dep.expr, r); |
383 | str_append(r, "\n"); | 342 | str_append(r, "\n"); |
384 | } | 343 | } |
@@ -394,7 +353,7 @@ static struct gstr get_relations_str(struct symbol **sym_arr) | |||
394 | for (i = 0; sym_arr && (sym = sym_arr[i]); i++) | 353 | for (i = 0; sym_arr && (sym = sym_arr[i]); i++) |
395 | get_symbol_str(&res, sym); | 354 | get_symbol_str(&res, sym); |
396 | if (!i) | 355 | if (!i) |
397 | str_append(&res, "No matches found.\n"); | 356 | str_append(&res, _("No matches found.\n")); |
398 | return res; | 357 | return res; |
399 | } | 358 | } |
400 | 359 | ||
@@ -474,6 +433,7 @@ static void build_conf(struct menu *menu) | |||
474 | switch (prop->type) { | 433 | switch (prop->type) { |
475 | case P_MENU: | 434 | case P_MENU: |
476 | child_count++; | 435 | child_count++; |
436 | prompt = _(prompt); | ||
477 | if (single_menu_mode) { | 437 | if (single_menu_mode) { |
478 | item_make("%s%*c%s", | 438 | item_make("%s%*c%s", |
479 | menu->data ? "-->" : "++>", | 439 | menu->data ? "-->" : "++>", |
@@ -489,7 +449,7 @@ static void build_conf(struct menu *menu) | |||
489 | case P_COMMENT: | 449 | case P_COMMENT: |
490 | if (prompt) { | 450 | if (prompt) { |
491 | child_count++; | 451 | child_count++; |
492 | item_make(" %*c*** %s ***", indent + 1, ' ', prompt); | 452 | item_make(" %*c*** %s ***", indent + 1, ' ', _(prompt)); |
493 | item_set_tag(':'); | 453 | item_set_tag(':'); |
494 | item_set_data(menu); | 454 | item_set_data(menu); |
495 | } | 455 | } |
@@ -497,7 +457,7 @@ static void build_conf(struct menu *menu) | |||
497 | default: | 457 | default: |
498 | if (prompt) { | 458 | if (prompt) { |
499 | child_count++; | 459 | child_count++; |
500 | item_make("---%*c%s", indent + 1, ' ', prompt); | 460 | item_make("---%*c%s", indent + 1, ' ', _(prompt)); |
501 | item_set_tag(':'); | 461 | item_set_tag(':'); |
502 | item_set_data(menu); | 462 | item_set_data(menu); |
503 | } | 463 | } |
@@ -541,10 +501,10 @@ static void build_conf(struct menu *menu) | |||
541 | item_set_data(menu); | 501 | item_set_data(menu); |
542 | } | 502 | } |
543 | 503 | ||
544 | item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); | 504 | item_add_str("%*c%s", indent + 1, ' ', _(menu_get_prompt(menu))); |
545 | if (val == yes) { | 505 | if (val == yes) { |
546 | if (def_menu) { | 506 | if (def_menu) { |
547 | item_add_str(" (%s)", menu_get_prompt(def_menu)); | 507 | item_add_str(" (%s)", _(menu_get_prompt(def_menu))); |
548 | item_add_str(" --->"); | 508 | item_add_str(" --->"); |
549 | if (def_menu->list) { | 509 | if (def_menu->list) { |
550 | indent += 2; | 510 | indent += 2; |
@@ -556,7 +516,7 @@ static void build_conf(struct menu *menu) | |||
556 | } | 516 | } |
557 | } else { | 517 | } else { |
558 | if (menu == current_menu) { | 518 | if (menu == current_menu) { |
559 | item_make("---%*c%s", indent + 1, ' ', menu_get_prompt(menu)); | 519 | item_make("---%*c%s", indent + 1, ' ', _(menu_get_prompt(menu))); |
560 | item_set_tag(':'); | 520 | item_set_tag(':'); |
561 | item_set_data(menu); | 521 | item_set_data(menu); |
562 | goto conf_childs; | 522 | goto conf_childs; |
@@ -599,17 +559,17 @@ static void build_conf(struct menu *menu) | |||
599 | tmp = indent - tmp + 4; | 559 | tmp = indent - tmp + 4; |
600 | if (tmp < 0) | 560 | if (tmp < 0) |
601 | tmp = 0; | 561 | tmp = 0; |
602 | item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu), | 562 | item_add_str("%*c%s%s", tmp, ' ', _(menu_get_prompt(menu)), |
603 | (sym_has_value(sym) || !sym_is_changable(sym)) ? | 563 | (sym_has_value(sym) || !sym_is_changable(sym)) ? |
604 | "" : " (NEW)"); | 564 | "" : _(" (NEW)")); |
605 | item_set_tag('s'); | 565 | item_set_tag('s'); |
606 | item_set_data(menu); | 566 | item_set_data(menu); |
607 | goto conf_childs; | 567 | goto conf_childs; |
608 | } | 568 | } |
609 | } | 569 | } |
610 | item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), | 570 | item_add_str("%*c%s%s", indent + 1, ' ', _(menu_get_prompt(menu)), |
611 | (sym_has_value(sym) || !sym_is_changable(sym)) ? | 571 | (sym_has_value(sym) || !sym_is_changable(sym)) ? |
612 | "" : " (NEW)"); | 572 | "" : _(" (NEW)")); |
613 | if (menu->prompt->type == P_MENU) { | 573 | if (menu->prompt->type == P_MENU) { |
614 | item_add_str(" --->"); | 574 | item_add_str(" --->"); |
615 | return; | 575 | return; |
@@ -647,7 +607,7 @@ static void conf(struct menu *menu) | |||
647 | item_set_tag('S'); | 607 | item_set_tag('S'); |
648 | } | 608 | } |
649 | dialog_clear(); | 609 | dialog_clear(); |
650 | res = dialog_menu(prompt ? prompt : _("Main Menu"), | 610 | res = dialog_menu(prompt ? _(prompt) : _("Main Menu"), |
651 | _(menu_instructions), | 611 | _(menu_instructions), |
652 | active_menu, &s_scroll); | 612 | active_menu, &s_scroll); |
653 | if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) | 613 | if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) |
@@ -694,7 +654,7 @@ static void conf(struct menu *menu) | |||
694 | if (sym) | 654 | if (sym) |
695 | show_help(submenu); | 655 | show_help(submenu); |
696 | else | 656 | else |
697 | show_helptext("README", _(mconf_readme)); | 657 | show_helptext(_("README"), _(mconf_readme)); |
698 | break; | 658 | break; |
699 | case 3: | 659 | case 3: |
700 | if (item_is_tag('t')) { | 660 | if (item_is_tag('t')) { |
@@ -752,13 +712,13 @@ static void show_help(struct menu *menu) | |||
752 | str_append(&help, nohelp_text); | 712 | str_append(&help, nohelp_text); |
753 | } | 713 | } |
754 | get_symbol_str(&help, sym); | 714 | get_symbol_str(&help, sym); |
755 | show_helptext(menu_get_prompt(menu), str_get(&help)); | 715 | show_helptext(_(menu_get_prompt(menu)), str_get(&help)); |
756 | str_free(&help); | 716 | str_free(&help); |
757 | } | 717 | } |
758 | 718 | ||
759 | static void conf_choice(struct menu *menu) | 719 | static void conf_choice(struct menu *menu) |
760 | { | 720 | { |
761 | const char *prompt = menu_get_prompt(menu); | 721 | const char *prompt = _(menu_get_prompt(menu)); |
762 | struct menu *child; | 722 | struct menu *child; |
763 | struct symbol *active; | 723 | struct symbol *active; |
764 | 724 | ||
@@ -772,7 +732,7 @@ static void conf_choice(struct menu *menu) | |||
772 | for (child = menu->list; child; child = child->next) { | 732 | for (child = menu->list; child; child = child->next) { |
773 | if (!menu_is_visible(child)) | 733 | if (!menu_is_visible(child)) |
774 | continue; | 734 | continue; |
775 | item_make("%s", menu_get_prompt(child)); | 735 | item_make("%s", _(menu_get_prompt(child))); |
776 | item_set_data(child); | 736 | item_set_data(child); |
777 | if (child->sym == active) | 737 | if (child->sym == active) |
778 | item_set_selected(1); | 738 | item_set_selected(1); |
@@ -780,7 +740,7 @@ static void conf_choice(struct menu *menu) | |||
780 | item_set_tag('X'); | 740 | item_set_tag('X'); |
781 | } | 741 | } |
782 | dialog_clear(); | 742 | dialog_clear(); |
783 | res = dialog_checklist(prompt ? prompt : _("Main Menu"), | 743 | res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"), |
784 | _(radiolist_instructions), | 744 | _(radiolist_instructions), |
785 | 15, 70, 6); | 745 | 15, 70, 6); |
786 | selected = item_activate_selected(); | 746 | selected = item_activate_selected(); |
@@ -826,10 +786,10 @@ static void conf_string(struct menu *menu) | |||
826 | heading = _(inputbox_instructions_string); | 786 | heading = _(inputbox_instructions_string); |
827 | break; | 787 | break; |
828 | default: | 788 | default: |
829 | heading = "Internal mconf error!"; | 789 | heading = _("Internal mconf error!"); |
830 | } | 790 | } |
831 | dialog_clear(); | 791 | dialog_clear(); |
832 | res = dialog_inputbox(prompt ? prompt : _("Main Menu"), | 792 | res = dialog_inputbox(prompt ? _(prompt) : _("Main Menu"), |
833 | heading, 10, 75, | 793 | heading, 10, 75, |
834 | sym_get_string_value(menu->sym)); | 794 | sym_get_string_value(menu->sym)); |
835 | switch (res) { | 795 | switch (res) { |
@@ -900,13 +860,9 @@ static void conf_save(void) | |||
900 | } | 860 | } |
901 | } | 861 | } |
902 | 862 | ||
903 | static void conf_cleanup(void) | ||
904 | { | ||
905 | tcsetattr(1, TCSAFLUSH, &ios_org); | ||
906 | } | ||
907 | |||
908 | int main(int ac, char **av) | 863 | int main(int ac, char **av) |
909 | { | 864 | { |
865 | int saved_x, saved_y; | ||
910 | char *mode; | 866 | char *mode; |
911 | int res; | 867 | int res; |
912 | 868 | ||
@@ -923,11 +879,13 @@ int main(int ac, char **av) | |||
923 | single_menu_mode = 1; | 879 | single_menu_mode = 1; |
924 | } | 880 | } |
925 | 881 | ||
926 | tcgetattr(1, &ios_org); | 882 | getyx(stdscr, saved_y, saved_x); |
927 | atexit(conf_cleanup); | 883 | if (init_dialog(NULL)) { |
928 | init_wsize(); | 884 | fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); |
929 | reset_dialog(); | 885 | fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); |
930 | init_dialog(NULL); | 886 | return 1; |
887 | } | ||
888 | |||
931 | set_config_filename(conf_get_configname()); | 889 | set_config_filename(conf_get_configname()); |
932 | do { | 890 | do { |
933 | conf(&rootmenu); | 891 | conf(&rootmenu); |
@@ -941,7 +899,7 @@ int main(int ac, char **av) | |||
941 | else | 899 | else |
942 | res = -1; | 900 | res = -1; |
943 | } while (res == KEY_ESC); | 901 | } while (res == KEY_ESC); |
944 | end_dialog(); | 902 | end_dialog(saved_x, saved_y); |
945 | 903 | ||
946 | switch (res) { | 904 | switch (res) { |
947 | case 0: | 905 | case 0: |