mconf.c (552c69b36ebd966186573b9c7a286b390935cce1) | mconf.c (694c49a7c01cc87194be40cb26404b58b68c291c) |
---|---|
1/* 2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Released under the terms of the GNU GPL v2.0. 4 * 5 * Introduced single menu mode (show all sub-menus in one large tree). 6 * 2002-11-06 Petr Baudis <pasky@ucw.cz> 7 * 8 * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br> 9 */ 10 11#include <ctype.h> 12#include <errno.h> 13#include <fcntl.h> 14#include <limits.h> 15#include <stdarg.h> 16#include <stdlib.h> 17#include <string.h> 18#include <signal.h> 19#include <unistd.h> | 1/* 2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Released under the terms of the GNU GPL v2.0. 4 * 5 * Introduced single menu mode (show all sub-menus in one large tree). 6 * 2002-11-06 Petr Baudis <pasky@ucw.cz> 7 * 8 * i18n, 2005, Arnaldo Carvalho de Melo <acme@conectiva.com.br> 9 */ 10 11#include <ctype.h> 12#include <errno.h> 13#include <fcntl.h> 14#include <limits.h> 15#include <stdarg.h> 16#include <stdlib.h> 17#include <string.h> 18#include <signal.h> 19#include <unistd.h> |
20#include <locale.h> | |
21 22#include "lkc.h" 23#include "lxdialog/dialog.h" 24 | 20 21#include "lkc.h" 22#include "lxdialog/dialog.h" 23 |
25static const char mconf_readme[] = N_( | 24static const char mconf_readme[] = |
26"Overview\n" 27"--------\n" 28"This interface lets you select features and parameters for the build.\n" 29"Features can either be built-in, modularized, or ignored. Parameters\n" 30"must be entered in as decimal or hexadecimal numbers or text.\n" 31"\n" 32"Menu items beginning with following braces represent features that\n" 33" [ ] can be built in or removed\n" --- 132 unchanged lines hidden (view full) --- 166"\n" 167"make MENUCONFIG_COLOR=<theme> menuconfig\n" 168"\n" 169"Available themes are\n" 170" mono => selects colors suitable for monochrome displays\n" 171" blackbg => selects a color scheme with black background\n" 172" classic => theme with blue background. The classic look\n" 173" bluetitle => an LCD friendly version of classic. (default)\n" | 25"Overview\n" 26"--------\n" 27"This interface lets you select features and parameters for the build.\n" 28"Features can either be built-in, modularized, or ignored. Parameters\n" 29"must be entered in as decimal or hexadecimal numbers or text.\n" 30"\n" 31"Menu items beginning with following braces represent features that\n" 32" [ ] can be built in or removed\n" --- 132 unchanged lines hidden (view full) --- 165"\n" 166"make MENUCONFIG_COLOR=<theme> menuconfig\n" 167"\n" 168"Available themes are\n" 169" mono => selects colors suitable for monochrome displays\n" 170" blackbg => selects a color scheme with black background\n" 171" classic => theme with blue background. The classic look\n" 172" bluetitle => an LCD friendly version of classic. (default)\n" |
174"\n"), 175menu_instructions[] = N_( | 173"\n", 174menu_instructions[] = |
176 "Arrow keys navigate the menu. " 177 "<Enter> selects submenus ---> (or empty submenus ----). " 178 "Highlighted letters are hotkeys. " 179 "Pressing <Y> includes, <N> excludes, <M> modularizes features. " 180 "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " | 175 "Arrow keys navigate the menu. " 176 "<Enter> selects submenus ---> (or empty submenus ----). " 177 "Highlighted letters are hotkeys. " 178 "Pressing <Y> includes, <N> excludes, <M> modularizes features. " 179 "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " |
181 "Legend: [*] built-in [ ] excluded <M> module < > module capable"), 182radiolist_instructions[] = N_( | 180 "Legend: [*] built-in [ ] excluded <M> module < > module capable", 181radiolist_instructions[] = |
183 "Use the arrow keys to navigate this window or " 184 "press the hotkey of the item you wish to select " 185 "followed by the <SPACE BAR>. " | 182 "Use the arrow keys to navigate this window or " 183 "press the hotkey of the item you wish to select " 184 "followed by the <SPACE BAR>. " |
186 "Press <?> for additional information about this option."), 187inputbox_instructions_int[] = N_( | 185 "Press <?> for additional information about this option.", 186inputbox_instructions_int[] = |
188 "Please enter a decimal value. " 189 "Fractions will not be accepted. " | 187 "Please enter a decimal value. " 188 "Fractions will not be accepted. " |
190 "Use the <TAB> key to move from the input field to the buttons below it."), 191inputbox_instructions_hex[] = N_( | 189 "Use the <TAB> key to move from the input field to the buttons below it.", 190inputbox_instructions_hex[] = |
192 "Please enter a hexadecimal value. " | 191 "Please enter a hexadecimal value. " |
193 "Use the <TAB> key to move from the input field to the buttons below it."), 194inputbox_instructions_string[] = N_( | 192 "Use the <TAB> key to move from the input field to the buttons below it.", 193inputbox_instructions_string[] = |
195 "Please enter a string value. " | 194 "Please enter a string value. " |
196 "Use the <TAB> key to move from the input field to the buttons below it."), 197setmod_text[] = N_( | 195 "Use the <TAB> key to move from the input field to the buttons below it.", 196setmod_text[] = |
198 "This feature depends on another which has been configured as a module.\n" | 197 "This feature depends on another which has been configured as a module.\n" |
199 "As a result, this feature will be built as a module."), 200load_config_text[] = N_( | 198 "As a result, this feature will be built as a module.", 199load_config_text[] = |
201 "Enter the name of the configuration file you wish to load. " 202 "Accept the name shown to restore the configuration you " | 200 "Enter the name of the configuration file you wish to load. " 201 "Accept the name shown to restore the configuration you " |
203 "last retrieved. Leave blank to abort."), 204load_config_help[] = N_( | 202 "last retrieved. Leave blank to abort.", 203load_config_help[] = |
205 "\n" 206 "For various reasons, one may wish to keep several different\n" 207 "configurations available on a single machine.\n" 208 "\n" 209 "If you have saved a previous configuration in a file other than the\n" 210 "default one, entering its name here will allow you to modify that\n" 211 "configuration.\n" 212 "\n" 213 "If you are uncertain, then you have probably never used alternate\n" | 204 "\n" 205 "For various reasons, one may wish to keep several different\n" 206 "configurations available on a single machine.\n" 207 "\n" 208 "If you have saved a previous configuration in a file other than the\n" 209 "default one, entering its name here will allow you to modify that\n" 210 "configuration.\n" 211 "\n" 212 "If you are uncertain, then you have probably never used alternate\n" |
214 "configuration files. You should therefore leave this blank to abort.\n"), 215save_config_text[] = N_( | 213 "configuration files. You should therefore leave this blank to abort.\n", 214save_config_text[] = |
216 "Enter a filename to which this configuration should be saved " | 215 "Enter a filename to which this configuration should be saved " |
217 "as an alternate. Leave blank to abort."), 218save_config_help[] = N_( | 216 "as an alternate. Leave blank to abort.", 217save_config_help[] = |
219 "\n" 220 "For various reasons, one may wish to keep different configurations\n" 221 "available on a single machine.\n" 222 "\n" 223 "Entering a file name here will allow you to later retrieve, modify\n" 224 "and use the current configuration as an alternate to whatever\n" 225 "configuration options you have selected at that time.\n" 226 "\n" 227 "If you are uncertain what all this means then you should probably\n" | 218 "\n" 219 "For various reasons, one may wish to keep different configurations\n" 220 "available on a single machine.\n" 221 "\n" 222 "Entering a file name here will allow you to later retrieve, modify\n" 223 "and use the current configuration as an alternate to whatever\n" 224 "configuration options you have selected at that time.\n" 225 "\n" 226 "If you are uncertain what all this means then you should probably\n" |
228 "leave this blank.\n"), 229search_help[] = N_( | 227 "leave this blank.\n", 228search_help[] = |
230 "\n" 231 "Search for symbols and display their relations.\n" 232 "Regular expressions are allowed.\n" 233 "Example: search for \"^FOO\"\n" 234 "Result:\n" 235 "-----------------------------------------------------------------\n" 236 "Symbol: FOO [=m]\n" 237 "Type : tristate\n" --- 28 unchanged lines hidden (view full) --- 266 "o The 'Selected by' line tells what symbol has selected this symbol\n" 267 "\n" 268 "Only relevant lines are shown.\n" 269 "\n\n" 270 "Search examples:\n" 271 "Examples: USB => find all symbols containing USB\n" 272 " ^USB => find all symbols starting with USB\n" 273 " USB$ => find all symbols ending with USB\n" | 229 "\n" 230 "Search for symbols and display their relations.\n" 231 "Regular expressions are allowed.\n" 232 "Example: search for \"^FOO\"\n" 233 "Result:\n" 234 "-----------------------------------------------------------------\n" 235 "Symbol: FOO [=m]\n" 236 "Type : tristate\n" --- 28 unchanged lines hidden (view full) --- 265 "o The 'Selected by' line tells what symbol has selected this symbol\n" 266 "\n" 267 "Only relevant lines are shown.\n" 268 "\n\n" 269 "Search examples:\n" 270 "Examples: USB => find all symbols containing USB\n" 271 " ^USB => find all symbols starting with USB\n" 272 " USB$ => find all symbols ending with USB\n" |
274 "\n"); | 273 "\n"; |
275 276static int indent; 277static struct menu *current_menu; 278static int child_count; 279static int single_menu_mode; 280static int show_all_options; 281static int save_and_exit; 282static int silent; --- 112 unchanged lines hidden (view full) --- 395 struct gstr title; 396 char *dialog_input; 397 int dres, vscroll = 0, hscroll = 0; 398 bool again; 399 struct gstr sttext; 400 struct subtitle_part stpart; 401 402 title = str_new(); | 274 275static int indent; 276static struct menu *current_menu; 277static int child_count; 278static int single_menu_mode; 279static int show_all_options; 280static int save_and_exit; 281static int silent; --- 112 unchanged lines hidden (view full) --- 394 struct gstr title; 395 char *dialog_input; 396 int dres, vscroll = 0, hscroll = 0; 397 bool again; 398 struct gstr sttext; 399 struct subtitle_part stpart; 400 401 title = str_new(); |
403 str_printf( &title, _("Enter (sub)string or regexp to search for " 404 "(with or without \"%s\")"), CONFIG_); | 402 str_printf( &title, "Enter (sub)string or regexp to search for " 403 "(with or without \"%s\")", CONFIG_); |
405 406again: 407 dialog_clear(); | 404 405again: 406 dialog_clear(); |
408 dres = dialog_inputbox(_("Search Configuration Parameter"), | 407 dres = dialog_inputbox("Search Configuration Parameter", |
409 str_get(&title), 410 10, 75, ""); 411 switch (dres) { 412 case 0: 413 break; 414 case 1: | 408 str_get(&title), 409 10, 75, ""); 410 switch (dres) { 411 case 0: 412 break; 413 case 1: |
415 show_helptext(_("Search Configuration"), search_help); | 414 show_helptext("Search Configuration", search_help); |
416 goto again; 417 default: 418 str_free(&title); 419 return; 420 } 421 422 /* strip the prefix if necessary */ 423 dialog_input = dialog_input_result; --- 14 unchanged lines hidden (view full) --- 438 .head = &head, 439 .targets = targets, 440 .keys = keys, 441 }; 442 struct jump_key *pos, *tmp; 443 444 res = get_relations_str(sym_arr, &head); 445 set_subtitle(); | 415 goto again; 416 default: 417 str_free(&title); 418 return; 419 } 420 421 /* strip the prefix if necessary */ 422 dialog_input = dialog_input_result; --- 14 unchanged lines hidden (view full) --- 437 .head = &head, 438 .targets = targets, 439 .keys = keys, 440 }; 441 struct jump_key *pos, *tmp; 442 443 res = get_relations_str(sym_arr, &head); 444 set_subtitle(); |
446 dres = show_textbox_ext(_("Search Results"), (char *) | 445 dres = show_textbox_ext("Search Results", (char *) |
447 str_get(&res), 0, 0, keys, &vscroll, 448 &hscroll, &update_text, (void *) 449 &data); 450 again = false; 451 for (i = 0; i < JUMP_NB && keys[i]; i++) 452 if (dres == keys[i]) { 453 conf(targets[i]->parent, targets[i]); 454 again = true; --- 31 unchanged lines hidden (view full) --- 486 sym = menu->sym; 487 prop = menu->prompt; 488 if (!sym) { 489 if (prop && menu != current_menu) { 490 const char *prompt = menu_get_prompt(menu); 491 switch (prop->type) { 492 case P_MENU: 493 child_count++; | 446 str_get(&res), 0, 0, keys, &vscroll, 447 &hscroll, &update_text, (void *) 448 &data); 449 again = false; 450 for (i = 0; i < JUMP_NB && keys[i]; i++) 451 if (dres == keys[i]) { 452 conf(targets[i]->parent, targets[i]); 453 again = true; --- 31 unchanged lines hidden (view full) --- 485 sym = menu->sym; 486 prop = menu->prompt; 487 if (!sym) { 488 if (prop && menu != current_menu) { 489 const char *prompt = menu_get_prompt(menu); 490 switch (prop->type) { 491 case P_MENU: 492 child_count++; |
494 prompt = _(prompt); | 493 prompt = prompt; |
495 if (single_menu_mode) { 496 item_make("%s%*c%s", 497 menu->data ? "-->" : "++>", 498 indent + 1, ' ', prompt); 499 } else 500 item_make(" %*c%s %s", 501 indent + 1, ' ', prompt, 502 menu_is_empty(menu) ? "----" : "--->"); 503 item_set_tag('m'); 504 item_set_data(menu); 505 if (single_menu_mode && menu->data) 506 goto conf_childs; 507 return; 508 case P_COMMENT: 509 if (prompt) { 510 child_count++; | 494 if (single_menu_mode) { 495 item_make("%s%*c%s", 496 menu->data ? "-->" : "++>", 497 indent + 1, ' ', prompt); 498 } else 499 item_make(" %*c%s %s", 500 indent + 1, ' ', prompt, 501 menu_is_empty(menu) ? "----" : "--->"); 502 item_set_tag('m'); 503 item_set_data(menu); 504 if (single_menu_mode && menu->data) 505 goto conf_childs; 506 return; 507 case P_COMMENT: 508 if (prompt) { 509 child_count++; |
511 item_make(" %*c*** %s ***", indent + 1, ' ', _(prompt)); | 510 item_make(" %*c*** %s ***", indent + 1, ' ', prompt); |
512 item_set_tag(':'); 513 item_set_data(menu); 514 } 515 break; 516 default: 517 if (prompt) { 518 child_count++; | 511 item_set_tag(':'); 512 item_set_data(menu); 513 } 514 break; 515 default: 516 if (prompt) { 517 child_count++; |
519 item_make("---%*c%s", indent + 1, ' ', _(prompt)); | 518 item_make("---%*c%s", indent + 1, ' ', prompt); |
520 item_set_tag(':'); 521 item_set_data(menu); 522 } 523 } 524 } else 525 doint = 0; 526 goto conf_childs; 527 } --- 27 unchanged lines hidden (view full) --- 555 item_set_tag('t'); 556 item_set_data(menu); 557 } else { 558 item_make(" "); 559 item_set_tag(def_menu ? 't' : ':'); 560 item_set_data(menu); 561 } 562 | 519 item_set_tag(':'); 520 item_set_data(menu); 521 } 522 } 523 } else 524 doint = 0; 525 goto conf_childs; 526 } --- 27 unchanged lines hidden (view full) --- 554 item_set_tag('t'); 555 item_set_data(menu); 556 } else { 557 item_make(" "); 558 item_set_tag(def_menu ? 't' : ':'); 559 item_set_data(menu); 560 } 561 |
563 item_add_str("%*c%s", indent + 1, ' ', _(menu_get_prompt(menu))); | 562 item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); |
564 if (val == yes) { 565 if (def_menu) { | 563 if (val == yes) { 564 if (def_menu) { |
566 item_add_str(" (%s)", _(menu_get_prompt(def_menu))); | 565 item_add_str(" (%s)", menu_get_prompt(def_menu)); |
567 item_add_str(" --->"); 568 if (def_menu->list) { 569 indent += 2; 570 build_conf(def_menu); 571 indent -= 2; 572 } 573 } 574 return; 575 } 576 } else { 577 if (menu == current_menu) { | 566 item_add_str(" --->"); 567 if (def_menu->list) { 568 indent += 2; 569 build_conf(def_menu); 570 indent -= 2; 571 } 572 } 573 return; 574 } 575 } else { 576 if (menu == current_menu) { |
578 item_make("---%*c%s", indent + 1, ' ', _(menu_get_prompt(menu))); | 577 item_make("---%*c%s", indent + 1, ' ', menu_get_prompt(menu)); |
579 item_set_tag(':'); 580 item_set_data(menu); 581 goto conf_childs; 582 } 583 child_count++; 584 val = sym_get_tristate_value(sym); 585 if (sym_is_choice_value(sym) && val == yes) { 586 item_make(" "); --- 26 unchanged lines hidden (view full) --- 613 item_set_data(menu); 614 break; 615 default: 616 tmp = 2 + strlen(sym_get_string_value(sym)); /* () = 2 */ 617 item_make("(%s)", sym_get_string_value(sym)); 618 tmp = indent - tmp + 4; 619 if (tmp < 0) 620 tmp = 0; | 578 item_set_tag(':'); 579 item_set_data(menu); 580 goto conf_childs; 581 } 582 child_count++; 583 val = sym_get_tristate_value(sym); 584 if (sym_is_choice_value(sym) && val == yes) { 585 item_make(" "); --- 26 unchanged lines hidden (view full) --- 612 item_set_data(menu); 613 break; 614 default: 615 tmp = 2 + strlen(sym_get_string_value(sym)); /* () = 2 */ 616 item_make("(%s)", sym_get_string_value(sym)); 617 tmp = indent - tmp + 4; 618 if (tmp < 0) 619 tmp = 0; |
621 item_add_str("%*c%s%s", tmp, ' ', _(menu_get_prompt(menu)), | 620 item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu), |
622 (sym_has_value(sym) || !sym_is_changable(sym)) ? | 621 (sym_has_value(sym) || !sym_is_changable(sym)) ? |
623 "" : _(" (NEW)")); | 622 "" : " (NEW)"); |
624 item_set_tag('s'); 625 item_set_data(menu); 626 goto conf_childs; 627 } 628 } | 623 item_set_tag('s'); 624 item_set_data(menu); 625 goto conf_childs; 626 } 627 } |
629 item_add_str("%*c%s%s", indent + 1, ' ', _(menu_get_prompt(menu)), | 628 item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), |
630 (sym_has_value(sym) || !sym_is_changable(sym)) ? | 629 (sym_has_value(sym) || !sym_is_changable(sym)) ? |
631 "" : _(" (NEW)")); | 630 "" : " (NEW)"); |
632 if (menu->prompt->type == P_MENU) { 633 item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->"); 634 return; 635 } 636 } 637 638conf_childs: 639 indent += doint; --- 20 unchanged lines hidden (view full) --- 660 while (1) { 661 item_reset(); 662 current_menu = menu; 663 build_conf(menu); 664 if (!child_count) 665 break; 666 set_subtitle(); 667 dialog_clear(); | 631 if (menu->prompt->type == P_MENU) { 632 item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->"); 633 return; 634 } 635 } 636 637conf_childs: 638 indent += doint; --- 20 unchanged lines hidden (view full) --- 659 while (1) { 660 item_reset(); 661 current_menu = menu; 662 build_conf(menu); 663 if (!child_count) 664 break; 665 set_subtitle(); 666 dialog_clear(); |
668 res = dialog_menu(prompt ? _(prompt) : _("Main Menu"), 669 _(menu_instructions), | 667 res = dialog_menu(prompt ? prompt : "Main Menu", 668 menu_instructions, |
670 active_menu, &s_scroll); 671 if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) 672 break; 673 if (item_count() != 0) { 674 if (!item_activate_selected()) 675 continue; 676 if (!item_tag()) 677 continue; --- 25 unchanged lines hidden (view full) --- 703 break; 704 } 705 break; 706 case 2: 707 if (sym) 708 show_help(submenu); 709 else { 710 reset_subtitle(); | 669 active_menu, &s_scroll); 670 if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) 671 break; 672 if (item_count() != 0) { 673 if (!item_activate_selected()) 674 continue; 675 if (!item_tag()) 676 continue; --- 25 unchanged lines hidden (view full) --- 702 break; 703 } 704 break; 705 case 2: 706 if (sym) 707 show_help(submenu); 708 else { 709 reset_subtitle(); |
711 show_helptext(_("README"), _(mconf_readme)); | 710 show_helptext("README", mconf_readme); |
712 } 713 break; 714 case 3: 715 reset_subtitle(); 716 conf_save(); 717 break; 718 case 4: 719 reset_subtitle(); --- 68 unchanged lines hidden (view full) --- 788 789static void show_help(struct menu *menu) 790{ 791 struct gstr help = str_new(); 792 793 help.max_width = getmaxx(stdscr) - 10; 794 menu_get_ext_help(menu, &help); 795 | 711 } 712 break; 713 case 3: 714 reset_subtitle(); 715 conf_save(); 716 break; 717 case 4: 718 reset_subtitle(); --- 68 unchanged lines hidden (view full) --- 787 788static void show_help(struct menu *menu) 789{ 790 struct gstr help = str_new(); 791 792 help.max_width = getmaxx(stdscr) - 10; 793 menu_get_ext_help(menu, &help); 794 |
796 show_helptext(_(menu_get_prompt(menu)), str_get(&help)); | 795 show_helptext(menu_get_prompt(menu), str_get(&help)); |
797 str_free(&help); 798} 799 800static void conf_choice(struct menu *menu) 801{ | 796 str_free(&help); 797} 798 799static void conf_choice(struct menu *menu) 800{ |
802 const char *prompt = _(menu_get_prompt(menu)); | 801 const char *prompt = menu_get_prompt(menu); |
803 struct menu *child; 804 struct symbol *active; 805 806 active = sym_get_choice_value(menu->sym); 807 while (1) { 808 int res; 809 int selected; 810 item_reset(); 811 812 current_menu = menu; 813 for (child = menu->list; child; child = child->next) { 814 if (!menu_is_visible(child)) 815 continue; 816 if (child->sym) | 802 struct menu *child; 803 struct symbol *active; 804 805 active = sym_get_choice_value(menu->sym); 806 while (1) { 807 int res; 808 int selected; 809 item_reset(); 810 811 current_menu = menu; 812 for (child = menu->list; child; child = child->next) { 813 if (!menu_is_visible(child)) 814 continue; 815 if (child->sym) |
817 item_make("%s", _(menu_get_prompt(child))); | 816 item_make("%s", menu_get_prompt(child)); |
818 else { | 817 else { |
819 item_make("*** %s ***", _(menu_get_prompt(child))); | 818 item_make("*** %s ***", menu_get_prompt(child)); |
820 item_set_tag(':'); 821 } 822 item_set_data(child); 823 if (child->sym == active) 824 item_set_selected(1); 825 if (child->sym == sym_get_choice_value(menu->sym)) 826 item_set_tag('X'); 827 } 828 dialog_clear(); | 819 item_set_tag(':'); 820 } 821 item_set_data(child); 822 if (child->sym == active) 823 item_set_selected(1); 824 if (child->sym == sym_get_choice_value(menu->sym)) 825 item_set_tag('X'); 826 } 827 dialog_clear(); |
829 res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"), 830 _(radiolist_instructions), | 828 res = dialog_checklist(prompt ? prompt : "Main Menu", 829 radiolist_instructions, |
831 MENUBOX_HEIGTH_MIN, 832 MENUBOX_WIDTH_MIN, 833 CHECKLIST_HEIGTH_MIN); 834 selected = item_activate_selected(); 835 switch (res) { 836 case 0: 837 if (selected) { 838 child = item_data(); --- 24 unchanged lines hidden (view full) --- 863 const char *prompt = menu_get_prompt(menu); 864 865 while (1) { 866 int res; 867 const char *heading; 868 869 switch (sym_get_type(menu->sym)) { 870 case S_INT: | 830 MENUBOX_HEIGTH_MIN, 831 MENUBOX_WIDTH_MIN, 832 CHECKLIST_HEIGTH_MIN); 833 selected = item_activate_selected(); 834 switch (res) { 835 case 0: 836 if (selected) { 837 child = item_data(); --- 24 unchanged lines hidden (view full) --- 862 const char *prompt = menu_get_prompt(menu); 863 864 while (1) { 865 int res; 866 const char *heading; 867 868 switch (sym_get_type(menu->sym)) { 869 case S_INT: |
871 heading = _(inputbox_instructions_int); | 870 heading = inputbox_instructions_int; |
872 break; 873 case S_HEX: | 871 break; 872 case S_HEX: |
874 heading = _(inputbox_instructions_hex); | 873 heading = inputbox_instructions_hex; |
875 break; 876 case S_STRING: | 874 break; 875 case S_STRING: |
877 heading = _(inputbox_instructions_string); | 876 heading = inputbox_instructions_string; |
878 break; 879 default: | 877 break; 878 default: |
880 heading = _("Internal mconf error!"); | 879 heading = "Internal mconf error!"; |
881 } 882 dialog_clear(); | 880 } 881 dialog_clear(); |
883 res = dialog_inputbox(prompt ? _(prompt) : _("Main Menu"), | 882 res = dialog_inputbox(prompt ? prompt : "Main Menu", |
884 heading, 10, 75, 885 sym_get_string_value(menu->sym)); 886 switch (res) { 887 case 0: 888 if (sym_set_string_value(menu->sym, dialog_input_result)) 889 return; | 883 heading, 10, 75, 884 sym_get_string_value(menu->sym)); 885 switch (res) { 886 case 0: 887 if (sym_set_string_value(menu->sym, dialog_input_result)) 888 return; |
890 show_textbox(NULL, _("You have made an invalid entry."), 5, 43); | 889 show_textbox(NULL, "You have made an invalid entry.", 5, 43); |
891 break; 892 case 1: 893 show_help(menu); 894 break; 895 case KEY_ESC: 896 return; 897 } 898 } --- 11 unchanged lines hidden (view full) --- 910 case 0: 911 if (!dialog_input_result[0]) 912 return; 913 if (!conf_read(dialog_input_result)) { 914 set_config_filename(dialog_input_result); 915 sym_set_change_count(1); 916 return; 917 } | 890 break; 891 case 1: 892 show_help(menu); 893 break; 894 case KEY_ESC: 895 return; 896 } 897 } --- 11 unchanged lines hidden (view full) --- 909 case 0: 910 if (!dialog_input_result[0]) 911 return; 912 if (!conf_read(dialog_input_result)) { 913 set_config_filename(dialog_input_result); 914 sym_set_change_count(1); 915 return; 916 } |
918 show_textbox(NULL, _("File does not exist!"), 5, 38); | 917 show_textbox(NULL, "File does not exist!", 5, 38); |
919 break; 920 case 1: | 918 break; 919 case 1: |
921 show_helptext(_("Load Alternate Configuration"), load_config_help); | 920 show_helptext("Load Alternate Configuration", load_config_help); |
922 break; 923 case KEY_ESC: 924 return; 925 } 926 } 927} 928 929static void conf_save(void) --- 6 unchanged lines hidden (view full) --- 936 switch(res) { 937 case 0: 938 if (!dialog_input_result[0]) 939 return; 940 if (!conf_write(dialog_input_result)) { 941 set_config_filename(dialog_input_result); 942 return; 943 } | 921 break; 922 case KEY_ESC: 923 return; 924 } 925 } 926} 927 928static void conf_save(void) --- 6 unchanged lines hidden (view full) --- 935 switch(res) { 936 case 0: 937 if (!dialog_input_result[0]) 938 return; 939 if (!conf_write(dialog_input_result)) { 940 set_config_filename(dialog_input_result); 941 return; 942 } |
944 show_textbox(NULL, _("Can't create file! Probably a nonexistent directory."), 5, 60); | 943 show_textbox(NULL, "Can't create file! Probably a nonexistent directory.", 5, 60); |
945 break; 946 case 1: | 944 break; 945 case 1: |
947 show_helptext(_("Save Alternate Configuration"), save_config_help); | 946 show_helptext("Save Alternate Configuration", save_config_help); |
948 break; 949 case KEY_ESC: 950 return; 951 } 952 } 953} 954 955static int handle_exit(void) 956{ 957 int res; 958 959 save_and_exit = 1; 960 reset_subtitle(); 961 dialog_clear(); 962 if (conf_get_changed()) 963 res = dialog_yesno(NULL, | 947 break; 948 case KEY_ESC: 949 return; 950 } 951 } 952} 953 954static int handle_exit(void) 955{ 956 int res; 957 958 save_and_exit = 1; 959 reset_subtitle(); 960 dialog_clear(); 961 if (conf_get_changed()) 962 res = dialog_yesno(NULL, |
964 _("Do you wish to save your new configuration?\n" 965 "(Press <ESC><ESC> to continue kernel configuration.)"), | 963 "Do you wish to save your new configuration?\n" 964 "(Press <ESC><ESC> to continue kernel configuration.)", |
966 6, 60); 967 else 968 res = -1; 969 970 end_dialog(saved_x, saved_y); 971 972 switch (res) { 973 case 0: 974 if (conf_write(filename)) { | 965 6, 60); 966 else 967 res = -1; 968 969 end_dialog(saved_x, saved_y); 970 971 switch (res) { 972 case 0: 973 if (conf_write(filename)) { |
975 fprintf(stderr, _("\n\n" | 974 fprintf(stderr, "\n\n" |
976 "Error while writing of the configuration.\n" 977 "Your configuration changes were NOT saved." | 975 "Error while writing of the configuration.\n" 976 "Your configuration changes were NOT saved." |
978 "\n\n")); | 977 "\n\n"); |
979 return 1; 980 } 981 /* fall through */ 982 case -1: 983 if (!silent) | 978 return 1; 979 } 980 /* fall through */ 981 case -1: 982 if (!silent) |
984 printf(_("\n\n" | 983 printf("\n\n" |
985 "*** End of the configuration.\n" 986 "*** Execute 'make' to start the build or try 'make help'." | 984 "*** End of the configuration.\n" 985 "*** Execute 'make' to start the build or try 'make help'." |
987 "\n\n")); | 986 "\n\n"); |
988 res = 0; 989 break; 990 default: 991 if (!silent) | 987 res = 0; 988 break; 989 default: 990 if (!silent) |
992 fprintf(stderr, _("\n\n" | 991 fprintf(stderr, "\n\n" |
993 "Your configuration changes were NOT saved." | 992 "Your configuration changes were NOT saved." |
994 "\n\n")); | 993 "\n\n"); |
995 if (res != KEY_ESC) 996 res = 0; 997 } 998 999 return res; 1000} 1001 1002static void sig_handler(int signo) 1003{ 1004 exit(handle_exit()); 1005} 1006 1007int main(int ac, char **av) 1008{ 1009 char *mode; 1010 int res; 1011 | 994 if (res != KEY_ESC) 995 res = 0; 996 } 997 998 return res; 999} 1000 1001static void sig_handler(int signo) 1002{ 1003 exit(handle_exit()); 1004} 1005 1006int main(int ac, char **av) 1007{ 1008 char *mode; 1009 int res; 1010 |
1012 setlocale(LC_ALL, ""); 1013 bindtextdomain(PACKAGE, LOCALEDIR); 1014 textdomain(PACKAGE); 1015 | |
1016 signal(SIGINT, sig_handler); 1017 1018 if (ac > 1 && strcmp(av[1], "-s") == 0) { 1019 silent = 1; 1020 /* Silence conf_read() until the real callback is set up */ 1021 conf_set_message_callback(NULL); 1022 av++; 1023 } 1024 conf_parse(av[1]); 1025 conf_read(NULL); 1026 1027 mode = getenv("MENUCONFIG_MODE"); 1028 if (mode) { 1029 if (!strcasecmp(mode, "single_menu")) 1030 single_menu_mode = 1; 1031 } 1032 1033 if (init_dialog(NULL)) { | 1011 signal(SIGINT, sig_handler); 1012 1013 if (ac > 1 && strcmp(av[1], "-s") == 0) { 1014 silent = 1; 1015 /* Silence conf_read() until the real callback is set up */ 1016 conf_set_message_callback(NULL); 1017 av++; 1018 } 1019 conf_parse(av[1]); 1020 conf_read(NULL); 1021 1022 mode = getenv("MENUCONFIG_MODE"); 1023 if (mode) { 1024 if (!strcasecmp(mode, "single_menu")) 1025 single_menu_mode = 1; 1026 } 1027 1028 if (init_dialog(NULL)) { |
1034 fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); 1035 fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); | 1029 fprintf(stderr, "Your display is too small to run Menuconfig!\n"); 1030 fprintf(stderr, "It must be at least 19 lines by 80 columns.\n"); |
1036 return 1; 1037 } 1038 1039 set_config_filename(conf_get_configname()); 1040 conf_set_message_callback(conf_message_callback); 1041 do { 1042 conf(&rootmenu, NULL); 1043 res = handle_exit(); 1044 } while (res == KEY_ESC); 1045 1046 return res; 1047} | 1031 return 1; 1032 } 1033 1034 set_config_filename(conf_get_configname()); 1035 conf_set_message_callback(conf_message_callback); 1036 do { 1037 conf(&rootmenu, NULL); 1038 res = handle_exit(); 1039 } while (res == KEY_ESC); 1040 1041 return res; 1042} |