diff options
| -rw-r--r-- | scripts/kconfig/confdata.c | 49 | ||||
| -rw-r--r-- | scripts/kconfig/lxdialog/textbox.c | 3 | ||||
| -rw-r--r-- | scripts/kconfig/mconf.c | 86 |
3 files changed, 89 insertions, 49 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 59b667cae5f3..5a58965d8800 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
| @@ -503,17 +503,6 @@ header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | |||
| 503 | fprintf(fp, "#define %s%s%s 1\n", | 503 | fprintf(fp, "#define %s%s%s 1\n", |
| 504 | CONFIG_, sym->name, suffix); | 504 | CONFIG_, sym->name, suffix); |
| 505 | } | 505 | } |
| 506 | /* | ||
| 507 | * Generate the __enabled_CONFIG_* and | ||
| 508 | * __enabled_CONFIG_*_MODULE macros for use by the | ||
| 509 | * IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is | ||
| 510 | * generated even for booleans so that the IS_ENABLED() macro | ||
| 511 | * works. | ||
| 512 | */ | ||
| 513 | fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n", | ||
| 514 | sym->name, (*value == 'y')); | ||
| 515 | fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n", | ||
| 516 | sym->name, (*value == 'm')); | ||
| 517 | break; | 506 | break; |
| 518 | } | 507 | } |
| 519 | case S_HEX: { | 508 | case S_HEX: { |
| @@ -565,6 +554,35 @@ static struct conf_printer header_printer_cb = | |||
| 565 | }; | 554 | }; |
| 566 | 555 | ||
| 567 | /* | 556 | /* |
| 557 | * Generate the __enabled_CONFIG_* and __enabled_CONFIG_*_MODULE macros for | ||
| 558 | * use by the IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is | ||
| 559 | * generated even for booleans so that the IS_ENABLED() macro works. | ||
| 560 | */ | ||
| 561 | static void | ||
| 562 | header_print__enabled_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | ||
| 563 | { | ||
| 564 | |||
| 565 | switch (sym->type) { | ||
| 566 | case S_BOOLEAN: | ||
| 567 | case S_TRISTATE: { | ||
| 568 | fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n", | ||
| 569 | sym->name, (*value == 'y')); | ||
| 570 | fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n", | ||
| 571 | sym->name, (*value == 'm')); | ||
| 572 | break; | ||
| 573 | } | ||
| 574 | default: | ||
| 575 | break; | ||
| 576 | } | ||
| 577 | } | ||
| 578 | |||
| 579 | static struct conf_printer header__enabled_printer_cb = | ||
| 580 | { | ||
| 581 | .print_symbol = header_print__enabled_symbol, | ||
| 582 | .print_comment = header_print_comment, | ||
| 583 | }; | ||
| 584 | |||
| 585 | /* | ||
| 568 | * Tristate printer | 586 | * Tristate printer |
| 569 | * | 587 | * |
| 570 | * This printer is used when generating the `include/config/tristate.conf' file. | 588 | * This printer is used when generating the `include/config/tristate.conf' file. |
| @@ -945,11 +963,16 @@ int conf_write_autoconf(void) | |||
| 945 | conf_write_heading(out_h, &header_printer_cb, NULL); | 963 | conf_write_heading(out_h, &header_printer_cb, NULL); |
| 946 | 964 | ||
| 947 | for_all_symbols(i, sym) { | 965 | for_all_symbols(i, sym) { |
| 966 | if (!sym->name) | ||
| 967 | continue; | ||
| 968 | |||
| 948 | sym_calc_value(sym); | 969 | sym_calc_value(sym); |
| 949 | if (!(sym->flags & SYMBOL_WRITE) || !sym->name) | 970 | |
| 971 | conf_write_symbol(out_h, sym, &header__enabled_printer_cb, NULL); | ||
| 972 | |||
| 973 | if (!(sym->flags & SYMBOL_WRITE)) | ||
| 950 | continue; | 974 | continue; |
| 951 | 975 | ||
| 952 | /* write symbol to auto.conf, tristate and header files */ | ||
| 953 | conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); | 976 | conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); |
| 954 | 977 | ||
| 955 | conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); | 978 | conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); |
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c index c704712d0227..154c2dd245b7 100644 --- a/scripts/kconfig/lxdialog/textbox.c +++ b/scripts/kconfig/lxdialog/textbox.c | |||
| @@ -320,7 +320,6 @@ static void print_page(WINDOW * win, int height, int width) | |||
| 320 | */ | 320 | */ |
| 321 | static void print_line(WINDOW * win, int row, int width) | 321 | static void print_line(WINDOW * win, int row, int width) |
| 322 | { | 322 | { |
| 323 | int y, x; | ||
| 324 | char *line; | 323 | char *line; |
| 325 | 324 | ||
| 326 | line = get_line(); | 325 | line = get_line(); |
| @@ -329,10 +328,10 @@ static void print_line(WINDOW * win, int row, int width) | |||
| 329 | waddch(win, ' '); | 328 | waddch(win, ' '); |
| 330 | waddnstr(win, line, MIN(strlen(line), width - 2)); | 329 | waddnstr(win, line, MIN(strlen(line), width - 2)); |
| 331 | 330 | ||
| 332 | getyx(win, y, x); | ||
| 333 | /* Clear 'residue' of previous line */ | 331 | /* Clear 'residue' of previous line */ |
| 334 | #if OLD_NCURSES | 332 | #if OLD_NCURSES |
| 335 | { | 333 | { |
| 334 | int x = getcurx(win); | ||
| 336 | int i; | 335 | int i; |
| 337 | for (i = 0; i < width - x; i++) | 336 | for (i = 0; i < width - x; i++) |
| 338 | waddch(win, ' '); | 337 | waddch(win, ' '); |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 820d2b6800fb..19e200d91120 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | #include <stdarg.h> | 15 | #include <stdarg.h> |
| 16 | #include <stdlib.h> | 16 | #include <stdlib.h> |
| 17 | #include <string.h> | 17 | #include <string.h> |
| 18 | #include <signal.h> | ||
| 18 | #include <unistd.h> | 19 | #include <unistd.h> |
| 19 | #include <locale.h> | 20 | #include <locale.h> |
| 20 | 21 | ||
| @@ -272,6 +273,7 @@ static struct menu *current_menu; | |||
| 272 | static int child_count; | 273 | static int child_count; |
| 273 | static int single_menu_mode; | 274 | static int single_menu_mode; |
| 274 | static int show_all_options; | 275 | static int show_all_options; |
| 276 | static int saved_x, saved_y; | ||
| 275 | 277 | ||
| 276 | static void conf(struct menu *menu); | 278 | static void conf(struct menu *menu); |
| 277 | static void conf_choice(struct menu *menu); | 279 | static void conf_choice(struct menu *menu); |
| @@ -792,9 +794,54 @@ static void conf_save(void) | |||
| 792 | } | 794 | } |
| 793 | } | 795 | } |
| 794 | 796 | ||
| 797 | static int handle_exit(void) | ||
| 798 | { | ||
| 799 | int res; | ||
| 800 | |||
| 801 | dialog_clear(); | ||
| 802 | if (conf_get_changed()) | ||
| 803 | res = dialog_yesno(NULL, | ||
| 804 | _("Do you wish to save your new configuration ?\n" | ||
| 805 | "<ESC><ESC> to continue."), | ||
| 806 | 6, 60); | ||
| 807 | else | ||
| 808 | res = -1; | ||
| 809 | |||
| 810 | end_dialog(saved_x, saved_y); | ||
| 811 | |||
| 812 | switch (res) { | ||
| 813 | case 0: | ||
| 814 | if (conf_write(filename)) { | ||
| 815 | fprintf(stderr, _("\n\n" | ||
| 816 | "Error while writing of the configuration.\n" | ||
| 817 | "Your configuration changes were NOT saved." | ||
| 818 | "\n\n")); | ||
| 819 | return 1; | ||
| 820 | } | ||
| 821 | /* fall through */ | ||
| 822 | case -1: | ||
| 823 | printf(_("\n\n" | ||
| 824 | "*** End of the configuration.\n" | ||
| 825 | "*** Execute 'make' to start the build or try 'make help'." | ||
| 826 | "\n\n")); | ||
| 827 | res = 0; | ||
| 828 | break; | ||
| 829 | default: | ||
| 830 | fprintf(stderr, _("\n\n" | ||
| 831 | "Your configuration changes were NOT saved." | ||
| 832 | "\n\n")); | ||
| 833 | } | ||
| 834 | |||
| 835 | return res; | ||
| 836 | } | ||
| 837 | |||
| 838 | static void sig_handler(int signo) | ||
| 839 | { | ||
| 840 | exit(handle_exit()); | ||
| 841 | } | ||
| 842 | |||
| 795 | int main(int ac, char **av) | 843 | int main(int ac, char **av) |
| 796 | { | 844 | { |
| 797 | int saved_x, saved_y; | ||
| 798 | char *mode; | 845 | char *mode; |
| 799 | int res; | 846 | int res; |
| 800 | 847 | ||
| @@ -802,6 +849,8 @@ int main(int ac, char **av) | |||
| 802 | bindtextdomain(PACKAGE, LOCALEDIR); | 849 | bindtextdomain(PACKAGE, LOCALEDIR); |
| 803 | textdomain(PACKAGE); | 850 | textdomain(PACKAGE); |
| 804 | 851 | ||
| 852 | signal(SIGINT, sig_handler); | ||
| 853 | |||
| 805 | conf_parse(av[1]); | 854 | conf_parse(av[1]); |
| 806 | conf_read(NULL); | 855 | conf_read(NULL); |
| 807 | 856 | ||
| @@ -823,40 +872,9 @@ int main(int ac, char **av) | |||
| 823 | set_config_filename(conf_get_configname()); | 872 | set_config_filename(conf_get_configname()); |
| 824 | do { | 873 | do { |
| 825 | conf(&rootmenu); | 874 | conf(&rootmenu); |
| 826 | dialog_clear(); | 875 | res = handle_exit(); |
| 827 | if (conf_get_changed()) | ||
| 828 | res = dialog_yesno(NULL, | ||
| 829 | _("Do you wish to save your " | ||
| 830 | "new configuration?\n" | ||
| 831 | "<ESC><ESC> to continue."), | ||
| 832 | 6, 60); | ||
| 833 | else | ||
| 834 | res = -1; | ||
| 835 | } while (res == KEY_ESC); | 876 | } while (res == KEY_ESC); |
| 836 | end_dialog(saved_x, saved_y); | ||
| 837 | |||
| 838 | switch (res) { | ||
| 839 | case 0: | ||
| 840 | if (conf_write(filename)) { | ||
| 841 | fprintf(stderr, _("\n\n" | ||
| 842 | "Error while writing of the configuration.\n" | ||
| 843 | "Your configuration changes were NOT saved." | ||
| 844 | "\n\n")); | ||
| 845 | return 1; | ||
| 846 | } | ||
| 847 | /* fall through */ | ||
| 848 | case -1: | ||
| 849 | printf(_("\n\n" | ||
| 850 | "*** End of the configuration.\n" | ||
| 851 | "*** Execute 'make' to start the build or try 'make help'." | ||
| 852 | "\n\n")); | ||
| 853 | break; | ||
| 854 | default: | ||
| 855 | fprintf(stderr, _("\n\n" | ||
| 856 | "Your configuration changes were NOT saved." | ||
| 857 | "\n\n")); | ||
| 858 | } | ||
| 859 | 877 | ||
| 860 | return 0; | 878 | return res; |
| 861 | } | 879 | } |
| 862 | 880 | ||
