summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 15:28:30 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 15:28:30 -0500
commit309667e53fcfd8e0b423280b6ea5a648fd92166c (patch)
tree07cefc8a5268d8d21f2f9262823fb22a1e34b390
parentad60a9333035f2323840b71ab8ad07bbab728faf (diff)
parente3900e74f26fc924c8e9e2a922bd40369b0bb517 (diff)
Merge branch 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kconfig changes from Michal Marek: "I forgot to send a pull request in time for the v3.8-rc1 merge window, so the list is a bit longer this time: - menuconfig enables extended colors in ncurses if the wide-character version is used. - CONFIG_ prefix can be specified in the environment to make life easier for people using kconfig multiple times in a single tree (no functional change in the kernel kconfig usage). - kconfig aborts on OOM. - inputboxes in menuconfig allow to move the cursor. - menuconfig has Save/Load buttons now. - xconfig build fix with new g++ and Qt3. - nconfig color scheme fix and help text update. - make oldconfig prints newlines when output is redirected. - some other minor fixes." * 'kconfig' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: kbuild: Fix missing '\n' for NEW symbols in yes "" | make oldconfig >conf.new kconfig: nconf: rewrite labels of function keys line kconfig: nconf: rewrite help texts kconfig: fix a compiliation error when using make xconfig nconf: function keys line, change background color for better readability menuconfig: Get rid of the top-level entries for "Load an Alternate/Save an Alternate" menuconfig: Add Save/Load buttons kconfig:lxdialog: remove duplicate code menuconfig:inputbox: support navigate input position kconfig: document use of CONFIG_ environment variable scripts/kconfig: ensure we use proper CONFIG_ prefix merge_config.sh: Add option to specify output dir Revert "kconfig-language: add to hints" kconfig: Regenerate lexer kconfig: Fix malloc handling in conf tools kconfig: get CONFIG_ prefix from the environment kconfig: add a function to get the CONFIG_ prefix kconfig: remove CONFIG_ from string constants menuconfig: fix extended colors ncurses support
-rw-r--r--Documentation/kbuild/kconfig-language.txt23
-rw-r--r--Documentation/kbuild/kconfig.txt6
-rw-r--r--scripts/kconfig/Makefile3
-rw-r--r--scripts/kconfig/conf.c7
-rw-r--r--scripts/kconfig/expr.c10
-rw-r--r--scripts/kconfig/gconf.c2
-rw-r--r--scripts/kconfig/lkc.h8
-rw-r--r--scripts/kconfig/lxdialog/check-lxdialog.sh1
-rw-r--r--scripts/kconfig/lxdialog/dialog.h1
-rw-r--r--scripts/kconfig/lxdialog/inputbox.c121
-rw-r--r--scripts/kconfig/lxdialog/menubox.c20
-rw-r--r--scripts/kconfig/mconf.c54
-rw-r--r--scripts/kconfig/menu.c4
-rwxr-xr-xscripts/kconfig/merge_config.sh20
-rw-r--r--scripts/kconfig/nconf.c340
-rw-r--r--scripts/kconfig/nconf.gui.c2
-rw-r--r--scripts/kconfig/qconf.cc1
-rw-r--r--scripts/kconfig/symbol.c12
-rw-r--r--scripts/kconfig/util.c23
-rw-r--r--scripts/kconfig/zconf.l8
-rw-r--r--scripts/kconfig/zconf.lex.c_shipped8
21 files changed, 391 insertions, 283 deletions
diff --git a/Documentation/kbuild/kconfig-language.txt b/Documentation/kbuild/kconfig-language.txt
index a686f9cd69c1..c858f8419eba 100644
--- a/Documentation/kbuild/kconfig-language.txt
+++ b/Documentation/kbuild/kconfig-language.txt
@@ -388,26 +388,3 @@ config FOO
388 depends on BAR && m 388 depends on BAR && m
389 389
390limits FOO to module (=m) or disabled (=n). 390limits FOO to module (=m) or disabled (=n).
391
392Kconfig symbol existence
393~~~~~~~~~~~~~~~~~~~~~~~~
394The following two methods produce the same kconfig symbol dependencies
395but differ greatly in kconfig symbol existence (production) in the
396generated config file.
397
398case 1:
399
400config FOO
401 tristate "about foo"
402 depends on BAR
403
404vs. case 2:
405
406if BAR
407config FOO
408 tristate "about foo"
409endif
410
411In case 1, the symbol FOO will always exist in the config file (given
412no other dependencies). In case 2, the symbol FOO will only exist in
413the config file if BAR is enabled.
diff --git a/Documentation/kbuild/kconfig.txt b/Documentation/kbuild/kconfig.txt
index a09f1a6a830c..b8b77bbc784f 100644
--- a/Documentation/kbuild/kconfig.txt
+++ b/Documentation/kbuild/kconfig.txt
@@ -46,6 +46,12 @@ KCONFIG_OVERWRITECONFIG
46If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not 46If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not
47break symlinks when .config is a symlink to somewhere else. 47break symlinks when .config is a symlink to somewhere else.
48 48
49CONFIG_
50--------------------------------------------------
51If you set CONFIG_ in the environment, Kconfig will prefix all symbols
52with its value when saving the configuration, instead of using the default,
53"CONFIG_".
54
49______________________________________________________________________ 55______________________________________________________________________
50Environment variables for '{allyes/allmod/allno/rand}config' 56Environment variables for '{allyes/allmod/allno/rand}config'
51 57
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 3091794e9354..231b4759c714 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -11,6 +11,9 @@ else
11Kconfig := Kconfig 11Kconfig := Kconfig
12endif 12endif
13 13
14# We need this, in case the user has it in its environment
15unexport CONFIG_
16
14xconfig: $(obj)/qconf 17xconfig: $(obj)/qconf
15 $< $(Kconfig) 18 $< $(Kconfig)
16 19
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 4da3b4adfad2..e39fcd8143ea 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -36,6 +36,7 @@ enum input_mode {
36} input_mode = oldaskconfig; 36} input_mode = oldaskconfig;
37 37
38static int indent = 1; 38static int indent = 1;
39static int tty_stdio;
39static int valid_stdin = 1; 40static int valid_stdin = 1;
40static int sync_kconfig; 41static int sync_kconfig;
41static int conf_cnt; 42static int conf_cnt;
@@ -108,6 +109,8 @@ static int conf_askvalue(struct symbol *sym, const char *def)
108 case oldaskconfig: 109 case oldaskconfig:
109 fflush(stdout); 110 fflush(stdout);
110 xfgets(line, 128, stdin); 111 xfgets(line, 128, stdin);
112 if (!tty_stdio)
113 printf("\n");
111 return 1; 114 return 1;
112 default: 115 default:
113 break; 116 break;
@@ -495,6 +498,8 @@ int main(int ac, char **av)
495 bindtextdomain(PACKAGE, LOCALEDIR); 498 bindtextdomain(PACKAGE, LOCALEDIR);
496 textdomain(PACKAGE); 499 textdomain(PACKAGE);
497 500
501 tty_stdio = isatty(0) && isatty(1) && isatty(2);
502
498 while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { 503 while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
499 input_mode = (enum input_mode)opt; 504 input_mode = (enum input_mode)opt;
500 switch (opt) { 505 switch (opt) {
@@ -621,7 +626,7 @@ int main(int ac, char **av)
621 return 1; 626 return 1;
622 } 627 }
623 } 628 }
624 valid_stdin = isatty(0) && isatty(1) && isatty(2); 629 valid_stdin = tty_stdio;
625 } 630 }
626 631
627 switch (input_mode) { 632 switch (input_mode) {
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
index 290ce41f8ba4..d6626521f9b9 100644
--- a/scripts/kconfig/expr.c
+++ b/scripts/kconfig/expr.c
@@ -13,7 +13,7 @@
13 13
14struct expr *expr_alloc_symbol(struct symbol *sym) 14struct expr *expr_alloc_symbol(struct symbol *sym)
15{ 15{
16 struct expr *e = calloc(1, sizeof(*e)); 16 struct expr *e = xcalloc(1, sizeof(*e));
17 e->type = E_SYMBOL; 17 e->type = E_SYMBOL;
18 e->left.sym = sym; 18 e->left.sym = sym;
19 return e; 19 return e;
@@ -21,7 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym)
21 21
22struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) 22struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
23{ 23{
24 struct expr *e = calloc(1, sizeof(*e)); 24 struct expr *e = xcalloc(1, sizeof(*e));
25 e->type = type; 25 e->type = type;
26 e->left.expr = ce; 26 e->left.expr = ce;
27 return e; 27 return e;
@@ -29,7 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce)
29 29
30struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) 30struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2)
31{ 31{
32 struct expr *e = calloc(1, sizeof(*e)); 32 struct expr *e = xcalloc(1, sizeof(*e));
33 e->type = type; 33 e->type = type;
34 e->left.expr = e1; 34 e->left.expr = e1;
35 e->right.expr = e2; 35 e->right.expr = e2;
@@ -38,7 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
38 38
39struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) 39struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2)
40{ 40{
41 struct expr *e = calloc(1, sizeof(*e)); 41 struct expr *e = xcalloc(1, sizeof(*e));
42 e->type = type; 42 e->type = type;
43 e->left.sym = s1; 43 e->left.sym = s1;
44 e->right.sym = s2; 44 e->right.sym = s2;
@@ -66,7 +66,7 @@ struct expr *expr_copy(const struct expr *org)
66 if (!org) 66 if (!org)
67 return NULL; 67 return NULL;
68 68
69 e = malloc(sizeof(*org)); 69 e = xmalloc(sizeof(*org));
70 memcpy(e, org, sizeof(*org)); 70 memcpy(e, org, sizeof(*org));
71 switch (org->type) { 71 switch (org->type) {
72 case E_SYMBOL: 72 case E_SYMBOL:
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index adc230638c5b..f2bee70e26f4 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -10,6 +10,7 @@
10# include <config.h> 10# include <config.h>
11#endif 11#endif
12 12
13#include <stdlib.h>
13#include "lkc.h" 14#include "lkc.h"
14#include "images.c" 15#include "images.c"
15 16
@@ -22,7 +23,6 @@
22#include <string.h> 23#include <string.h>
23#include <unistd.h> 24#include <unistd.h>
24#include <time.h> 25#include <time.h>
25#include <stdlib.h>
26 26
27//#define DEBUG 27//#define DEBUG
28 28
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index c18f2bd9c095..f8aee5fc6d5e 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -39,6 +39,12 @@ extern "C" {
39#ifndef CONFIG_ 39#ifndef CONFIG_
40#define CONFIG_ "CONFIG_" 40#define CONFIG_ "CONFIG_"
41#endif 41#endif
42static inline const char *CONFIG_prefix(void)
43{
44 return getenv( "CONFIG_" ) ?: CONFIG_;
45}
46#undef CONFIG_
47#define CONFIG_ CONFIG_prefix()
42 48
43#define TF_COMMAND 0x0001 49#define TF_COMMAND 0x0001
44#define TF_PARAM 0x0002 50#define TF_PARAM 0x0002
@@ -116,6 +122,8 @@ void menu_set_type(int type);
116/* util.c */ 122/* util.c */
117struct file *file_lookup(const char *name); 123struct file *file_lookup(const char *name);
118int file_write_dep(const char *name); 124int file_write_dep(const char *name);
125void *xmalloc(size_t size);
126void *xcalloc(size_t nmemb, size_t size);
119 127
120struct gstr { 128struct gstr {
121 size_t len; 129 size_t len;
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index c8e8a7154753..80788137c670 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -21,6 +21,7 @@ ccflags()
21{ 21{
22 if [ -f /usr/include/ncursesw/curses.h ]; then 22 if [ -f /usr/include/ncursesw/curses.h ]; then
23 echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"' 23 echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
24 echo ' -DNCURSES_WIDECHAR=1'
24 elif [ -f /usr/include/ncurses/ncurses.h ]; then 25 elif [ -f /usr/include/ncurses/ncurses.h ]; then
25 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' 26 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
26 elif [ -f /usr/include/ncurses/curses.h ]; then 27 elif [ -f /usr/include/ncurses/curses.h ]; then
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h
index ee17a5264d5b..307022a8beef 100644
--- a/scripts/kconfig/lxdialog/dialog.h
+++ b/scripts/kconfig/lxdialog/dialog.h
@@ -221,7 +221,6 @@ int dialog_menu(const char *title, const char *prompt,
221 const void *selected, int *s_scroll); 221 const void *selected, int *s_scroll);
222int dialog_checklist(const char *title, const char *prompt, int height, 222int dialog_checklist(const char *title, const char *prompt, int height,
223 int width, int list_height); 223 int width, int list_height);
224extern char dialog_input_result[];
225int dialog_inputbox(const char *title, const char *prompt, int height, 224int dialog_inputbox(const char *title, const char *prompt, int height,
226 int width, const char *init); 225 int width, const char *init);
227 226
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c
index dd8e587c50e2..21404a04d7c3 100644
--- a/scripts/kconfig/lxdialog/inputbox.c
+++ b/scripts/kconfig/lxdialog/inputbox.c
@@ -45,7 +45,8 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width
45 const char *init) 45 const char *init)
46{ 46{
47 int i, x, y, box_y, box_x, box_width; 47 int i, x, y, box_y, box_x, box_width;
48 int input_x = 0, scroll = 0, key = 0, button = -1; 48 int input_x = 0, key = 0, button = -1;
49 int show_x, len, pos;
49 char *instr = dialog_input_result; 50 char *instr = dialog_input_result;
50 WINDOW *dialog; 51 WINDOW *dialog;
51 52
@@ -97,14 +98,17 @@ do_resize:
97 wmove(dialog, box_y, box_x); 98 wmove(dialog, box_y, box_x);
98 wattrset(dialog, dlg.inputbox.atr); 99 wattrset(dialog, dlg.inputbox.atr);
99 100
100 input_x = strlen(instr); 101 len = strlen(instr);
102 pos = len;
101 103
102 if (input_x >= box_width) { 104 if (len >= box_width) {
103 scroll = input_x - box_width + 1; 105 show_x = len - box_width + 1;
104 input_x = box_width - 1; 106 input_x = box_width - 1;
105 for (i = 0; i < box_width - 1; i++) 107 for (i = 0; i < box_width - 1; i++)
106 waddch(dialog, instr[scroll + i]); 108 waddch(dialog, instr[show_x + i]);
107 } else { 109 } else {
110 show_x = 0;
111 input_x = len;
108 waddstr(dialog, instr); 112 waddstr(dialog, instr);
109 } 113 }
110 114
@@ -121,45 +125,104 @@ do_resize:
121 case KEY_UP: 125 case KEY_UP:
122 case KEY_DOWN: 126 case KEY_DOWN:
123 break; 127 break;
124 case KEY_LEFT:
125 continue;
126 case KEY_RIGHT:
127 continue;
128 case KEY_BACKSPACE: 128 case KEY_BACKSPACE:
129 case 127: 129 case 127:
130 if (input_x || scroll) { 130 if (pos) {
131 wattrset(dialog, dlg.inputbox.atr); 131 wattrset(dialog, dlg.inputbox.atr);
132 if (!input_x) { 132 if (input_x == 0) {
133 scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1); 133 show_x--;
134 wmove(dialog, box_y, box_x);
135 for (i = 0; i < box_width; i++)
136 waddch(dialog,
137 instr[scroll + input_x + i] ?
138 instr[scroll + input_x + i] : ' ');
139 input_x = strlen(instr) - scroll;
140 } else 134 } else
141 input_x--; 135 input_x--;
142 instr[scroll + input_x] = '\0'; 136
143 mvwaddch(dialog, box_y, input_x + box_x, ' '); 137 if (pos < len) {
138 for (i = pos - 1; i < len; i++) {
139 instr[i] = instr[i+1];
140 }
141 }
142
143 pos--;
144 len--;
145 instr[len] = '\0';
146 wmove(dialog, box_y, box_x);
147 for (i = 0; i < box_width; i++) {
148 if (!instr[show_x + i]) {
149 waddch(dialog, ' ');
150 break;
151 }
152 waddch(dialog, instr[show_x + i]);
153 }
144 wmove(dialog, box_y, input_x + box_x); 154 wmove(dialog, box_y, input_x + box_x);
145 wrefresh(dialog); 155 wrefresh(dialog);
146 } 156 }
147 continue; 157 continue;
158 case KEY_LEFT:
159 if (pos > 0) {
160 if (input_x > 0) {
161 wmove(dialog, box_y, --input_x + box_x);
162 } else if (input_x == 0) {
163 show_x--;
164 wmove(dialog, box_y, box_x);
165 for (i = 0; i < box_width; i++) {
166 if (!instr[show_x + i]) {
167 waddch(dialog, ' ');
168 break;
169 }
170 waddch(dialog, instr[show_x + i]);
171 }
172 wmove(dialog, box_y, box_x);
173 }
174 pos--;
175 }
176 continue;
177 case KEY_RIGHT:
178 if (pos < len) {
179 if (input_x < box_width - 1) {
180 wmove(dialog, box_y, ++input_x + box_x);
181 } else if (input_x == box_width - 1) {
182 show_x++;
183 wmove(dialog, box_y, box_x);
184 for (i = 0; i < box_width; i++) {
185 if (!instr[show_x + i]) {
186 waddch(dialog, ' ');
187 break;
188 }
189 waddch(dialog, instr[show_x + i]);
190 }
191 wmove(dialog, box_y, input_x + box_x);
192 }
193 pos++;
194 }
195 continue;
148 default: 196 default:
149 if (key < 0x100 && isprint(key)) { 197 if (key < 0x100 && isprint(key)) {
150 if (scroll + input_x < MAX_LEN) { 198 if (len < MAX_LEN) {
151 wattrset(dialog, dlg.inputbox.atr); 199 wattrset(dialog, dlg.inputbox.atr);
152 instr[scroll + input_x] = key; 200 if (pos < len) {
153 instr[scroll + input_x + 1] = '\0'; 201 for (i = len; i > pos; i--)
202 instr[i] = instr[i-1];
203 instr[pos] = key;
204 } else {
205 instr[len] = key;
206 }
207 pos++;
208 len++;
209 instr[len] = '\0';
210
154 if (input_x == box_width - 1) { 211 if (input_x == box_width - 1) {
155 scroll++; 212 show_x++;
156 wmove(dialog, box_y, box_x);
157 for (i = 0; i < box_width - 1; i++)
158 waddch(dialog, instr [scroll + i]);
159 } else { 213 } else {
160 wmove(dialog, box_y, input_x++ + box_x); 214 input_x++;
161 waddch(dialog, key); 215 }
216
217 wmove(dialog, box_y, box_x);
218 for (i = 0; i < box_width; i++) {
219 if (!instr[show_x + i]) {
220 waddch(dialog, ' ');
221 break;
222 }
223 waddch(dialog, instr[show_x + i]);
162 } 224 }
225 wmove(dialog, box_y, input_x + box_x);
163 wrefresh(dialog); 226 wrefresh(dialog);
164 } else 227 } else
165 flash(); /* Alarm user about overflow */ 228 flash(); /* Alarm user about overflow */
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c
index 1d604738fa13..48d382e7e374 100644
--- a/scripts/kconfig/lxdialog/menubox.c
+++ b/scripts/kconfig/lxdialog/menubox.c
@@ -26,7 +26,7 @@
26 * 26 *
27 * *) A bugfix for the Page-Down problem 27 * *) A bugfix for the Page-Down problem
28 * 28 *
29 * *) Formerly when I used Page Down and Page Up, the cursor would be set 29 * *) Formerly when I used Page Down and Page Up, the cursor would be set
30 * to the first position in the menu box. Now lxdialog is a bit 30 * to the first position in the menu box. Now lxdialog is a bit
31 * smarter and works more like other menu systems (just have a look at 31 * smarter and works more like other menu systems (just have a look at
32 * it). 32 * it).
@@ -154,12 +154,14 @@ static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x,
154 */ 154 */
155static void print_buttons(WINDOW * win, int height, int width, int selected) 155static void print_buttons(WINDOW * win, int height, int width, int selected)
156{ 156{
157 int x = width / 2 - 16; 157 int x = width / 2 - 28;
158 int y = height - 2; 158 int y = height - 2;
159 159
160 print_button(win, gettext("Select"), y, x, selected == 0); 160 print_button(win, gettext("Select"), y, x, selected == 0);
161 print_button(win, gettext(" Exit "), y, x + 12, selected == 1); 161 print_button(win, gettext(" Exit "), y, x + 12, selected == 1);
162 print_button(win, gettext(" Help "), y, x + 24, selected == 2); 162 print_button(win, gettext(" Help "), y, x + 24, selected == 2);
163 print_button(win, gettext(" Save "), y, x + 36, selected == 3);
164 print_button(win, gettext(" Load "), y, x + 48, selected == 4);
163 165
164 wmove(win, y, x + 1 + 12 * selected); 166 wmove(win, y, x + 1 + 12 * selected);
165 wrefresh(win); 167 wrefresh(win);
@@ -372,7 +374,7 @@ do_resize:
372 case TAB: 374 case TAB:
373 case KEY_RIGHT: 375 case KEY_RIGHT:
374 button = ((key == KEY_LEFT ? --button : ++button) < 0) 376 button = ((key == KEY_LEFT ? --button : ++button) < 0)
375 ? 2 : (button > 2 ? 0 : button); 377 ? 4 : (button > 4 ? 0 : button);
376 378
377 print_buttons(dialog, height, width, button); 379 print_buttons(dialog, height, width, button);
378 wrefresh(menu); 380 wrefresh(menu);
@@ -399,17 +401,17 @@ do_resize:
399 return 2; 401 return 2;
400 case 's': 402 case 's':
401 case 'y': 403 case 'y':
402 return 3; 404 return 5;
403 case 'n': 405 case 'n':
404 return 4; 406 return 6;
405 case 'm': 407 case 'm':
406 return 5; 408 return 7;
407 case ' ': 409 case ' ':
408 return 6; 410 return 8;
409 case '/': 411 case '/':
410 return 7; 412 return 9;
411 case 'z': 413 case 'z':
412 return 8; 414 return 10;
413 case '\n': 415 case '\n':
414 return button; 416 return button;
415 } 417 }
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 53975cf87608..566288a76370 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -280,6 +280,7 @@ static struct menu *current_menu;
280static int child_count; 280static int child_count;
281static int single_menu_mode; 281static int single_menu_mode;
282static int show_all_options; 282static int show_all_options;
283static int save_and_exit;
283 284
284static void conf(struct menu *menu, struct menu *active_menu); 285static void conf(struct menu *menu, struct menu *active_menu);
285static void conf_choice(struct menu *menu); 286static void conf_choice(struct menu *menu);
@@ -348,15 +349,19 @@ static void search_conf(void)
348{ 349{
349 struct symbol **sym_arr; 350 struct symbol **sym_arr;
350 struct gstr res; 351 struct gstr res;
352 struct gstr title;
351 char *dialog_input; 353 char *dialog_input;
352 int dres, vscroll = 0, hscroll = 0; 354 int dres, vscroll = 0, hscroll = 0;
353 bool again; 355 bool again;
354 356
357 title = str_new();
358 str_printf( &title, _("Enter %s (sub)string to search for "
359 "(with or without \"%s\")"), CONFIG_, CONFIG_);
360
355again: 361again:
356 dialog_clear(); 362 dialog_clear();
357 dres = dialog_inputbox(_("Search Configuration Parameter"), 363 dres = dialog_inputbox(_("Search Configuration Parameter"),
358 _("Enter " CONFIG_ " (sub)string to search for " 364 str_get(&title),
359 "(with or without \"" CONFIG_ "\")"),
360 10, 75, ""); 365 10, 75, "");
361 switch (dres) { 366 switch (dres) {
362 case 0: 367 case 0:
@@ -365,6 +370,7 @@ again:
365 show_helptext(_("Search Configuration"), search_help); 370 show_helptext(_("Search Configuration"), search_help);
366 goto again; 371 goto again;
367 default: 372 default:
373 str_free(&title);
368 return; 374 return;
369 } 375 }
370 376
@@ -398,6 +404,7 @@ again:
398 str_free(&res); 404 str_free(&res);
399 } while (again); 405 } while (again);
400 free(sym_arr); 406 free(sym_arr);
407 str_free(&title);
401} 408}
402 409
403static void build_conf(struct menu *menu) 410static void build_conf(struct menu *menu)
@@ -592,14 +599,6 @@ static void conf(struct menu *menu, struct menu *active_menu)
592 build_conf(menu); 599 build_conf(menu);
593 if (!child_count) 600 if (!child_count)
594 break; 601 break;
595 if (menu == &rootmenu) {
596 item_make("--- ");
597 item_set_tag(':');
598 item_make(_(" Load an Alternate Configuration File"));
599 item_set_tag('L');
600 item_make(_(" Save an Alternate Configuration File"));
601 item_set_tag('S');
602 }
603 dialog_clear(); 602 dialog_clear();
604 res = dialog_menu(prompt ? _(prompt) : _("Main Menu"), 603 res = dialog_menu(prompt ? _(prompt) : _("Main Menu"),
605 _(menu_instructions), 604 _(menu_instructions),
@@ -636,12 +635,6 @@ static void conf(struct menu *menu, struct menu *active_menu)
636 case 's': 635 case 's':
637 conf_string(submenu); 636 conf_string(submenu);
638 break; 637 break;
639 case 'L':
640 conf_load();
641 break;
642 case 'S':
643 conf_save();
644 break;
645 } 638 }
646 break; 639 break;
647 case 2: 640 case 2:
@@ -651,6 +644,12 @@ static void conf(struct menu *menu, struct menu *active_menu)
651 show_helptext(_("README"), _(mconf_readme)); 644 show_helptext(_("README"), _(mconf_readme));
652 break; 645 break;
653 case 3: 646 case 3:
647 conf_save();
648 break;
649 case 4:
650 conf_load();
651 break;
652 case 5:
654 if (item_is_tag('t')) { 653 if (item_is_tag('t')) {
655 if (sym_set_tristate_value(sym, yes)) 654 if (sym_set_tristate_value(sym, yes))
656 break; 655 break;
@@ -658,24 +657,24 @@ static void conf(struct menu *menu, struct menu *active_menu)
658 show_textbox(NULL, setmod_text, 6, 74); 657 show_textbox(NULL, setmod_text, 6, 74);
659 } 658 }
660 break; 659 break;
661 case 4: 660 case 6:
662 if (item_is_tag('t')) 661 if (item_is_tag('t'))
663 sym_set_tristate_value(sym, no); 662 sym_set_tristate_value(sym, no);
664 break; 663 break;
665 case 5: 664 case 7:
666 if (item_is_tag('t')) 665 if (item_is_tag('t'))
667 sym_set_tristate_value(sym, mod); 666 sym_set_tristate_value(sym, mod);
668 break; 667 break;
669 case 6: 668 case 8:
670 if (item_is_tag('t')) 669 if (item_is_tag('t'))
671 sym_toggle_tristate_value(sym); 670 sym_toggle_tristate_value(sym);
672 else if (item_is_tag('m')) 671 else if (item_is_tag('m'))
673 conf(submenu, NULL); 672 conf(submenu, NULL);
674 break; 673 break;
675 case 7: 674 case 9:
676 search_conf(); 675 search_conf();
677 break; 676 break;
678 case 8: 677 case 10:
679 show_all_options = !show_all_options; 678 show_all_options = !show_all_options;
680 break; 679 break;
681 } 680 }
@@ -702,6 +701,17 @@ static void show_helptext(const char *title, const char *text)
702 show_textbox(title, text, 0, 0); 701 show_textbox(title, text, 0, 0);
703} 702}
704 703
704static void conf_message_callback(const char *fmt, va_list ap)
705{
706 char buf[PATH_MAX+1];
707
708 vsnprintf(buf, sizeof(buf), fmt, ap);
709 if (save_and_exit)
710 printf("%s", buf);
711 else
712 show_textbox(NULL, buf, 6, 60);
713}
714
705static void show_help(struct menu *menu) 715static void show_help(struct menu *menu)
706{ 716{
707 struct gstr help = str_new(); 717 struct gstr help = str_new();
@@ -870,6 +880,7 @@ static int handle_exit(void)
870{ 880{
871 int res; 881 int res;
872 882
883 save_and_exit = 1;
873 dialog_clear(); 884 dialog_clear();
874 if (conf_get_changed()) 885 if (conf_get_changed())
875 res = dialog_yesno(NULL, 886 res = dialog_yesno(NULL,
@@ -941,6 +952,7 @@ int main(int ac, char **av)
941 } 952 }
942 953
943 set_config_filename(conf_get_configname()); 954 set_config_filename(conf_get_configname());
955 conf_set_message_callback(conf_message_callback);
944 do { 956 do {
945 conf(&rootmenu, NULL); 957 conf(&rootmenu, NULL);
946 res = handle_exit(); 958 res = handle_exit();
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index e98a05c8e508..f3bffa309333 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -48,7 +48,7 @@ void menu_add_entry(struct symbol *sym)
48{ 48{
49 struct menu *menu; 49 struct menu *menu;
50 50
51 menu = malloc(sizeof(*menu)); 51 menu = xmalloc(sizeof(*menu));
52 memset(menu, 0, sizeof(*menu)); 52 memset(menu, 0, sizeof(*menu));
53 menu->sym = sym; 53 menu->sym = sym;
54 menu->parent = current_menu; 54 menu->parent = current_menu;
@@ -531,7 +531,7 @@ static void get_prompt_str(struct gstr *r, struct property *prop,
531 location = menu; 531 location = menu;
532 } 532 }
533 if (head && location) { 533 if (head && location) {
534 jump = malloc(sizeof(struct jump_key)); 534 jump = xmalloc(sizeof(struct jump_key));
535 535
536 if (menu_is_visible(prop->menu)) { 536 if (menu_is_visible(prop->menu)) {
537 /* 537 /*
diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh
index 974d5cb7e30a..05274fccb88e 100755
--- a/scripts/kconfig/merge_config.sh
+++ b/scripts/kconfig/merge_config.sh
@@ -32,11 +32,13 @@ usage() {
32 echo " -m only merge the fragments, do not execute the make command" 32 echo " -m only merge the fragments, do not execute the make command"
33 echo " -n use allnoconfig instead of alldefconfig" 33 echo " -n use allnoconfig instead of alldefconfig"
34 echo " -r list redundant entries when merging fragments" 34 echo " -r list redundant entries when merging fragments"
35 echo " -O dir to put generated output files"
35} 36}
36 37
37MAKE=true 38MAKE=true
38ALLTARGET=alldefconfig 39ALLTARGET=alldefconfig
39WARNREDUN=false 40WARNREDUN=false
41OUTPUT=.
40 42
41while true; do 43while true; do
42 case $1 in 44 case $1 in
@@ -59,6 +61,16 @@ while true; do
59 shift 61 shift
60 continue 62 continue
61 ;; 63 ;;
64 "-O")
65 if [ -d $2 ];then
66 OUTPUT=$(echo $2 | sed 's/\/*$//')
67 else
68 echo "output directory $2 does not exist" 1>&2
69 exit 1
70 fi
71 shift 2
72 continue
73 ;;
62 *) 74 *)
63 break 75 break
64 ;; 76 ;;
@@ -100,9 +112,9 @@ for MERGE_FILE in $MERGE_LIST ; do
100done 112done
101 113
102if [ "$MAKE" = "false" ]; then 114if [ "$MAKE" = "false" ]; then
103 cp $TMP_FILE .config 115 cp $TMP_FILE $OUTPUT/.config
104 echo "#" 116 echo "#"
105 echo "# merged configuration written to .config (needs make)" 117 echo "# merged configuration written to $OUTPUT/.config (needs make)"
106 echo "#" 118 echo "#"
107 clean_up 119 clean_up
108 exit 120 exit
@@ -111,14 +123,14 @@ fi
111# Use the merged file as the starting point for: 123# Use the merged file as the starting point for:
112# alldefconfig: Fills in any missing symbols with Kconfig default 124# alldefconfig: Fills in any missing symbols with Kconfig default
113# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set 125# allnoconfig: Fills in any missing symbols with # CONFIG_* is not set
114make KCONFIG_ALLCONFIG=$TMP_FILE $ALLTARGET 126make KCONFIG_ALLCONFIG=$TMP_FILE O=$OUTPUT $ALLTARGET
115 127
116 128
117# Check all specified config values took (might have missed-dependency issues) 129# Check all specified config values took (might have missed-dependency issues)
118for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do 130for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do
119 131
120 REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) 132 REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE)
121 ACTUAL_VAL=$(grep -w -e "$CFG" .config) 133 ACTUAL_VAL=$(grep -w -e "$CFG" $OUTPUT/.config)
122 if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then 134 if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then
123 echo "Value requested for $CFG not in final .config" 135 echo "Value requested for $CFG not in final .config"
124 echo "Requested value: $REQUESTED_VAL" 136 echo "Requested value: $REQUESTED_VAL"
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 87d4b15da951..dbf31edd22b2 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -7,215 +7,208 @@
7 */ 7 */
8#define _GNU_SOURCE 8#define _GNU_SOURCE
9#include <string.h> 9#include <string.h>
10#include <stdlib.h>
10 11
11#include "lkc.h" 12#include "lkc.h"
12#include "nconf.h" 13#include "nconf.h"
13#include <ctype.h> 14#include <ctype.h>
14 15
15static const char nconf_readme[] = N_( 16static const char nconf_global_help[] = N_(
16"Overview\n" 17"Help windows\n"
17"--------\n" 18"------------\n"
18"This interface let you select features and parameters for the build.\n" 19"o Global help: Unless in a data entry window, pressing <F1> will give \n"
19"Features can either be built-in, modularized, or ignored. Parameters\n" 20" you the global help window, which you are just reading.\n"
20"must be entered in as decimal or hexadecimal numbers or text.\n"
21"\n" 21"\n"
22"Menu items beginning with following braces represent features that\n" 22"o A short version of the global help is available by pressing <F3>.\n"
23" [ ] can be built in or removed\n"
24" < > can be built in, modularized or removed\n"
25" { } can be built in or modularized (selected by other feature)\n"
26" - - are selected by other feature,\n"
27" XXX cannot be selected. Use Symbol Info to find out why,\n"
28"while *, M or whitespace inside braces means to build in, build as\n"
29"a module or to exclude the feature respectively.\n"
30"\n" 23"\n"
31"To change any of these features, highlight it with the cursor\n" 24"o Local help: To get help related to the current menu entry, use any\n"
32"keys and press <Y> to build it in, <M> to make it a module or\n" 25" of <?> <h>, or if in a data entry window then press <F1>.\n"
33"<N> to removed it. You may also press the <Space Bar> to cycle\n"
34"through the available options (ie. Y->N->M->Y).\n"
35"\n" 26"\n"
36"Some additional keyboard hints:\n"
37"\n" 27"\n"
38"Menus\n" 28"Menu entries\n"
39"----------\n" 29"------------\n"
40"o Use the Up/Down arrow keys (cursor keys) to highlight the item\n" 30"This interface lets you select features and parameters for the kernel\n"
41" you wish to change use <Enter> or <Space>. Goto submenu by \n" 31"build. Kernel features can either be built-in, modularized, or removed.\n"
42" pressing <Enter> of <right-arrow>. Use <Esc> or <left-arrow> to go back.\n" 32"Parameters must be entered as text or decimal or hexadecimal numbers.\n"
43" Submenus are designated by \"--->\".\n"
44"\n"
45" Searching: pressing '/' triggers interactive search mode.\n"
46" nconfig performs a case insensitive search for the string\n"
47" in the menu prompts (no regex support).\n"
48" Pressing the up/down keys highlights the previous/next\n"
49" matching item. Backspace removes one character from the\n"
50" match string. Pressing either '/' again or ESC exits\n"
51" search mode. All other keys behave normally.\n"
52"\n" 33"\n"
53" You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n" 34"Menu entries beginning with following braces represent features that\n"
54" unseen options into view.\n" 35" [ ] can be built in or removed\n"
36" < > can be built in, modularized or removed\n"
37" { } can be built in or modularized, are selected by another feature\n"
38" - - are selected by another feature\n"
39" XXX cannot be selected. Symbol Info <F2> tells you why.\n"
40"*, M or whitespace inside braces means to build in, build as a module\n"
41"or to exclude the feature respectively.\n"
55"\n" 42"\n"
56"o To exit a menu use the just press <ESC> <F5> <F8> or <left-arrow>.\n" 43"To change any of these features, highlight it with the movement keys\n"
44"listed below and press <y> to build it in, <m> to make it a module or\n"
45"<n> to remove it. You may press the <Space> key to cycle through the\n"
46"available options.\n"
57"\n" 47"\n"
58"o To get help with an item, press <F1>\n" 48"A trailing \"--->\" designates a submenu.\n"
59" Shortcut: Press <h> or <?>.\n"
60"\n" 49"\n"
61"\n" 50"\n"
62"Radiolists (Choice lists)\n" 51"Menu navigation keys\n"
63"-----------\n" 52"----------------------------------------------------------------------\n"
64"o Use the cursor keys to select the option you wish to set and press\n" 53"Linewise up <Up>\n"
65" <S> or the <SPACE BAR>.\n" 54"Linewise down <Down>\n"
55"Pagewise up <Page Up>\n"
56"Pagewise down <Page Down>\n"
57"First entry <Home>\n"
58"Last entry <End>\n"
59"Enter a submenu <Right> <Enter>\n"
60"Go back to parent menu <Left> <Esc> <F5>\n"
61"Close a help window <Enter> <Esc> <F5>\n"
62"Close entry window, apply <Enter>\n"
63"Close entry window, forget <Esc> <F5>\n"
64"Start incremental, case-insensitive search for STRING in menu entries,\n"
65" no regex support, STRING is displayed in upper left corner\n"
66" </>STRING\n"
67" Remove last character <Backspace>\n"
68" Jump to next hit <Down>\n"
69" Jump to previous hit <Up>\n"
70"Exit menu search mode </> <Esc>\n"
71"Search for configuration variables with or without leading CONFIG_\n"
72" <F8>RegExpr<Enter>\n"
73"Verbose search help <F8><F1>\n"
74"----------------------------------------------------------------------\n"
66"\n" 75"\n"
67" Shortcut: Press the first letter of the option you wish to set then\n" 76"Unless in a data entry window, key <1> may be used instead of <F1>,\n"
68" press <S> or <SPACE BAR>.\n" 77"<2> instead of <F2>, etc.\n"
69"\n" 78"\n"
70"o To see available help for the item, press <F1>\n"
71" Shortcut: Press <H> or <?>.\n"
72"\n" 79"\n"
80"Radiolist (Choice list)\n"
81"-----------------------\n"
82"Use the movement keys listed above to select the option you wish to set\n"
83"and press <Space>.\n"
73"\n" 84"\n"
74"Data Entry\n"
75"-----------\n"
76"o Enter the requested information and press <ENTER>\n"
77" If you are entering hexadecimal values, it is not necessary to\n"
78" add the '0x' prefix to the entry.\n"
79"\n" 85"\n"
80"o For help, press <F1>.\n" 86"Data entry\n"
87"----------\n"
88"Enter the requested information and press <Enter>. Hexadecimal values\n"
89"may be entered without the \"0x\" prefix.\n"
81"\n" 90"\n"
82"\n" 91"\n"
83"Text Box (Help Window)\n" 92"Text Box (Help Window)\n"
84"--------\n" 93"----------------------\n"
85"o Use the cursor keys to scroll up/down/left/right. The VI editor\n" 94"Use movement keys as listed in table above.\n"
86" keys h,j,k,l function here as do <u>, <d> and <SPACE BAR> for\n"
87" those who are familiar with less and lynx.\n"
88"\n" 95"\n"
89"o Press <Enter>, <F1>, <F5>, <F9>, <q> or <Esc> to exit.\n" 96"Press any of <Enter> <Esc> <q> <F5> <F9> to exit.\n"
90"\n" 97"\n"
91"\n" 98"\n"
92"Alternate Configuration Files\n" 99"Alternate configuration files\n"
93"-----------------------------\n" 100"-----------------------------\n"
94"nconfig supports the use of alternate configuration files for\n" 101"nconfig supports switching between different configurations.\n"
95"those who, for various reasons, find it necessary to switch\n" 102"Press <F6> to save your current configuration. Press <F7> and enter\n"
96"between different configurations.\n" 103"a file name to load a previously saved configuration.\n"
97"\n" 104"\n"
98"At the end of the main menu you will find two options. One is\n"
99"for saving the current configuration to a file of your choosing.\n"
100"The other option is for loading a previously saved alternate\n"
101"configuration.\n"
102"\n" 105"\n"
103"Even if you don't use alternate configuration files, but you\n" 106"Terminal configuration\n"
104"find during a nconfig session that you have completely messed\n" 107"----------------------\n"
105"up your settings, you may use the \"Load Alternate...\" option to\n" 108"If you use nconfig in a xterm window, make sure your TERM environment\n"
106"restore your previously saved settings from \".config\" without\n" 109"variable specifies a terminal configuration which supports at least\n"
107"restarting nconfig.\n" 110"16 colors. Otherwise nconfig will look rather bad.\n"
108"\n" 111"\n"
109"Other information\n" 112"If the \"stty size\" command reports the current terminalsize correctly,\n"
110"-----------------\n" 113"nconfig will adapt to sizes larger than the traditional 80x25 \"standard\"\n"
111"If you use nconfig in an XTERM window make sure you have your\n" 114"and display longer menus properly.\n"
112"$TERM variable set to point to a xterm definition which supports color.\n"
113"Otherwise, nconfig will look rather bad. nconfig will not\n"
114"display correctly in a RXVT window because rxvt displays only one\n"
115"intensity of color, bright.\n"
116"\n" 115"\n"
117"nconfig will display larger menus on screens or xterms which are\n"
118"set to display more than the standard 25 row by 80 column geometry.\n"
119"In order for this to work, the \"stty size\" command must be able to\n"
120"display the screen's current row and column geometry. I STRONGLY\n"
121"RECOMMEND that you make sure you do NOT have the shell variables\n"
122"LINES and COLUMNS exported into your environment. Some distributions\n"
123"export those variables via /etc/profile. Some ncurses programs can\n"
124"become confused when those variables (LINES & COLUMNS) don't reflect\n"
125"the true screen size.\n"
126"\n" 116"\n"
127"Optional personality available\n" 117"Single menu mode\n"
128"------------------------------\n" 118"----------------\n"
129"If you prefer to have all of the options listed in a single menu, rather\n" 119"If you prefer to have all of the menu entries listed in a single menu,\n"
130"than the default multimenu hierarchy, run the nconfig with NCONFIG_MODE\n" 120"rather than the default multimenu hierarchy, run nconfig with\n"
131"environment variable set to single_menu. Example:\n" 121"NCONFIG_MODE environment variable set to single_menu. Example:\n"
132"\n" 122"\n"
133"make NCONFIG_MODE=single_menu nconfig\n" 123"make NCONFIG_MODE=single_menu nconfig\n"
134"\n" 124"\n"
135"<Enter> will then unroll the appropriate category, or enfold it if it\n" 125"<Enter> will then unfold the appropriate category, or fold it if it\n"
136"is already unrolled.\n" 126"is already unfolded. Folded menu entries will be designated by a\n"
127"leading \"++>\" and unfolded entries by a leading \"-->\".\n"
137"\n" 128"\n"
138"Note that this mode can eventually be a little more CPU expensive\n" 129"Note that this mode can eventually be a little more CPU expensive than\n"
139"(especially with a larger number of unrolled categories) than the\n" 130"the default mode, especially with a larger number of unfolded submenus.\n"
140"default mode.\n"
141"\n"), 131"\n"),
142menu_no_f_instructions[] = N_( 132menu_no_f_instructions[] = N_(
143" You do not have function keys support. Please follow the\n" 133"Legend: [*] built-in [ ] excluded <M> module < > module capable.\n"
144" following instructions:\n" 134"Submenus are designated by a trailing \"--->\".\n"
145" Arrow keys navigate the menu.\n" 135"\n"
146" <Enter> or <right-arrow> selects submenus --->.\n" 136"Use the following keys to navigate the menus:\n"
147" Capital Letters are hotkeys.\n" 137"Move up or down with <Up> and <Down>.\n"
148" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n" 138"Enter a submenu with <Enter> or <Right>.\n"
149" Pressing SpaceBar toggles between the above options.\n" 139"Exit a submenu to its parent menu with <Esc> or <Left>.\n"
150" Press <Esc> or <left-arrow> to go back one menu,\n" 140"Pressing <y> includes, <n> excludes, <m> modularizes features.\n"
151" <?> or <h> for Help, </> for Search.\n" 141"Pressing <Space> cycles through the available options.\n"
152" <1> is interchangeable with <F1>, <2> with <F2>, etc.\n" 142"To search for menu entries press </>.\n"
153" Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" 143"<Esc> always leaves the current window.\n"
154" <Esc> always leaves the current window.\n"), 144"\n"
145"You do not have function keys support.\n"
146"Press <1> instead of <F1>, <2> instead of <F2>, etc.\n"
147"For verbose global help use key <1>.\n"
148"For help related to the current menu entry press <?> or <h>.\n"),
155menu_instructions[] = N_( 149menu_instructions[] = N_(
156" Arrow keys navigate the menu.\n" 150"Legend: [*] built-in [ ] excluded <M> module < > module capable.\n"
157" <Enter> or <right-arrow> selects submenus --->.\n" 151"Submenus are designated by a trailing \"--->\".\n"
158" Capital Letters are hotkeys.\n" 152"\n"
159" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n" 153"Use the following keys to navigate the menus:\n"
160" Pressing SpaceBar toggles between the above options\n" 154"Move up or down with <Up> or <Down>.\n"
161" Press <Esc>, <F5> or <left-arrow> to go back one menu,\n" 155"Enter a submenu with <Enter> or <Right>.\n"
162" <?>, <F1> or <h> for Help, </> for Search.\n" 156"Exit a submenu to its parent menu with <Esc> or <Left>.\n"
163" <1> is interchangeable with <F1>, <2> with <F2>, etc.\n" 157"Pressing <y> includes, <n> excludes, <m> modularizes features.\n"
164" Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" 158"Pressing <Space> cycles through the available options.\n"
165" <Esc> always leaves the current window\n"), 159"To search for menu entries press </>.\n"
160"<Esc> always leaves the current window.\n"
161"\n"
162"Pressing <1> may be used instead of <F1>, <2> instead of <F2>, etc.\n"
163"For verbose global help press <F1>.\n"
164"For help related to the current menu entry press <?> or <h>.\n"),
166radiolist_instructions[] = N_( 165radiolist_instructions[] = N_(
167" Use the arrow keys to navigate this window or\n" 166"Press <Up>, <Down>, <Home> or <End> to navigate a radiolist, select\n"
168" press the hotkey of the item you wish to select\n" 167"with <Space>.\n"
169" followed by the <SPACE BAR>.\n" 168"For help related to the current entry press <?> or <h>.\n"
170" Press <?>, <F1> or <h> for additional information about this option.\n"), 169"For global help press <F1>.\n"),
171inputbox_instructions_int[] = N_( 170inputbox_instructions_int[] = N_(
172"Please enter a decimal value.\n" 171"Please enter a decimal value.\n"
173"Fractions will not be accepted.\n" 172"Fractions will not be accepted.\n"
174"Press <RETURN> to accept, <ESC> to cancel."), 173"Press <Enter> to apply, <Esc> to cancel."),
175inputbox_instructions_hex[] = N_( 174inputbox_instructions_hex[] = N_(
176"Please enter a hexadecimal value.\n" 175"Please enter a hexadecimal value.\n"
177"Press <RETURN> to accept, <ESC> to cancel."), 176"Press <Enter> to apply, <Esc> to cancel."),
178inputbox_instructions_string[] = N_( 177inputbox_instructions_string[] = N_(
179"Please enter a string value.\n" 178"Please enter a string value.\n"
180"Press <RETURN> to accept, <ESC> to cancel."), 179"Press <Enter> to apply, <Esc> to cancel."),
181setmod_text[] = N_( 180setmod_text[] = N_(
182"This feature depends on another which\n" 181"This feature depends on another feature which has been configured as a\n"
183"has been configured as a module.\n" 182"module. As a result, the current feature will be built as a module too."),
184"As a result, this feature will be built as a module."),
185load_config_text[] = N_( 183load_config_text[] = N_(
186"Enter the name of the configuration file you wish to load.\n" 184"Enter the name of the configuration file you wish to load.\n"
187"Accept the name shown to restore the configuration you\n" 185"Accept the name shown to restore the configuration you last\n"
188"last retrieved. Leave blank to abort."), 186"retrieved. Leave empty to abort."),
189load_config_help[] = N_( 187load_config_help[] = N_(
190"\n"
191"For various reasons, one may wish to keep several different\n" 188"For various reasons, one may wish to keep several different\n"
192"configurations available on a single machine.\n" 189"configurations available on a single machine.\n"
193"\n" 190"\n"
194"If you have saved a previous configuration in a file other than the\n" 191"If you have saved a previous configuration in a file other than the\n"
195"default one, entering its name here will allow you to modify that\n" 192"default one, entering its name here will allow you to load and modify\n"
196"configuration.\n" 193"that configuration.\n"
197"\n" 194"\n"
198"If you are uncertain, then you have probably never used alternate\n" 195"Leave empty to abort.\n"),
199"configuration files. You should therefor leave this blank to abort.\n"),
200save_config_text[] = N_( 196save_config_text[] = N_(
201"Enter a filename to which this configuration should be saved\n" 197"Enter a filename to which this configuration should be saved\n"
202"as an alternate. Leave blank to abort."), 198"as an alternate. Leave empty to abort."),
203save_config_help[] = N_( 199save_config_help[] = N_(
204"\n" 200"For various reasons, one may wish to keep several different\n"
205"For various reasons, one may wish to keep different configurations\n" 201"configurations available on a single machine.\n"
206"available on a single machine.\n"
207"\n" 202"\n"
208"Entering a file name here will allow you to later retrieve, modify\n" 203"Entering a file name here will allow you to later retrieve, modify\n"
209"and use the current configuration as an alternate to whatever\n" 204"and use the current configuration as an alternate to whatever\n"
210"configuration options you have selected at that time.\n" 205"configuration options you have selected at that time.\n"
211"\n" 206"\n"
212"If you are uncertain what all this means then you should probably\n" 207"Leave empty to abort.\n"),
213"leave this blank.\n"),
214search_help[] = N_( 208search_help[] = N_(
215"\n" 209"Search for symbols (configuration variable names CONFIG_*) and display\n"
216"Search for symbols and display their relations. Regular expressions\n" 210"their relations. Regular expressions are supported.\n"
217"are allowed.\n" 211"Example: Search for \"^FOO\".\n"
218"Example: search for \"^FOO\"\n"
219"Result:\n" 212"Result:\n"
220"-----------------------------------------------------------------\n" 213"-----------------------------------------------------------------\n"
221"Symbol: FOO [ = m]\n" 214"Symbol: FOO [ = m]\n"
@@ -229,26 +222,26 @@ search_help[] = N_(
229"Selects: LIBCRC32\n" 222"Selects: LIBCRC32\n"
230"Selected by: BAR\n" 223"Selected by: BAR\n"
231"-----------------------------------------------------------------\n" 224"-----------------------------------------------------------------\n"
232"o The line 'Prompt:' shows the text used in the menu structure for\n" 225"o The line 'Prompt:' shows the text displayed for this symbol in\n"
233" this symbol\n" 226" the menu hierarchy.\n"
234"o The 'Defined at' line tell at what file / line number the symbol\n" 227"o The 'Defined at' line tells at what file / line number the symbol is\n"
235" is defined\n" 228" defined.\n"
236"o The 'Depends on:' line tell what symbols needs to be defined for\n" 229"o The 'Depends on:' line lists symbols that need to be defined for\n"
237" this symbol to be visible in the menu (selectable)\n" 230" this symbol to be visible and selectable in the menu.\n"
238"o The 'Location:' lines tell where in the menu structure this symbol\n" 231"o The 'Location:' lines tell, where in the menu structure this symbol\n"
239" is located\n" 232" is located. A location followed by a [ = y] indicates that this is\n"
240" A location followed by a [ = y] indicate that this is a selectable\n" 233" a selectable menu item, and the current value is displayed inside\n"
241" menu item - and current value is displayed inside brackets.\n" 234" brackets.\n"
242"o The 'Selects:' line tell what symbol will be automatically\n" 235"o The 'Selects:' line tells, what symbol will be automatically selected\n"
243" selected if this symbol is selected (y or m)\n" 236" if this symbol is selected (y or m).\n"
244"o The 'Selected by' line tell what symbol has selected this symbol\n" 237"o The 'Selected by' line tells what symbol has selected this symbol.\n"
245"\n" 238"\n"
246"Only relevant lines are shown.\n" 239"Only relevant lines are shown.\n"
247"\n\n" 240"\n\n"
248"Search examples:\n" 241"Search examples:\n"
249"Examples: USB => find all symbols containing USB\n" 242"USB => find all symbols containing USB\n"
250" ^USB => find all symbols starting with USB\n" 243"^USB => find all symbols starting with USB\n"
251" USB$ => find all symbols ending with USB\n" 244"USB$ => find all symbols ending with USB\n"
252"\n"); 245"\n");
253 246
254struct mitem { 247struct mitem {
@@ -319,19 +312,19 @@ struct function_keys function_keys[] = {
319 }, 312 },
320 { 313 {
321 .key_str = "F2", 314 .key_str = "F2",
322 .func = "Sym Info", 315 .func = "SymInfo",
323 .key = F_SYMBOL, 316 .key = F_SYMBOL,
324 .handler = handle_f2, 317 .handler = handle_f2,
325 }, 318 },
326 { 319 {
327 .key_str = "F3", 320 .key_str = "F3",
328 .func = "Insts", 321 .func = "Help 2",
329 .key = F_INSTS, 322 .key = F_INSTS,
330 .handler = handle_f3, 323 .handler = handle_f3,
331 }, 324 },
332 { 325 {
333 .key_str = "F4", 326 .key_str = "F4",
334 .func = "Config", 327 .func = "ShowAll",
335 .key = F_CONF, 328 .key = F_CONF,
336 .handler = handle_f4, 329 .handler = handle_f4,
337 }, 330 },
@@ -355,7 +348,7 @@ struct function_keys function_keys[] = {
355 }, 348 },
356 { 349 {
357 .key_str = "F8", 350 .key_str = "F8",
358 .func = "Sym Search", 351 .func = "SymSearch",
359 .key = F_SEARCH, 352 .key = F_SEARCH,
360 .handler = handle_f8, 353 .handler = handle_f8,
361 }, 354 },
@@ -392,7 +385,7 @@ static void print_function_line(void)
392static void handle_f1(int *key, struct menu *current_item) 385static void handle_f1(int *key, struct menu *current_item)
393{ 386{
394 show_scroll_win(main_window, 387 show_scroll_win(main_window,
395 _("README"), _(nconf_readme)); 388 _("Global help"), _(nconf_global_help));
396 return; 389 return;
397} 390}
398 391
@@ -407,7 +400,7 @@ static void handle_f2(int *key, struct menu *current_item)
407static void handle_f3(int *key, struct menu *current_item) 400static void handle_f3(int *key, struct menu *current_item)
408{ 401{
409 show_scroll_win(main_window, 402 show_scroll_win(main_window,
410 _("Instructions"), 403 _("Short help"),
411 _(current_instructions)); 404 _(current_instructions));
412 return; 405 return;
413} 406}
@@ -696,13 +689,18 @@ static void search_conf(void)
696{ 689{
697 struct symbol **sym_arr; 690 struct symbol **sym_arr;
698 struct gstr res; 691 struct gstr res;
692 struct gstr title;
699 char *dialog_input; 693 char *dialog_input;
700 int dres; 694 int dres;
695
696 title = str_new();
697 str_printf( &title, _("Enter %s (sub)string to search for "
698 "(with or without \"%s\")"), CONFIG_, CONFIG_);
699
701again: 700again:
702 dres = dialog_inputbox(main_window, 701 dres = dialog_inputbox(main_window,
703 _("Search Configuration Parameter"), 702 _("Search Configuration Parameter"),
704 _("Enter " CONFIG_ " (sub)string to search for " 703 str_get(&title),
705 "(with or without \"" CONFIG_ "\")"),
706 "", &dialog_input_result, &dialog_input_result_len); 704 "", &dialog_input_result, &dialog_input_result_len);
707 switch (dres) { 705 switch (dres) {
708 case 0: 706 case 0:
@@ -712,6 +710,7 @@ again:
712 _("Search Configuration"), search_help); 710 _("Search Configuration"), search_help);
713 goto again; 711 goto again;
714 default: 712 default:
713 str_free(&title);
715 return; 714 return;
716 } 715 }
717 716
@@ -726,6 +725,7 @@ again:
726 show_scroll_win(main_window, 725 show_scroll_win(main_window,
727 _("Search Results"), str_get(&res)); 726 _("Search Results"), str_get(&res));
728 str_free(&res); 727 str_free(&res);
728 str_free(&title);
729} 729}
730 730
731 731
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
index 379003c7a2b4..9f8c44ecc703 100644
--- a/scripts/kconfig/nconf.gui.c
+++ b/scripts/kconfig/nconf.gui.c
@@ -48,7 +48,7 @@ static void set_normal_colors(void)
48 init_pair(INPUT_FIELD, -1, -1); 48 init_pair(INPUT_FIELD, -1, -1);
49 49
50 init_pair(FUNCTION_HIGHLIGHT, -1, -1); 50 init_pair(FUNCTION_HIGHLIGHT, -1, -1);
51 init_pair(FUNCTION_TEXT, COLOR_BLUE, -1); 51 init_pair(FUNCTION_TEXT, COLOR_YELLOW, -1);
52} 52}
53 53
54/* available attributes: 54/* available attributes:
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index df274febb3e5..1500c38f0cca 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -6,6 +6,7 @@
6#include <qglobal.h> 6#include <qglobal.h>
7 7
8#if QT_VERSION < 0x040000 8#if QT_VERSION < 0x040000
9#include <stddef.h>
9#include <qmainwindow.h> 10#include <qmainwindow.h>
10#include <qvbox.h> 11#include <qvbox.h>
11#include <qvaluelist.h> 12#include <qvaluelist.h>
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 22a3c400fc41..ecc5aa5f865d 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -656,11 +656,11 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
656 size = strlen(newval) + 1; 656 size = strlen(newval) + 1;
657 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { 657 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) {
658 size += 2; 658 size += 2;
659 sym->def[S_DEF_USER].val = val = malloc(size); 659 sym->def[S_DEF_USER].val = val = xmalloc(size);
660 *val++ = '0'; 660 *val++ = '0';
661 *val++ = 'x'; 661 *val++ = 'x';
662 } else if (!oldval || strcmp(oldval, newval)) 662 } else if (!oldval || strcmp(oldval, newval))
663 sym->def[S_DEF_USER].val = val = malloc(size); 663 sym->def[S_DEF_USER].val = val = xmalloc(size);
664 else 664 else
665 return true; 665 return true;
666 666
@@ -812,7 +812,7 @@ struct symbol *sym_lookup(const char *name, int flags)
812 hash = 0; 812 hash = 0;
813 } 813 }
814 814
815 symbol = malloc(sizeof(*symbol)); 815 symbol = xmalloc(sizeof(*symbol));
816 memset(symbol, 0, sizeof(*symbol)); 816 memset(symbol, 0, sizeof(*symbol));
817 symbol->name = new_name; 817 symbol->name = new_name;
818 symbol->type = S_UNKNOWN; 818 symbol->type = S_UNKNOWN;
@@ -863,7 +863,7 @@ const char *sym_expand_string_value(const char *in)
863 size_t reslen; 863 size_t reslen;
864 864
865 reslen = strlen(in) + 1; 865 reslen = strlen(in) + 1;
866 res = malloc(reslen); 866 res = xmalloc(reslen);
867 res[0] = '\0'; 867 res[0] = '\0';
868 868
869 while ((src = strchr(in, '$'))) { 869 while ((src = strchr(in, '$'))) {
@@ -921,7 +921,7 @@ const char *sym_escape_string_value(const char *in)
921 p++; 921 p++;
922 } 922 }
923 923
924 res = malloc(reslen); 924 res = xmalloc(reslen);
925 res[0] = '\0'; 925 res[0] = '\0';
926 926
927 strcat(res, "\""); 927 strcat(res, "\"");
@@ -1228,7 +1228,7 @@ struct property *prop_alloc(enum prop_type type, struct symbol *sym)
1228 struct property *prop; 1228 struct property *prop;
1229 struct property **propp; 1229 struct property **propp;
1230 1230
1231 prop = malloc(sizeof(*prop)); 1231 prop = xmalloc(sizeof(*prop));
1232 memset(prop, 0, sizeof(*prop)); 1232 memset(prop, 0, sizeof(*prop));
1233 prop->type = type; 1233 prop->type = type;
1234 prop->sym = sym; 1234 prop->sym = sym;
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index d0b8b2318e48..6e7fbf196809 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -23,7 +23,7 @@ struct file *file_lookup(const char *name)
23 } 23 }
24 } 24 }
25 25
26 file = malloc(sizeof(*file)); 26 file = xmalloc(sizeof(*file));
27 memset(file, 0, sizeof(*file)); 27 memset(file, 0, sizeof(*file));
28 file->name = file_name; 28 file->name = file_name;
29 file->next = file_list; 29 file->next = file_list;
@@ -81,7 +81,7 @@ int file_write_dep(const char *name)
81struct gstr str_new(void) 81struct gstr str_new(void)
82{ 82{
83 struct gstr gs; 83 struct gstr gs;
84 gs.s = malloc(sizeof(char) * 64); 84 gs.s = xmalloc(sizeof(char) * 64);
85 gs.len = 64; 85 gs.len = 64;
86 gs.max_width = 0; 86 gs.max_width = 0;
87 strcpy(gs.s, "\0"); 87 strcpy(gs.s, "\0");
@@ -138,3 +138,22 @@ const char *str_get(struct gstr *gs)
138 return gs->s; 138 return gs->s;
139} 139}
140 140
141void *xmalloc(size_t size)
142{
143 void *p = malloc(size);
144 if (p)
145 return p;
146 fprintf(stderr, "Out of memory.\n");
147 exit(1);
148}
149
150void *xcalloc(size_t nmemb, size_t size)
151{
152 void *p = calloc(nmemb, size);
153 if (p)
154 return p;
155 fprintf(stderr, "Out of memory.\n");
156 exit(1);
157}
158
159
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 00f9d3a9cf8b..6555a475453b 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -40,7 +40,7 @@ static void zconf_endfile(void);
40 40
41static void new_string(void) 41static void new_string(void)
42{ 42{
43 text = malloc(START_STRSIZE); 43 text = xmalloc(START_STRSIZE);
44 text_asize = START_STRSIZE; 44 text_asize = START_STRSIZE;
45 text_size = 0; 45 text_size = 0;
46 *text = 0; 46 *text = 0;
@@ -62,7 +62,7 @@ static void append_string(const char *str, int size)
62 62
63static void alloc_string(const char *str, int size) 63static void alloc_string(const char *str, int size)
64{ 64{
65 text = malloc(size + 1); 65 text = xmalloc(size + 1);
66 memcpy(text, str, size); 66 memcpy(text, str, size);
67 text[size] = 0; 67 text[size] = 0;
68} 68}
@@ -288,7 +288,7 @@ void zconf_initscan(const char *name)
288 exit(1); 288 exit(1);
289 } 289 }
290 290
291 current_buf = malloc(sizeof(*current_buf)); 291 current_buf = xmalloc(sizeof(*current_buf));
292 memset(current_buf, 0, sizeof(*current_buf)); 292 memset(current_buf, 0, sizeof(*current_buf));
293 293
294 current_file = file_lookup(name); 294 current_file = file_lookup(name);
@@ -299,7 +299,7 @@ void zconf_nextfile(const char *name)
299{ 299{
300 struct file *iter; 300 struct file *iter;
301 struct file *file = file_lookup(name); 301 struct file *file = file_lookup(name);
302 struct buffer *buf = malloc(sizeof(*buf)); 302 struct buffer *buf = xmalloc(sizeof(*buf));
303 memset(buf, 0, sizeof(*buf)); 303 memset(buf, 0, sizeof(*buf));
304 304
305 current_buf->state = YY_CURRENT_BUFFER; 305 current_buf->state = YY_CURRENT_BUFFER;
diff --git a/scripts/kconfig/zconf.lex.c_shipped b/scripts/kconfig/zconf.lex.c_shipped
index c32b1a49f5a3..a0521aa5974b 100644
--- a/scripts/kconfig/zconf.lex.c_shipped
+++ b/scripts/kconfig/zconf.lex.c_shipped
@@ -802,7 +802,7 @@ static void zconf_endfile(void);
802 802
803static void new_string(void) 803static void new_string(void)
804{ 804{
805 text = malloc(START_STRSIZE); 805 text = xmalloc(START_STRSIZE);
806 text_asize = START_STRSIZE; 806 text_asize = START_STRSIZE;
807 text_size = 0; 807 text_size = 0;
808 *text = 0; 808 *text = 0;
@@ -824,7 +824,7 @@ static void append_string(const char *str, int size)
824 824
825static void alloc_string(const char *str, int size) 825static void alloc_string(const char *str, int size)
826{ 826{
827 text = malloc(size + 1); 827 text = xmalloc(size + 1);
828 memcpy(text, str, size); 828 memcpy(text, str, size);
829 text[size] = 0; 829 text[size] = 0;
830} 830}
@@ -2343,7 +2343,7 @@ void zconf_initscan(const char *name)
2343 exit(1); 2343 exit(1);
2344 } 2344 }
2345 2345
2346 current_buf = malloc(sizeof(*current_buf)); 2346 current_buf = xmalloc(sizeof(*current_buf));
2347 memset(current_buf, 0, sizeof(*current_buf)); 2347 memset(current_buf, 0, sizeof(*current_buf));
2348 2348
2349 current_file = file_lookup(name); 2349 current_file = file_lookup(name);
@@ -2354,7 +2354,7 @@ void zconf_nextfile(const char *name)
2354{ 2354{
2355 struct file *iter; 2355 struct file *iter;
2356 struct file *file = file_lookup(name); 2356 struct file *file = file_lookup(name);
2357 struct buffer *buf = malloc(sizeof(*buf)); 2357 struct buffer *buf = xmalloc(sizeof(*buf));
2358 memset(buf, 0, sizeof(*buf)); 2358 memset(buf, 0, sizeof(*buf));
2359 2359
2360 current_buf->state = YY_CURRENT_BUFFER; 2360 current_buf->state = YY_CURRENT_BUFFER;