aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-11-06 21:52:52 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-11-06 21:52:52 -0500
commita84f6aa68e35a911c28e5871c87356dce3607b40 (patch)
tree4093b13e359d68ba99c39b0f156124265adb6349
parentdede6faac448db4251f8996d7dec6afb5a43726a (diff)
parent93072c3ecafcf188390750cc755185f3150736b9 (diff)
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
* 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: scripts/kconfig/nconf: add KEY_HOME / KEY_END for dialog_inputbox scripts/kconfig/nconf: fix editing long strings scripts/kconfig/nconf: dynamically alloc dialog_input_result scripts/kconfig/nconf: fix memmove's length arg scripts/kconfig/nconf: fix typo: unknow => unknown kconfig: fix set but not used variables kconfig: handle SIGINT in menuconfig kconfig: fix __enabled_ macros definition for invisible and un-selected symbols kconfig: factor code in menu_get_ext_help() kbuild: Fix help text not displayed in choice option. kconfig/nconf: nuke unreferenced `nohelp_text' kconfig/streamline_config.pl: merge local{mod,yes}config kconfig/streamline_config.pl: use options to determine operating mode kconfig/streamline_config.pl: directly access LSMOD from the environment
-rw-r--r--scripts/kconfig/Makefile28
-rw-r--r--scripts/kconfig/confdata.c49
-rw-r--r--scripts/kconfig/lxdialog/textbox.c3
-rw-r--r--scripts/kconfig/mconf.c86
-rw-r--r--scripts/kconfig/menu.c13
-rw-r--r--scripts/kconfig/nconf.c23
-rw-r--r--scripts/kconfig/nconf.gui.c59
-rw-r--r--scripts/kconfig/nconf.h2
-rw-r--r--scripts/kconfig/streamline_config.pl22
9 files changed, 173 insertions, 112 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 82d2eb285b70..ba573fe7c74d 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -33,17 +33,9 @@ silentoldconfig: $(obj)/conf
33 $(Q)mkdir -p include/generated 33 $(Q)mkdir -p include/generated
34 $< --$@ $(Kconfig) 34 $< --$@ $(Kconfig)
35 35
36# if no path is given, then use src directory to find file 36localyesconfig localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
37ifdef LSMOD
38LSMOD_F := $(LSMOD)
39ifeq ($(findstring /,$(LSMOD)),)
40 LSMOD_F := $(objtree)/$(LSMOD)
41endif
42endif
43
44localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
45 $(Q)mkdir -p include/generated 37 $(Q)mkdir -p include/generated
46 $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config 38 $(Q)perl $< --$@ $(srctree) $(Kconfig) > .tmp.config
47 $(Q)if [ -f .config ]; then \ 39 $(Q)if [ -f .config ]; then \
48 cmp -s .tmp.config .config || \ 40 cmp -s .tmp.config .config || \
49 (mv -f .config .config.old.1; \ 41 (mv -f .config .config.old.1; \
@@ -56,22 +48,6 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf
56 fi 48 fi
57 $(Q)rm -f .tmp.config 49 $(Q)rm -f .tmp.config
58 50
59localyesconfig: $(obj)/streamline_config.pl $(obj)/conf
60 $(Q)mkdir -p include/generated
61 $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config
62 $(Q)sed -i s/=m/=y/ .tmp.config
63 $(Q)if [ -f .config ]; then \
64 cmp -s .tmp.config .config || \
65 (mv -f .config .config.old.1; \
66 mv -f .tmp.config .config; \
67 $(obj)/conf --silentoldconfig $(Kconfig); \
68 mv -f .config.old.1 .config.old) \
69 else \
70 mv -f .tmp.config .config; \
71 $(obj)/conf --silentoldconfig $(Kconfig); \
72 fi
73 $(Q)rm -f .tmp.config
74
75# Create new linux.pot file 51# Create new linux.pot file
76# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files 52# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files
77# The symlink is used to repair a deficiency in arch/um 53# The symlink is used to repair a deficiency in arch/um
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 */
561static void
562header_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
579static 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 */
321static void print_line(WINDOW * win, int row, int width) 321static 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;
272static int child_count; 273static int child_count;
273static int single_menu_mode; 274static int single_menu_mode;
274static int show_all_options; 275static int show_all_options;
276static int saved_x, saved_y;
275 277
276static void conf(struct menu *menu); 278static void conf(struct menu *menu);
277static void conf_choice(struct menu *menu); 279static void conf_choice(struct menu *menu);
@@ -792,9 +794,54 @@ static void conf_save(void)
792 } 794 }
793} 795}
794 796
797static 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
838static void sig_handler(int signo)
839{
840 exit(handle_exit());
841}
842
795int main(int ac, char **av) 843int 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
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index d66008639a43..8c2a97e60faf 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -10,8 +10,7 @@
10 10
11#include "lkc.h" 11#include "lkc.h"
12 12
13static const char nohelp_text[] = N_( 13static const char nohelp_text[] = "There is no help available for this option.";
14 "There is no help available for this option.\n");
15 14
16struct menu rootmenu; 15struct menu rootmenu;
17static struct menu **last_entry_ptr; 16static struct menu **last_entry_ptr;
@@ -595,16 +594,14 @@ struct gstr get_relations_str(struct symbol **sym_arr)
595void menu_get_ext_help(struct menu *menu, struct gstr *help) 594void menu_get_ext_help(struct menu *menu, struct gstr *help)
596{ 595{
597 struct symbol *sym = menu->sym; 596 struct symbol *sym = menu->sym;
597 const char *help_text = nohelp_text;
598 598
599 if (menu_has_help(menu)) { 599 if (menu_has_help(menu)) {
600 if (sym->name) { 600 if (sym->name)
601 str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); 601 str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
602 str_append(help, _(menu_get_help(menu))); 602 help_text = menu_get_help(menu);
603 str_append(help, "\n");
604 }
605 } else {
606 str_append(help, nohelp_text);
607 } 603 }
604 str_printf(help, "%s\n", _(help_text));
608 if (sym) 605 if (sym)
609 get_symbol_str(help, sym); 606 get_symbol_str(help, sym);
610} 607}
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 39ca1f1640ea..73070cb0b6de 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -182,8 +182,6 @@ setmod_text[] = N_(
182"This feature depends on another which\n" 182"This feature depends on another which\n"
183"has been configured as a module.\n" 183"has been configured as a module.\n"
184"As a result, this feature will be built as a module."), 184"As a result, this feature will be built as a module."),
185nohelp_text[] = N_(
186"There is no help available for this option.\n"),
187load_config_text[] = N_( 185load_config_text[] = N_(
188"Enter the name of the configuration file you wish to load.\n" 186"Enter the name of the configuration file you wish to load.\n"
189"Accept the name shown to restore the configuration you\n" 187"Accept the name shown to restore the configuration you\n"
@@ -280,6 +278,9 @@ static int global_exit;
280/* the currently selected button */ 278/* the currently selected button */
281const char *current_instructions = menu_instructions; 279const char *current_instructions = menu_instructions;
282 280
281static char *dialog_input_result;
282static int dialog_input_result_len;
283
283static void conf(struct menu *menu); 284static void conf(struct menu *menu);
284static void conf_choice(struct menu *menu); 285static void conf_choice(struct menu *menu);
285static void conf_string(struct menu *menu); 286static void conf_string(struct menu *menu);
@@ -695,7 +696,6 @@ static void search_conf(void)
695{ 696{
696 struct symbol **sym_arr; 697 struct symbol **sym_arr;
697 struct gstr res; 698 struct gstr res;
698 char dialog_input_result[100];
699 char *dialog_input; 699 char *dialog_input;
700 int dres; 700 int dres;
701again: 701again:
@@ -703,7 +703,7 @@ again:
703 _("Search Configuration Parameter"), 703 _("Search Configuration Parameter"),
704 _("Enter " CONFIG_ " (sub)string to search for " 704 _("Enter " CONFIG_ " (sub)string to search for "
705 "(with or without \"" CONFIG_ "\")"), 705 "(with or without \"" CONFIG_ "\")"),
706 "", dialog_input_result, 99); 706 "", &dialog_input_result, &dialog_input_result_len);
707 switch (dres) { 707 switch (dres) {
708 case 0: 708 case 0:
709 break; 709 break;
@@ -1348,7 +1348,6 @@ static void conf_choice(struct menu *menu)
1348static void conf_string(struct menu *menu) 1348static void conf_string(struct menu *menu)
1349{ 1349{
1350 const char *prompt = menu_get_prompt(menu); 1350 const char *prompt = menu_get_prompt(menu);
1351 char dialog_input_result[256];
1352 1351
1353 while (1) { 1352 while (1) {
1354 int res; 1353 int res;
@@ -1371,8 +1370,8 @@ static void conf_string(struct menu *menu)
1371 prompt ? _(prompt) : _("Main Menu"), 1370 prompt ? _(prompt) : _("Main Menu"),
1372 heading, 1371 heading,
1373 sym_get_string_value(menu->sym), 1372 sym_get_string_value(menu->sym),
1374 dialog_input_result, 1373 &dialog_input_result,
1375 sizeof(dialog_input_result)); 1374 &dialog_input_result_len);
1376 switch (res) { 1375 switch (res) {
1377 case 0: 1376 case 0:
1378 if (sym_set_string_value(menu->sym, 1377 if (sym_set_string_value(menu->sym,
@@ -1392,14 +1391,13 @@ static void conf_string(struct menu *menu)
1392 1391
1393static void conf_load(void) 1392static void conf_load(void)
1394{ 1393{
1395 char dialog_input_result[256];
1396 while (1) { 1394 while (1) {
1397 int res; 1395 int res;
1398 res = dialog_inputbox(main_window, 1396 res = dialog_inputbox(main_window,
1399 NULL, load_config_text, 1397 NULL, load_config_text,
1400 filename, 1398 filename,
1401 dialog_input_result, 1399 &dialog_input_result,
1402 sizeof(dialog_input_result)); 1400 &dialog_input_result_len);
1403 switch (res) { 1401 switch (res) {
1404 case 0: 1402 case 0:
1405 if (!dialog_input_result[0]) 1403 if (!dialog_input_result[0])
@@ -1424,14 +1422,13 @@ static void conf_load(void)
1424 1422
1425static void conf_save(void) 1423static void conf_save(void)
1426{ 1424{
1427 char dialog_input_result[256];
1428 while (1) { 1425 while (1) {
1429 int res; 1426 int res;
1430 res = dialog_inputbox(main_window, 1427 res = dialog_inputbox(main_window,
1431 NULL, save_config_text, 1428 NULL, save_config_text,
1432 filename, 1429 filename,
1433 dialog_input_result, 1430 &dialog_input_result,
1434 sizeof(dialog_input_result)); 1431 &dialog_input_result_len);
1435 switch (res) { 1432 switch (res) {
1436 case 0: 1433 case 0:
1437 if (!dialog_input_result[0]) 1434 if (!dialog_input_result[0])
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
index f8137b3a5382..3b18dd839668 100644
--- a/scripts/kconfig/nconf.gui.c
+++ b/scripts/kconfig/nconf.gui.c
@@ -356,7 +356,7 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...)
356 356
357int dialog_inputbox(WINDOW *main_window, 357int dialog_inputbox(WINDOW *main_window,
358 const char *title, const char *prompt, 358 const char *title, const char *prompt,
359 const char *init, char *result, int result_len) 359 const char *init, char **resultp, int *result_len)
360{ 360{
361 int prompt_lines = 0; 361 int prompt_lines = 0;
362 int prompt_width = 0; 362 int prompt_width = 0;
@@ -367,7 +367,13 @@ int dialog_inputbox(WINDOW *main_window,
367 int i, x, y; 367 int i, x, y;
368 int res = -1; 368 int res = -1;
369 int cursor_position = strlen(init); 369 int cursor_position = strlen(init);
370 int cursor_form_win;
371 char *result = *resultp;
370 372
373 if (strlen(init)+1 > *result_len) {
374 *result_len = strlen(init)+1;
375 *resultp = result = realloc(result, *result_len);
376 }
371 377
372 /* find the widest line of msg: */ 378 /* find the widest line of msg: */
373 prompt_lines = get_line_no(prompt); 379 prompt_lines = get_line_no(prompt);
@@ -384,7 +390,7 @@ int dialog_inputbox(WINDOW *main_window,
384 y = (LINES-(prompt_lines+4))/2; 390 y = (LINES-(prompt_lines+4))/2;
385 x = (COLS-(prompt_width+4))/2; 391 x = (COLS-(prompt_width+4))/2;
386 392
387 strncpy(result, init, result_len); 393 strncpy(result, init, *result_len);
388 394
389 /* create the windows */ 395 /* create the windows */
390 win = newwin(prompt_lines+6, prompt_width+7, y, x); 396 win = newwin(prompt_lines+6, prompt_width+7, y, x);
@@ -405,7 +411,9 @@ int dialog_inputbox(WINDOW *main_window,
405 fill_window(prompt_win, prompt); 411 fill_window(prompt_win, prompt);
406 412
407 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " "); 413 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
408 mvwprintw(form_win, 0, 0, "%s", result); 414 cursor_form_win = min(cursor_position, prompt_width-1);
415 mvwprintw(form_win, 0, 0, "%s",
416 result + cursor_position-cursor_form_win);
409 417
410 /* create panels */ 418 /* create panels */
411 panel = new_panel(win); 419 panel = new_panel(win);
@@ -431,6 +439,8 @@ int dialog_inputbox(WINDOW *main_window,
431 &result[cursor_position], 439 &result[cursor_position],
432 len-cursor_position+1); 440 len-cursor_position+1);
433 cursor_position--; 441 cursor_position--;
442 cursor_form_win--;
443 len--;
434 } 444 }
435 break; 445 break;
436 case KEY_DC: 446 case KEY_DC:
@@ -438,38 +448,63 @@ int dialog_inputbox(WINDOW *main_window,
438 memmove(&result[cursor_position], 448 memmove(&result[cursor_position],
439 &result[cursor_position+1], 449 &result[cursor_position+1],
440 len-cursor_position+1); 450 len-cursor_position+1);
451 len--;
441 } 452 }
442 break; 453 break;
443 case KEY_UP: 454 case KEY_UP:
444 case KEY_RIGHT: 455 case KEY_RIGHT:
445 if (cursor_position < len && 456 if (cursor_position < len) {
446 cursor_position < min(result_len, prompt_width))
447 cursor_position++; 457 cursor_position++;
458 cursor_form_win++;
459 }
448 break; 460 break;
449 case KEY_DOWN: 461 case KEY_DOWN:
450 case KEY_LEFT: 462 case KEY_LEFT:
451 if (cursor_position > 0) 463 if (cursor_position > 0) {
452 cursor_position--; 464 cursor_position--;
465 cursor_form_win--;
466 }
467 break;
468 case KEY_HOME:
469 cursor_position = 0;
470 cursor_form_win = 0;
471 break;
472 case KEY_END:
473 cursor_position = len;
474 cursor_form_win = min(cursor_position, prompt_width-1);
453 break; 475 break;
454 default: 476 default:
455 if ((isgraph(res) || isspace(res)) && 477 if ((isgraph(res) || isspace(res))) {
456 len-2 < result_len) { 478 /* one for new char, one for '\0' */
479 if (len+2 > *result_len) {
480 *result_len = len+2;
481 *resultp = result = realloc(result,
482 *result_len);
483 }
457 /* insert the char at the proper position */ 484 /* insert the char at the proper position */
458 memmove(&result[cursor_position+1], 485 memmove(&result[cursor_position+1],
459 &result[cursor_position], 486 &result[cursor_position],
460 len+1); 487 len-cursor_position+1);
461 result[cursor_position] = res; 488 result[cursor_position] = res;
462 cursor_position++; 489 cursor_position++;
490 cursor_form_win++;
491 len++;
463 } else { 492 } else {
464 mvprintw(0, 0, "unknow key: %d\n", res); 493 mvprintw(0, 0, "unknown key: %d\n", res);
465 } 494 }
466 break; 495 break;
467 } 496 }
497 if (cursor_form_win < 0)
498 cursor_form_win = 0;
499 else if (cursor_form_win > prompt_width-1)
500 cursor_form_win = prompt_width-1;
501
468 wmove(form_win, 0, 0); 502 wmove(form_win, 0, 0);
469 wclrtoeol(form_win); 503 wclrtoeol(form_win);
470 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " "); 504 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
471 mvwprintw(form_win, 0, 0, "%s", result); 505 mvwprintw(form_win, 0, 0, "%s",
472 wmove(form_win, 0, cursor_position); 506 result + cursor_position-cursor_form_win);
507 wmove(form_win, 0, cursor_form_win);
473 touchwin(win); 508 touchwin(win);
474 refresh_all_windows(main_window); 509 refresh_all_windows(main_window);
475 510
diff --git a/scripts/kconfig/nconf.h b/scripts/kconfig/nconf.h
index 58fbda8fc0dc..0d5261705ef5 100644
--- a/scripts/kconfig/nconf.h
+++ b/scripts/kconfig/nconf.h
@@ -89,7 +89,7 @@ void fill_window(WINDOW *win, const char *text);
89int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...); 89int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...);
90int dialog_inputbox(WINDOW *main_window, 90int dialog_inputbox(WINDOW *main_window,
91 const char *title, const char *prompt, 91 const char *title, const char *prompt,
92 const char *init, char *result, int result_len); 92 const char *init, char **resultp, int *result_len);
93void refresh_all_windows(WINDOW *main_window); 93void refresh_all_windows(WINDOW *main_window);
94void show_scroll_win(WINDOW *main_window, 94void show_scroll_win(WINDOW *main_window,
95 const char *title, 95 const char *title,
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
index a4fe923c0131..ec7afce4c88d 100644
--- a/scripts/kconfig/streamline_config.pl
+++ b/scripts/kconfig/streamline_config.pl
@@ -43,6 +43,7 @@
43# make oldconfig 43# make oldconfig
44# 44#
45use strict; 45use strict;
46use Getopt::Long;
46 47
47my $config = ".config"; 48my $config = ".config";
48 49
@@ -112,10 +113,17 @@ sub find_config {
112 113
113find_config; 114find_config;
114 115
116# Parse options
117my $localmodconfig = 0;
118my $localyesconfig = 0;
119
120GetOptions("localmodconfig" => \$localmodconfig,
121 "localyesconfig" => \$localyesconfig);
122
115# Get the build source and top level Kconfig file (passed in) 123# Get the build source and top level Kconfig file (passed in)
116my $ksource = $ARGV[0]; 124my $ksource = $ARGV[0];
117my $kconfig = $ARGV[1]; 125my $kconfig = $ARGV[1];
118my $lsmod_file = $ARGV[2]; 126my $lsmod_file = $ENV{'LSMOD'};
119 127
120my @makefiles = `find $ksource -name Makefile 2>/dev/null`; 128my @makefiles = `find $ksource -name Makefile 2>/dev/null`;
121chomp @makefiles; 129chomp @makefiles;
@@ -296,7 +304,11 @@ my %modules;
296 304
297if (defined($lsmod_file)) { 305if (defined($lsmod_file)) {
298 if ( ! -f $lsmod_file) { 306 if ( ! -f $lsmod_file) {
299 die "$lsmod_file not found"; 307 if ( -f $ENV{'objtree'}."/".$lsmod_file) {
308 $lsmod_file = $ENV{'objtree'}."/".$lsmod_file;
309 } else {
310 die "$lsmod_file not found";
311 }
300 } 312 }
301 if ( -x $lsmod_file) { 313 if ( -x $lsmod_file) {
302 # the file is executable, run it 314 # the file is executable, run it
@@ -421,7 +433,11 @@ while(<CIN>) {
421 433
422 if (/^(CONFIG.*)=(m|y)/) { 434 if (/^(CONFIG.*)=(m|y)/) {
423 if (defined($configs{$1})) { 435 if (defined($configs{$1})) {
424 $setconfigs{$1} = $2; 436 if ($localyesconfig) {
437 $setconfigs{$1} = 'y';
438 } else {
439 $setconfigs{$1} = $2;
440 }
425 } elsif ($2 eq "m") { 441 } elsif ($2 eq "m") {
426 print "# $1 is not set\n"; 442 print "# $1 is not set\n";
427 next; 443 next;