Commit 309667e53fcfd8e0b423280b6ea5a648fd92166c
Exists in
master
and in
20 other branches
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
Showing 21 changed files Side-by-side Diff
- Documentation/kbuild/kconfig-language.txt
- Documentation/kbuild/kconfig.txt
- scripts/kconfig/Makefile
- scripts/kconfig/conf.c
- scripts/kconfig/expr.c
- scripts/kconfig/gconf.c
- scripts/kconfig/lkc.h
- scripts/kconfig/lxdialog/check-lxdialog.sh
- scripts/kconfig/lxdialog/dialog.h
- scripts/kconfig/lxdialog/inputbox.c
- scripts/kconfig/lxdialog/menubox.c
- scripts/kconfig/mconf.c
- scripts/kconfig/menu.c
- scripts/kconfig/merge_config.sh
- scripts/kconfig/nconf.c
- scripts/kconfig/nconf.gui.c
- scripts/kconfig/qconf.cc
- scripts/kconfig/symbol.c
- scripts/kconfig/util.c
- scripts/kconfig/zconf.l
- scripts/kconfig/zconf.lex.c_shipped
Documentation/kbuild/kconfig-language.txt
... | ... | @@ -388,27 +388,4 @@ |
388 | 388 | depends on BAR && m |
389 | 389 | |
390 | 390 | limits FOO to module (=m) or disabled (=n). |
391 | - | |
392 | -Kconfig symbol existence | |
393 | -~~~~~~~~~~~~~~~~~~~~~~~~ | |
394 | -The following two methods produce the same kconfig symbol dependencies | |
395 | -but differ greatly in kconfig symbol existence (production) in the | |
396 | -generated config file. | |
397 | - | |
398 | -case 1: | |
399 | - | |
400 | -config FOO | |
401 | - tristate "about foo" | |
402 | - depends on BAR | |
403 | - | |
404 | -vs. case 2: | |
405 | - | |
406 | -if BAR | |
407 | -config FOO | |
408 | - tristate "about foo" | |
409 | -endif | |
410 | - | |
411 | -In case 1, the symbol FOO will always exist in the config file (given | |
412 | -no other dependencies). In case 2, the symbol FOO will only exist in | |
413 | -the config file if BAR is enabled. |
Documentation/kbuild/kconfig.txt
... | ... | @@ -46,6 +46,12 @@ |
46 | 46 | If you set KCONFIG_OVERWRITECONFIG in the environment, Kconfig will not |
47 | 47 | break symlinks when .config is a symlink to somewhere else. |
48 | 48 | |
49 | +CONFIG_ | |
50 | +-------------------------------------------------- | |
51 | +If you set CONFIG_ in the environment, Kconfig will prefix all symbols | |
52 | +with its value when saving the configuration, instead of using the default, | |
53 | +"CONFIG_". | |
54 | + | |
49 | 55 | ______________________________________________________________________ |
50 | 56 | Environment variables for '{allyes/allmod/allno/rand}config' |
51 | 57 |
scripts/kconfig/Makefile
scripts/kconfig/conf.c
... | ... | @@ -36,6 +36,7 @@ |
36 | 36 | } input_mode = oldaskconfig; |
37 | 37 | |
38 | 38 | static int indent = 1; |
39 | +static int tty_stdio; | |
39 | 40 | static int valid_stdin = 1; |
40 | 41 | static int sync_kconfig; |
41 | 42 | static int conf_cnt; |
... | ... | @@ -108,6 +109,8 @@ |
108 | 109 | case oldaskconfig: |
109 | 110 | fflush(stdout); |
110 | 111 | xfgets(line, 128, stdin); |
112 | + if (!tty_stdio) | |
113 | + printf("\n"); | |
111 | 114 | return 1; |
112 | 115 | default: |
113 | 116 | break; |
... | ... | @@ -495,6 +498,8 @@ |
495 | 498 | bindtextdomain(PACKAGE, LOCALEDIR); |
496 | 499 | textdomain(PACKAGE); |
497 | 500 | |
501 | + tty_stdio = isatty(0) && isatty(1) && isatty(2); | |
502 | + | |
498 | 503 | while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { |
499 | 504 | input_mode = (enum input_mode)opt; |
500 | 505 | switch (opt) { |
... | ... | @@ -621,7 +626,7 @@ |
621 | 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 | 632 | switch (input_mode) { |
scripts/kconfig/expr.c
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | |
14 | 14 | struct 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 | 17 | e->type = E_SYMBOL; |
18 | 18 | e->left.sym = sym; |
19 | 19 | return e; |
... | ... | @@ -21,7 +21,7 @@ |
21 | 21 | |
22 | 22 | struct 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 | 25 | e->type = type; |
26 | 26 | e->left.expr = ce; |
27 | 27 | return e; |
... | ... | @@ -29,7 +29,7 @@ |
29 | 29 | |
30 | 30 | struct 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 | 33 | e->type = type; |
34 | 34 | e->left.expr = e1; |
35 | 35 | e->right.expr = e2; |
... | ... | @@ -38,7 +38,7 @@ |
38 | 38 | |
39 | 39 | struct 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 | 42 | e->type = type; |
43 | 43 | e->left.sym = s1; |
44 | 44 | e->right.sym = s2; |
... | ... | @@ -66,7 +66,7 @@ |
66 | 66 | if (!org) |
67 | 67 | return NULL; |
68 | 68 | |
69 | - e = malloc(sizeof(*org)); | |
69 | + e = xmalloc(sizeof(*org)); | |
70 | 70 | memcpy(e, org, sizeof(*org)); |
71 | 71 | switch (org->type) { |
72 | 72 | case E_SYMBOL: |
scripts/kconfig/gconf.c
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | # include <config.h> |
11 | 11 | #endif |
12 | 12 | |
13 | +#include <stdlib.h> | |
13 | 14 | #include "lkc.h" |
14 | 15 | #include "images.c" |
15 | 16 | |
... | ... | @@ -22,7 +23,6 @@ |
22 | 23 | #include <string.h> |
23 | 24 | #include <unistd.h> |
24 | 25 | #include <time.h> |
25 | -#include <stdlib.h> | |
26 | 26 | |
27 | 27 | //#define DEBUG |
28 | 28 |
scripts/kconfig/lkc.h
... | ... | @@ -39,6 +39,12 @@ |
39 | 39 | #ifndef CONFIG_ |
40 | 40 | #define CONFIG_ "CONFIG_" |
41 | 41 | #endif |
42 | +static inline const char *CONFIG_prefix(void) | |
43 | +{ | |
44 | + return getenv( "CONFIG_" ) ?: CONFIG_; | |
45 | +} | |
46 | +#undef CONFIG_ | |
47 | +#define CONFIG_ CONFIG_prefix() | |
42 | 48 | |
43 | 49 | #define TF_COMMAND 0x0001 |
44 | 50 | #define TF_PARAM 0x0002 |
... | ... | @@ -116,6 +122,8 @@ |
116 | 122 | /* util.c */ |
117 | 123 | struct file *file_lookup(const char *name); |
118 | 124 | int file_write_dep(const char *name); |
125 | +void *xmalloc(size_t size); | |
126 | +void *xcalloc(size_t nmemb, size_t size); | |
119 | 127 | |
120 | 128 | struct gstr { |
121 | 129 | size_t len; |
scripts/kconfig/lxdialog/check-lxdialog.sh
... | ... | @@ -21,6 +21,7 @@ |
21 | 21 | { |
22 | 22 | if [ -f /usr/include/ncursesw/curses.h ]; then |
23 | 23 | echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"' |
24 | + echo ' -DNCURSES_WIDECHAR=1' | |
24 | 25 | elif [ -f /usr/include/ncurses/ncurses.h ]; then |
25 | 26 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' |
26 | 27 | elif [ -f /usr/include/ncurses/curses.h ]; then |
scripts/kconfig/lxdialog/dialog.h
... | ... | @@ -221,7 +221,6 @@ |
221 | 221 | const void *selected, int *s_scroll); |
222 | 222 | int dialog_checklist(const char *title, const char *prompt, int height, |
223 | 223 | int width, int list_height); |
224 | -extern char dialog_input_result[]; | |
225 | 224 | int dialog_inputbox(const char *title, const char *prompt, int height, |
226 | 225 | int width, const char *init); |
227 | 226 |
scripts/kconfig/lxdialog/inputbox.c
... | ... | @@ -45,7 +45,8 @@ |
45 | 45 | const char *init) |
46 | 46 | { |
47 | 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 | 50 | char *instr = dialog_input_result; |
50 | 51 | WINDOW *dialog; |
51 | 52 | |
52 | 53 | |
53 | 54 | |
54 | 55 | |
... | ... | @@ -97,14 +98,17 @@ |
97 | 98 | wmove(dialog, box_y, box_x); |
98 | 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) { | |
103 | - scroll = input_x - box_width + 1; | |
104 | + if (len >= box_width) { | |
105 | + show_x = len - box_width + 1; | |
104 | 106 | input_x = box_width - 1; |
105 | 107 | for (i = 0; i < box_width - 1; i++) |
106 | - waddch(dialog, instr[scroll + i]); | |
108 | + waddch(dialog, instr[show_x + i]); | |
107 | 109 | } else { |
110 | + show_x = 0; | |
111 | + input_x = len; | |
108 | 112 | waddstr(dialog, instr); |
109 | 113 | } |
110 | 114 | |
111 | 115 | |
112 | 116 | |
113 | 117 | |
114 | 118 | |
115 | 119 | |
116 | 120 | |
117 | 121 | |
118 | 122 | |
119 | 123 | |
... | ... | @@ -121,45 +125,104 @@ |
121 | 125 | case KEY_UP: |
122 | 126 | case KEY_DOWN: |
123 | 127 | break; |
124 | - case KEY_LEFT: | |
125 | - continue; | |
126 | - case KEY_RIGHT: | |
127 | - continue; | |
128 | 128 | case KEY_BACKSPACE: |
129 | 129 | case 127: |
130 | - if (input_x || scroll) { | |
130 | + if (pos) { | |
131 | 131 | wattrset(dialog, dlg.inputbox.atr); |
132 | - if (!input_x) { | |
133 | - scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1); | |
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; | |
132 | + if (input_x == 0) { | |
133 | + show_x--; | |
140 | 134 | } else |
141 | 135 | input_x--; |
142 | - instr[scroll + input_x] = '\0'; | |
143 | - mvwaddch(dialog, box_y, input_x + box_x, ' '); | |
136 | + | |
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 | 154 | wmove(dialog, box_y, input_x + box_x); |
145 | 155 | wrefresh(dialog); |
146 | 156 | } |
147 | 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 | 196 | default: |
149 | 197 | if (key < 0x100 && isprint(key)) { |
150 | - if (scroll + input_x < MAX_LEN) { | |
198 | + if (len < MAX_LEN) { | |
151 | 199 | wattrset(dialog, dlg.inputbox.atr); |
152 | - instr[scroll + input_x] = key; | |
153 | - instr[scroll + input_x + 1] = '\0'; | |
200 | + if (pos < len) { | |
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 | 211 | if (input_x == box_width - 1) { |
155 | - scroll++; | |
156 | - wmove(dialog, box_y, box_x); | |
157 | - for (i = 0; i < box_width - 1; i++) | |
158 | - waddch(dialog, instr [scroll + i]); | |
212 | + show_x++; | |
159 | 213 | } else { |
160 | - wmove(dialog, box_y, input_x++ + box_x); | |
161 | - waddch(dialog, key); | |
214 | + input_x++; | |
162 | 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]); | |
224 | + } | |
225 | + wmove(dialog, box_y, input_x + box_x); | |
163 | 226 | wrefresh(dialog); |
164 | 227 | } else |
165 | 228 | flash(); /* Alarm user about overflow */ |
scripts/kconfig/lxdialog/menubox.c
... | ... | @@ -26,7 +26,7 @@ |
26 | 26 | * |
27 | 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 | 30 | * to the first position in the menu box. Now lxdialog is a bit |
31 | 31 | * smarter and works more like other menu systems (just have a look at |
32 | 32 | * it). |
33 | 33 | |
... | ... | @@ -154,12 +154,14 @@ |
154 | 154 | */ |
155 | 155 | static 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 | 158 | int y = height - 2; |
159 | 159 | |
160 | 160 | print_button(win, gettext("Select"), y, x, selected == 0); |
161 | 161 | print_button(win, gettext(" Exit "), y, x + 12, selected == 1); |
162 | 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 | 166 | wmove(win, y, x + 1 + 12 * selected); |
165 | 167 | wrefresh(win); |
... | ... | @@ -372,7 +374,7 @@ |
372 | 374 | case TAB: |
373 | 375 | case KEY_RIGHT: |
374 | 376 | button = ((key == KEY_LEFT ? --button : ++button) < 0) |
375 | - ? 2 : (button > 2 ? 0 : button); | |
377 | + ? 4 : (button > 4 ? 0 : button); | |
376 | 378 | |
377 | 379 | print_buttons(dialog, height, width, button); |
378 | 380 | wrefresh(menu); |
379 | 381 | |
380 | 382 | |
381 | 383 | |
382 | 384 | |
383 | 385 | |
... | ... | @@ -399,17 +401,17 @@ |
399 | 401 | return 2; |
400 | 402 | case 's': |
401 | 403 | case 'y': |
402 | - return 3; | |
404 | + return 5; | |
403 | 405 | case 'n': |
404 | - return 4; | |
406 | + return 6; | |
405 | 407 | case 'm': |
406 | - return 5; | |
408 | + return 7; | |
407 | 409 | case ' ': |
408 | - return 6; | |
410 | + return 8; | |
409 | 411 | case '/': |
410 | - return 7; | |
412 | + return 9; | |
411 | 413 | case 'z': |
412 | - return 8; | |
414 | + return 10; | |
413 | 415 | case '\n': |
414 | 416 | return button; |
415 | 417 | } |
scripts/kconfig/mconf.c
... | ... | @@ -280,6 +280,7 @@ |
280 | 280 | static int child_count; |
281 | 281 | static int single_menu_mode; |
282 | 282 | static int show_all_options; |
283 | +static int save_and_exit; | |
283 | 284 | |
284 | 285 | static void conf(struct menu *menu, struct menu *active_menu); |
285 | 286 | static void conf_choice(struct menu *menu); |
286 | 287 | |
287 | 288 | |
... | ... | @@ -348,15 +349,19 @@ |
348 | 349 | { |
349 | 350 | struct symbol **sym_arr; |
350 | 351 | struct gstr res; |
352 | + struct gstr title; | |
351 | 353 | char *dialog_input; |
352 | 354 | int dres, vscroll = 0, hscroll = 0; |
353 | 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 | + | |
355 | 361 | again: |
356 | 362 | dialog_clear(); |
357 | 363 | dres = dialog_inputbox(_("Search Configuration Parameter"), |
358 | - _("Enter " CONFIG_ " (sub)string to search for " | |
359 | - "(with or without \"" CONFIG_ "\")"), | |
364 | + str_get(&title), | |
360 | 365 | 10, 75, ""); |
361 | 366 | switch (dres) { |
362 | 367 | case 0: |
... | ... | @@ -365,6 +370,7 @@ |
365 | 370 | show_helptext(_("Search Configuration"), search_help); |
366 | 371 | goto again; |
367 | 372 | default: |
373 | + str_free(&title); | |
368 | 374 | return; |
369 | 375 | } |
370 | 376 | |
... | ... | @@ -398,6 +404,7 @@ |
398 | 404 | str_free(&res); |
399 | 405 | } while (again); |
400 | 406 | free(sym_arr); |
407 | + str_free(&title); | |
401 | 408 | } |
402 | 409 | |
403 | 410 | static void build_conf(struct menu *menu) |
... | ... | @@ -592,14 +599,6 @@ |
592 | 599 | build_conf(menu); |
593 | 600 | if (!child_count) |
594 | 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 | 602 | dialog_clear(); |
604 | 603 | res = dialog_menu(prompt ? _(prompt) : _("Main Menu"), |
605 | 604 | _(menu_instructions), |
... | ... | @@ -636,12 +635,6 @@ |
636 | 635 | case 's': |
637 | 636 | conf_string(submenu); |
638 | 637 | break; |
639 | - case 'L': | |
640 | - conf_load(); | |
641 | - break; | |
642 | - case 'S': | |
643 | - conf_save(); | |
644 | - break; | |
645 | 638 | } |
646 | 639 | break; |
647 | 640 | case 2: |
... | ... | @@ -651,6 +644,12 @@ |
651 | 644 | show_helptext(_("README"), _(mconf_readme)); |
652 | 645 | break; |
653 | 646 | case 3: |
647 | + conf_save(); | |
648 | + break; | |
649 | + case 4: | |
650 | + conf_load(); | |
651 | + break; | |
652 | + case 5: | |
654 | 653 | if (item_is_tag('t')) { |
655 | 654 | if (sym_set_tristate_value(sym, yes)) |
656 | 655 | break; |
657 | 656 | |
658 | 657 | |
659 | 658 | |
660 | 659 | |
... | ... | @@ -658,24 +657,24 @@ |
658 | 657 | show_textbox(NULL, setmod_text, 6, 74); |
659 | 658 | } |
660 | 659 | break; |
661 | - case 4: | |
660 | + case 6: | |
662 | 661 | if (item_is_tag('t')) |
663 | 662 | sym_set_tristate_value(sym, no); |
664 | 663 | break; |
665 | - case 5: | |
664 | + case 7: | |
666 | 665 | if (item_is_tag('t')) |
667 | 666 | sym_set_tristate_value(sym, mod); |
668 | 667 | break; |
669 | - case 6: | |
668 | + case 8: | |
670 | 669 | if (item_is_tag('t')) |
671 | 670 | sym_toggle_tristate_value(sym); |
672 | 671 | else if (item_is_tag('m')) |
673 | 672 | conf(submenu, NULL); |
674 | 673 | break; |
675 | - case 7: | |
674 | + case 9: | |
676 | 675 | search_conf(); |
677 | 676 | break; |
678 | - case 8: | |
677 | + case 10: | |
679 | 678 | show_all_options = !show_all_options; |
680 | 679 | break; |
681 | 680 | } |
... | ... | @@ -702,6 +701,17 @@ |
702 | 701 | show_textbox(title, text, 0, 0); |
703 | 702 | } |
704 | 703 | |
704 | +static 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 | + | |
705 | 715 | static void show_help(struct menu *menu) |
706 | 716 | { |
707 | 717 | struct gstr help = str_new(); |
... | ... | @@ -870,6 +880,7 @@ |
870 | 880 | { |
871 | 881 | int res; |
872 | 882 | |
883 | + save_and_exit = 1; | |
873 | 884 | dialog_clear(); |
874 | 885 | if (conf_get_changed()) |
875 | 886 | res = dialog_yesno(NULL, |
... | ... | @@ -941,6 +952,7 @@ |
941 | 952 | } |
942 | 953 | |
943 | 954 | set_config_filename(conf_get_configname()); |
955 | + conf_set_message_callback(conf_message_callback); | |
944 | 956 | do { |
945 | 957 | conf(&rootmenu, NULL); |
946 | 958 | res = handle_exit(); |
scripts/kconfig/menu.c
... | ... | @@ -48,7 +48,7 @@ |
48 | 48 | { |
49 | 49 | struct menu *menu; |
50 | 50 | |
51 | - menu = malloc(sizeof(*menu)); | |
51 | + menu = xmalloc(sizeof(*menu)); | |
52 | 52 | memset(menu, 0, sizeof(*menu)); |
53 | 53 | menu->sym = sym; |
54 | 54 | menu->parent = current_menu; |
... | ... | @@ -531,7 +531,7 @@ |
531 | 531 | location = menu; |
532 | 532 | } |
533 | 533 | if (head && location) { |
534 | - jump = malloc(sizeof(struct jump_key)); | |
534 | + jump = xmalloc(sizeof(struct jump_key)); | |
535 | 535 | |
536 | 536 | if (menu_is_visible(prop->menu)) { |
537 | 537 | /* |
scripts/kconfig/merge_config.sh
... | ... | @@ -32,11 +32,13 @@ |
32 | 32 | echo " -m only merge the fragments, do not execute the make command" |
33 | 33 | echo " -n use allnoconfig instead of alldefconfig" |
34 | 34 | echo " -r list redundant entries when merging fragments" |
35 | + echo " -O dir to put generated output files" | |
35 | 36 | } |
36 | 37 | |
37 | 38 | MAKE=true |
38 | 39 | ALLTARGET=alldefconfig |
39 | 40 | WARNREDUN=false |
41 | +OUTPUT=. | |
40 | 42 | |
41 | 43 | while true; do |
42 | 44 | case $1 in |
... | ... | @@ -59,6 +61,16 @@ |
59 | 61 | shift |
60 | 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 | 75 | break |
64 | 76 | ;; |
65 | 77 | |
... | ... | @@ -100,9 +112,9 @@ |
100 | 112 | done |
101 | 113 | |
102 | 114 | if [ "$MAKE" = "false" ]; then |
103 | - cp $TMP_FILE .config | |
115 | + cp $TMP_FILE $OUTPUT/.config | |
104 | 116 | echo "#" |
105 | - echo "# merged configuration written to .config (needs make)" | |
117 | + echo "# merged configuration written to $OUTPUT/.config (needs make)" | |
106 | 118 | echo "#" |
107 | 119 | clean_up |
108 | 120 | exit |
109 | 121 | |
... | ... | @@ -111,14 +123,14 @@ |
111 | 123 | # Use the merged file as the starting point for: |
112 | 124 | # alldefconfig: Fills in any missing symbols with Kconfig default |
113 | 125 | # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set |
114 | -make KCONFIG_ALLCONFIG=$TMP_FILE $ALLTARGET | |
126 | +make KCONFIG_ALLCONFIG=$TMP_FILE O=$OUTPUT $ALLTARGET | |
115 | 127 | |
116 | 128 | |
117 | 129 | # Check all specified config values took (might have missed-dependency issues) |
118 | 130 | for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do |
119 | 131 | |
120 | 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 | 134 | if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then |
123 | 135 | echo "Value requested for $CFG not in final .config" |
124 | 136 | echo "Requested value: $REQUESTED_VAL" |
scripts/kconfig/nconf.c
... | ... | @@ -7,215 +7,208 @@ |
7 | 7 | */ |
8 | 8 | #define _GNU_SOURCE |
9 | 9 | #include <string.h> |
10 | +#include <stdlib.h> | |
10 | 11 | |
11 | 12 | #include "lkc.h" |
12 | 13 | #include "nconf.h" |
13 | 14 | #include <ctype.h> |
14 | 15 | |
15 | -static const char nconf_readme[] = N_( | |
16 | -"Overview\n" | |
17 | -"--------\n" | |
18 | -"This interface let you select features and parameters for the build.\n" | |
19 | -"Features can either be built-in, modularized, or ignored. Parameters\n" | |
20 | -"must be entered in as decimal or hexadecimal numbers or text.\n" | |
16 | +static const char nconf_global_help[] = N_( | |
17 | +"Help windows\n" | |
18 | +"------------\n" | |
19 | +"o Global help: Unless in a data entry window, pressing <F1> will give \n" | |
20 | +" you the global help window, which you are just reading.\n" | |
21 | 21 | "\n" |
22 | -"Menu items beginning with following braces represent features that\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" | |
22 | +"o A short version of the global help is available by pressing <F3>.\n" | |
30 | 23 | "\n" |
31 | -"To change any of these features, highlight it with the cursor\n" | |
32 | -"keys and press <Y> to build it in, <M> to make it a module or\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" | |
24 | +"o Local help: To get help related to the current menu entry, use any\n" | |
25 | +" of <?> <h>, or if in a data entry window then press <F1>.\n" | |
35 | 26 | "\n" |
36 | -"Some additional keyboard hints:\n" | |
37 | 27 | "\n" |
38 | -"Menus\n" | |
39 | -"----------\n" | |
40 | -"o Use the Up/Down arrow keys (cursor keys) to highlight the item\n" | |
41 | -" you wish to change use <Enter> or <Space>. Goto submenu by \n" | |
42 | -" pressing <Enter> of <right-arrow>. Use <Esc> or <left-arrow> to go back.\n" | |
43 | -" Submenus are designated by \"--->\".\n" | |
28 | +"Menu entries\n" | |
29 | +"------------\n" | |
30 | +"This interface lets you select features and parameters for the kernel\n" | |
31 | +"build. Kernel features can either be built-in, modularized, or removed.\n" | |
32 | +"Parameters must be entered as text or decimal or hexadecimal numbers.\n" | |
44 | 33 | "\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" | |
34 | +"Menu entries beginning with following braces represent features that\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" | |
52 | 42 | "\n" |
53 | -" You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n" | |
54 | -" unseen options into view.\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" | |
55 | 47 | "\n" |
56 | -"o To exit a menu use the just press <ESC> <F5> <F8> or <left-arrow>.\n" | |
48 | +"A trailing \"--->\" designates a submenu.\n" | |
57 | 49 | "\n" |
58 | -"o To get help with an item, press <F1>\n" | |
59 | -" Shortcut: Press <h> or <?>.\n" | |
60 | 50 | "\n" |
51 | +"Menu navigation keys\n" | |
52 | +"----------------------------------------------------------------------\n" | |
53 | +"Linewise up <Up>\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" | |
61 | 75 | "\n" |
62 | -"Radiolists (Choice lists)\n" | |
63 | -"-----------\n" | |
64 | -"o Use the cursor keys to select the option you wish to set and press\n" | |
65 | -" <S> or the <SPACE BAR>.\n" | |
76 | +"Unless in a data entry window, key <1> may be used instead of <F1>,\n" | |
77 | +"<2> instead of <F2>, etc.\n" | |
66 | 78 | "\n" |
67 | -" Shortcut: Press the first letter of the option you wish to set then\n" | |
68 | -" press <S> or <SPACE BAR>.\n" | |
69 | 79 | "\n" |
70 | -"o To see available help for the item, press <F1>\n" | |
71 | -" Shortcut: Press <H> or <?>.\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" | |
72 | 84 | "\n" |
73 | 85 | "\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" | |
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" | |
79 | 90 | "\n" |
80 | -"o For help, press <F1>.\n" | |
81 | 91 | "\n" |
92 | +"Text Box (Help Window)\n" | |
93 | +"----------------------\n" | |
94 | +"Use movement keys as listed in table above.\n" | |
82 | 95 | "\n" |
83 | -"Text Box (Help Window)\n" | |
84 | -"--------\n" | |
85 | -"o Use the cursor keys to scroll up/down/left/right. The VI editor\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" | |
96 | +"Press any of <Enter> <Esc> <q> <F5> <F9> to exit.\n" | |
88 | 97 | "\n" |
89 | -"o Press <Enter>, <F1>, <F5>, <F9>, <q> or <Esc> to exit.\n" | |
90 | 98 | "\n" |
91 | -"\n" | |
92 | -"Alternate Configuration Files\n" | |
99 | +"Alternate configuration files\n" | |
93 | 100 | "-----------------------------\n" |
94 | -"nconfig supports the use of alternate configuration files for\n" | |
95 | -"those who, for various reasons, find it necessary to switch\n" | |
96 | -"between different configurations.\n" | |
101 | +"nconfig supports switching between different configurations.\n" | |
102 | +"Press <F6> to save your current configuration. Press <F7> and enter\n" | |
103 | +"a file name to load a previously saved configuration.\n" | |
97 | 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 | 105 | "\n" |
103 | -"Even if you don't use alternate configuration files, but you\n" | |
104 | -"find during a nconfig session that you have completely messed\n" | |
105 | -"up your settings, you may use the \"Load Alternate...\" option to\n" | |
106 | -"restore your previously saved settings from \".config\" without\n" | |
107 | -"restarting nconfig.\n" | |
106 | +"Terminal configuration\n" | |
107 | +"----------------------\n" | |
108 | +"If you use nconfig in a xterm window, make sure your TERM environment\n" | |
109 | +"variable specifies a terminal configuration which supports at least\n" | |
110 | +"16 colors. Otherwise nconfig will look rather bad.\n" | |
108 | 111 | "\n" |
109 | -"Other information\n" | |
110 | -"-----------------\n" | |
111 | -"If you use nconfig in an XTERM window make sure you have your\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" | |
112 | +"If the \"stty size\" command reports the current terminalsize correctly,\n" | |
113 | +"nconfig will adapt to sizes larger than the traditional 80x25 \"standard\"\n" | |
114 | +"and display longer menus properly.\n" | |
116 | 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 | 116 | "\n" |
127 | -"Optional personality available\n" | |
128 | -"------------------------------\n" | |
129 | -"If you prefer to have all of the options listed in a single menu, rather\n" | |
130 | -"than the default multimenu hierarchy, run the nconfig with NCONFIG_MODE\n" | |
131 | -"environment variable set to single_menu. Example:\n" | |
117 | +"Single menu mode\n" | |
118 | +"----------------\n" | |
119 | +"If you prefer to have all of the menu entries listed in a single menu,\n" | |
120 | +"rather than the default multimenu hierarchy, run nconfig with\n" | |
121 | +"NCONFIG_MODE environment variable set to single_menu. Example:\n" | |
132 | 122 | "\n" |
133 | 123 | "make NCONFIG_MODE=single_menu nconfig\n" |
134 | 124 | "\n" |
135 | -"<Enter> will then unroll the appropriate category, or enfold it if it\n" | |
136 | -"is already unrolled.\n" | |
125 | +"<Enter> will then unfold the appropriate category, or fold it if it\n" | |
126 | +"is already unfolded. Folded menu entries will be designated by a\n" | |
127 | +"leading \"++>\" and unfolded entries by a leading \"-->\".\n" | |
137 | 128 | "\n" |
138 | -"Note that this mode can eventually be a little more CPU expensive\n" | |
139 | -"(especially with a larger number of unrolled categories) than the\n" | |
140 | -"default mode.\n" | |
129 | +"Note that this mode can eventually be a little more CPU expensive than\n" | |
130 | +"the default mode, especially with a larger number of unfolded submenus.\n" | |
141 | 131 | "\n"), |
142 | 132 | menu_no_f_instructions[] = N_( |
143 | -" You do not have function keys support. Please follow the\n" | |
144 | -" following instructions:\n" | |
145 | -" Arrow keys navigate the menu.\n" | |
146 | -" <Enter> or <right-arrow> selects submenus --->.\n" | |
147 | -" Capital Letters are hotkeys.\n" | |
148 | -" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n" | |
149 | -" Pressing SpaceBar toggles between the above options.\n" | |
150 | -" Press <Esc> or <left-arrow> to go back one menu,\n" | |
151 | -" <?> or <h> for Help, </> for Search.\n" | |
152 | -" <1> is interchangeable with <F1>, <2> with <F2>, etc.\n" | |
153 | -" Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" | |
154 | -" <Esc> always leaves the current window.\n"), | |
133 | +"Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" | |
134 | +"Submenus are designated by a trailing \"--->\".\n" | |
135 | +"\n" | |
136 | +"Use the following keys to navigate the menus:\n" | |
137 | +"Move up or down with <Up> and <Down>.\n" | |
138 | +"Enter a submenu with <Enter> or <Right>.\n" | |
139 | +"Exit a submenu to its parent menu with <Esc> or <Left>.\n" | |
140 | +"Pressing <y> includes, <n> excludes, <m> modularizes features.\n" | |
141 | +"Pressing <Space> cycles through the available options.\n" | |
142 | +"To search for menu entries press </>.\n" | |
143 | +"<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"), | |
155 | 149 | menu_instructions[] = N_( |
156 | -" Arrow keys navigate the menu.\n" | |
157 | -" <Enter> or <right-arrow> selects submenus --->.\n" | |
158 | -" Capital Letters are hotkeys.\n" | |
159 | -" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n" | |
160 | -" Pressing SpaceBar toggles between the above options\n" | |
161 | -" Press <Esc>, <F5> or <left-arrow> to go back one menu,\n" | |
162 | -" <?>, <F1> or <h> for Help, </> for Search.\n" | |
163 | -" <1> is interchangeable with <F1>, <2> with <F2>, etc.\n" | |
164 | -" Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" | |
165 | -" <Esc> always leaves the current window\n"), | |
150 | +"Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" | |
151 | +"Submenus are designated by a trailing \"--->\".\n" | |
152 | +"\n" | |
153 | +"Use the following keys to navigate the menus:\n" | |
154 | +"Move up or down with <Up> or <Down>.\n" | |
155 | +"Enter a submenu with <Enter> or <Right>.\n" | |
156 | +"Exit a submenu to its parent menu with <Esc> or <Left>.\n" | |
157 | +"Pressing <y> includes, <n> excludes, <m> modularizes features.\n" | |
158 | +"Pressing <Space> cycles through the available options.\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"), | |
166 | 165 | radiolist_instructions[] = N_( |
167 | -" Use the arrow keys to navigate this window or\n" | |
168 | -" press the hotkey of the item you wish to select\n" | |
169 | -" followed by the <SPACE BAR>.\n" | |
170 | -" Press <?>, <F1> or <h> for additional information about this option.\n"), | |
166 | +"Press <Up>, <Down>, <Home> or <End> to navigate a radiolist, select\n" | |
167 | +"with <Space>.\n" | |
168 | +"For help related to the current entry press <?> or <h>.\n" | |
169 | +"For global help press <F1>.\n"), | |
171 | 170 | inputbox_instructions_int[] = N_( |
172 | 171 | "Please enter a decimal value.\n" |
173 | 172 | "Fractions will not be accepted.\n" |
174 | -"Press <RETURN> to accept, <ESC> to cancel."), | |
173 | +"Press <Enter> to apply, <Esc> to cancel."), | |
175 | 174 | inputbox_instructions_hex[] = N_( |
176 | 175 | "Please enter a hexadecimal value.\n" |
177 | -"Press <RETURN> to accept, <ESC> to cancel."), | |
176 | +"Press <Enter> to apply, <Esc> to cancel."), | |
178 | 177 | inputbox_instructions_string[] = N_( |
179 | 178 | "Please enter a string value.\n" |
180 | -"Press <RETURN> to accept, <ESC> to cancel."), | |
179 | +"Press <Enter> to apply, <Esc> to cancel."), | |
181 | 180 | setmod_text[] = N_( |
182 | -"This feature depends on another which\n" | |
183 | -"has been configured as a module.\n" | |
184 | -"As a result, this feature will be built as a module."), | |
181 | +"This feature depends on another feature which has been configured as a\n" | |
182 | +"module. As a result, the current feature will be built as a module too."), | |
185 | 183 | load_config_text[] = N_( |
186 | 184 | "Enter the name of the configuration file you wish to load.\n" |
187 | -"Accept the name shown to restore the configuration you\n" | |
188 | -"last retrieved. Leave blank to abort."), | |
185 | +"Accept the name shown to restore the configuration you last\n" | |
186 | +"retrieved. Leave empty to abort."), | |
189 | 187 | load_config_help[] = N_( |
190 | -"\n" | |
191 | 188 | "For various reasons, one may wish to keep several different\n" |
192 | 189 | "configurations available on a single machine.\n" |
193 | 190 | "\n" |
194 | 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" | |
196 | -"configuration.\n" | |
192 | +"default one, entering its name here will allow you to load and modify\n" | |
193 | +"that configuration.\n" | |
197 | 194 | "\n" |
198 | -"If you are uncertain, then you have probably never used alternate\n" | |
199 | -"configuration files. You should therefor leave this blank to abort.\n"), | |
195 | +"Leave empty to abort.\n"), | |
200 | 196 | save_config_text[] = N_( |
201 | 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."), | |
203 | 199 | save_config_help[] = N_( |
200 | +"For various reasons, one may wish to keep several different\n" | |
201 | +"configurations available on a single machine.\n" | |
204 | 202 | "\n" |
205 | -"For various reasons, one may wish to keep different configurations\n" | |
206 | -"available on a single machine.\n" | |
207 | -"\n" | |
208 | 203 | "Entering a file name here will allow you to later retrieve, modify\n" |
209 | 204 | "and use the current configuration as an alternate to whatever\n" |
210 | 205 | "configuration options you have selected at that time.\n" |
211 | 206 | "\n" |
212 | -"If you are uncertain what all this means then you should probably\n" | |
213 | -"leave this blank.\n"), | |
207 | +"Leave empty to abort.\n"), | |
214 | 208 | search_help[] = N_( |
215 | -"\n" | |
216 | -"Search for symbols and display their relations. Regular expressions\n" | |
217 | -"are allowed.\n" | |
218 | -"Example: search for \"^FOO\"\n" | |
209 | +"Search for symbols (configuration variable names CONFIG_*) and display\n" | |
210 | +"their relations. Regular expressions are supported.\n" | |
211 | +"Example: Search for \"^FOO\".\n" | |
219 | 212 | "Result:\n" |
220 | 213 | "-----------------------------------------------------------------\n" |
221 | 214 | "Symbol: FOO [ = m]\n" |
222 | 215 | |
... | ... | @@ -229,26 +222,26 @@ |
229 | 222 | "Selects: LIBCRC32\n" |
230 | 223 | "Selected by: BAR\n" |
231 | 224 | "-----------------------------------------------------------------\n" |
232 | -"o The line 'Prompt:' shows the text used in the menu structure for\n" | |
233 | -" this symbol\n" | |
234 | -"o The 'Defined at' line tell at what file / line number the symbol\n" | |
235 | -" is defined\n" | |
236 | -"o The 'Depends on:' line tell what symbols needs to be defined for\n" | |
237 | -" this symbol to be visible in the menu (selectable)\n" | |
238 | -"o The 'Location:' lines tell where in the menu structure this symbol\n" | |
239 | -" is located\n" | |
240 | -" A location followed by a [ = y] indicate that this is a selectable\n" | |
241 | -" menu item - and current value is displayed inside brackets.\n" | |
242 | -"o The 'Selects:' line tell what symbol will be automatically\n" | |
243 | -" selected if this symbol is selected (y or m)\n" | |
244 | -"o The 'Selected by' line tell what symbol has selected this symbol\n" | |
225 | +"o The line 'Prompt:' shows the text displayed for this symbol in\n" | |
226 | +" the menu hierarchy.\n" | |
227 | +"o The 'Defined at' line tells at what file / line number the symbol is\n" | |
228 | +" defined.\n" | |
229 | +"o The 'Depends on:' line lists symbols that need to be defined for\n" | |
230 | +" this symbol to be visible and selectable in the menu.\n" | |
231 | +"o The 'Location:' lines tell, where in the menu structure this symbol\n" | |
232 | +" is located. A location followed by a [ = y] indicates that this is\n" | |
233 | +" a selectable menu item, and the current value is displayed inside\n" | |
234 | +" brackets.\n" | |
235 | +"o The 'Selects:' line tells, what symbol will be automatically selected\n" | |
236 | +" if this symbol is selected (y or m).\n" | |
237 | +"o The 'Selected by' line tells what symbol has selected this symbol.\n" | |
245 | 238 | "\n" |
246 | 239 | "Only relevant lines are shown.\n" |
247 | 240 | "\n\n" |
248 | 241 | "Search examples:\n" |
249 | -"Examples: USB => find all symbols containing USB\n" | |
250 | -" ^USB => find all symbols starting with USB\n" | |
251 | -" USB$ => find all symbols ending with USB\n" | |
242 | +"USB => find all symbols containing USB\n" | |
243 | +"^USB => find all symbols starting with USB\n" | |
244 | +"USB$ => find all symbols ending with USB\n" | |
252 | 245 | "\n"); |
253 | 246 | |
254 | 247 | struct mitem { |
255 | 248 | |
256 | 249 | |
... | ... | @@ -319,19 +312,19 @@ |
319 | 312 | }, |
320 | 313 | { |
321 | 314 | .key_str = "F2", |
322 | - .func = "Sym Info", | |
315 | + .func = "SymInfo", | |
323 | 316 | .key = F_SYMBOL, |
324 | 317 | .handler = handle_f2, |
325 | 318 | }, |
326 | 319 | { |
327 | 320 | .key_str = "F3", |
328 | - .func = "Insts", | |
321 | + .func = "Help 2", | |
329 | 322 | .key = F_INSTS, |
330 | 323 | .handler = handle_f3, |
331 | 324 | }, |
332 | 325 | { |
333 | 326 | .key_str = "F4", |
334 | - .func = "Config", | |
327 | + .func = "ShowAll", | |
335 | 328 | .key = F_CONF, |
336 | 329 | .handler = handle_f4, |
337 | 330 | }, |
... | ... | @@ -355,7 +348,7 @@ |
355 | 348 | }, |
356 | 349 | { |
357 | 350 | .key_str = "F8", |
358 | - .func = "Sym Search", | |
351 | + .func = "SymSearch", | |
359 | 352 | .key = F_SEARCH, |
360 | 353 | .handler = handle_f8, |
361 | 354 | }, |
... | ... | @@ -392,7 +385,7 @@ |
392 | 385 | static void handle_f1(int *key, struct menu *current_item) |
393 | 386 | { |
394 | 387 | show_scroll_win(main_window, |
395 | - _("README"), _(nconf_readme)); | |
388 | + _("Global help"), _(nconf_global_help)); | |
396 | 389 | return; |
397 | 390 | } |
398 | 391 | |
... | ... | @@ -407,7 +400,7 @@ |
407 | 400 | static void handle_f3(int *key, struct menu *current_item) |
408 | 401 | { |
409 | 402 | show_scroll_win(main_window, |
410 | - _("Instructions"), | |
403 | + _("Short help"), | |
411 | 404 | _(current_instructions)); |
412 | 405 | return; |
413 | 406 | } |
414 | 407 | |
415 | 408 | |
... | ... | @@ -696,13 +689,18 @@ |
696 | 689 | { |
697 | 690 | struct symbol **sym_arr; |
698 | 691 | struct gstr res; |
692 | + struct gstr title; | |
699 | 693 | char *dialog_input; |
700 | 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 | + | |
701 | 700 | again: |
702 | 701 | dres = dialog_inputbox(main_window, |
703 | 702 | _("Search Configuration Parameter"), |
704 | - _("Enter " CONFIG_ " (sub)string to search for " | |
705 | - "(with or without \"" CONFIG_ "\")"), | |
703 | + str_get(&title), | |
706 | 704 | "", &dialog_input_result, &dialog_input_result_len); |
707 | 705 | switch (dres) { |
708 | 706 | case 0: |
... | ... | @@ -712,6 +710,7 @@ |
712 | 710 | _("Search Configuration"), search_help); |
713 | 711 | goto again; |
714 | 712 | default: |
713 | + str_free(&title); | |
715 | 714 | return; |
716 | 715 | } |
717 | 716 | |
... | ... | @@ -726,6 +725,7 @@ |
726 | 725 | show_scroll_win(main_window, |
727 | 726 | _("Search Results"), str_get(&res)); |
728 | 727 | str_free(&res); |
728 | + str_free(&title); | |
729 | 729 | } |
730 | 730 | |
731 | 731 |
scripts/kconfig/nconf.gui.c
scripts/kconfig/qconf.cc
scripts/kconfig/symbol.c
... | ... | @@ -656,11 +656,11 @@ |
656 | 656 | size = strlen(newval) + 1; |
657 | 657 | if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { |
658 | 658 | size += 2; |
659 | - sym->def[S_DEF_USER].val = val = malloc(size); | |
659 | + sym->def[S_DEF_USER].val = val = xmalloc(size); | |
660 | 660 | *val++ = '0'; |
661 | 661 | *val++ = 'x'; |
662 | 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 | 664 | else |
665 | 665 | return true; |
666 | 666 | |
... | ... | @@ -812,7 +812,7 @@ |
812 | 812 | hash = 0; |
813 | 813 | } |
814 | 814 | |
815 | - symbol = malloc(sizeof(*symbol)); | |
815 | + symbol = xmalloc(sizeof(*symbol)); | |
816 | 816 | memset(symbol, 0, sizeof(*symbol)); |
817 | 817 | symbol->name = new_name; |
818 | 818 | symbol->type = S_UNKNOWN; |
... | ... | @@ -863,7 +863,7 @@ |
863 | 863 | size_t reslen; |
864 | 864 | |
865 | 865 | reslen = strlen(in) + 1; |
866 | - res = malloc(reslen); | |
866 | + res = xmalloc(reslen); | |
867 | 867 | res[0] = '\0'; |
868 | 868 | |
869 | 869 | while ((src = strchr(in, '$'))) { |
... | ... | @@ -921,7 +921,7 @@ |
921 | 921 | p++; |
922 | 922 | } |
923 | 923 | |
924 | - res = malloc(reslen); | |
924 | + res = xmalloc(reslen); | |
925 | 925 | res[0] = '\0'; |
926 | 926 | |
927 | 927 | strcat(res, "\""); |
... | ... | @@ -1228,7 +1228,7 @@ |
1228 | 1228 | struct property *prop; |
1229 | 1229 | struct property **propp; |
1230 | 1230 | |
1231 | - prop = malloc(sizeof(*prop)); | |
1231 | + prop = xmalloc(sizeof(*prop)); | |
1232 | 1232 | memset(prop, 0, sizeof(*prop)); |
1233 | 1233 | prop->type = type; |
1234 | 1234 | prop->sym = sym; |
scripts/kconfig/util.c
... | ... | @@ -23,7 +23,7 @@ |
23 | 23 | } |
24 | 24 | } |
25 | 25 | |
26 | - file = malloc(sizeof(*file)); | |
26 | + file = xmalloc(sizeof(*file)); | |
27 | 27 | memset(file, 0, sizeof(*file)); |
28 | 28 | file->name = file_name; |
29 | 29 | file->next = file_list; |
... | ... | @@ -81,7 +81,7 @@ |
81 | 81 | struct gstr str_new(void) |
82 | 82 | { |
83 | 83 | struct gstr gs; |
84 | - gs.s = malloc(sizeof(char) * 64); | |
84 | + gs.s = xmalloc(sizeof(char) * 64); | |
85 | 85 | gs.len = 64; |
86 | 86 | gs.max_width = 0; |
87 | 87 | strcpy(gs.s, "\0"); |
... | ... | @@ -136,5 +136,23 @@ |
136 | 136 | const char *str_get(struct gstr *gs) |
137 | 137 | { |
138 | 138 | return gs->s; |
139 | +} | |
140 | + | |
141 | +void *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 | + | |
150 | +void *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); | |
139 | 157 | } |
scripts/kconfig/zconf.l
... | ... | @@ -40,7 +40,7 @@ |
40 | 40 | |
41 | 41 | static void new_string(void) |
42 | 42 | { |
43 | - text = malloc(START_STRSIZE); | |
43 | + text = xmalloc(START_STRSIZE); | |
44 | 44 | text_asize = START_STRSIZE; |
45 | 45 | text_size = 0; |
46 | 46 | *text = 0; |
... | ... | @@ -62,7 +62,7 @@ |
62 | 62 | |
63 | 63 | static void alloc_string(const char *str, int size) |
64 | 64 | { |
65 | - text = malloc(size + 1); | |
65 | + text = xmalloc(size + 1); | |
66 | 66 | memcpy(text, str, size); |
67 | 67 | text[size] = 0; |
68 | 68 | } |
... | ... | @@ -288,7 +288,7 @@ |
288 | 288 | exit(1); |
289 | 289 | } |
290 | 290 | |
291 | - current_buf = malloc(sizeof(*current_buf)); | |
291 | + current_buf = xmalloc(sizeof(*current_buf)); | |
292 | 292 | memset(current_buf, 0, sizeof(*current_buf)); |
293 | 293 | |
294 | 294 | current_file = file_lookup(name); |
... | ... | @@ -299,7 +299,7 @@ |
299 | 299 | { |
300 | 300 | struct file *iter; |
301 | 301 | struct file *file = file_lookup(name); |
302 | - struct buffer *buf = malloc(sizeof(*buf)); | |
302 | + struct buffer *buf = xmalloc(sizeof(*buf)); | |
303 | 303 | memset(buf, 0, sizeof(*buf)); |
304 | 304 | |
305 | 305 | current_buf->state = YY_CURRENT_BUFFER; |
scripts/kconfig/zconf.lex.c_shipped
... | ... | @@ -802,7 +802,7 @@ |
802 | 802 | |
803 | 803 | static void new_string(void) |
804 | 804 | { |
805 | - text = malloc(START_STRSIZE); | |
805 | + text = xmalloc(START_STRSIZE); | |
806 | 806 | text_asize = START_STRSIZE; |
807 | 807 | text_size = 0; |
808 | 808 | *text = 0; |
... | ... | @@ -824,7 +824,7 @@ |
824 | 824 | |
825 | 825 | static void alloc_string(const char *str, int size) |
826 | 826 | { |
827 | - text = malloc(size + 1); | |
827 | + text = xmalloc(size + 1); | |
828 | 828 | memcpy(text, str, size); |
829 | 829 | text[size] = 0; |
830 | 830 | } |
... | ... | @@ -2343,7 +2343,7 @@ |
2343 | 2343 | exit(1); |
2344 | 2344 | } |
2345 | 2345 | |
2346 | - current_buf = malloc(sizeof(*current_buf)); | |
2346 | + current_buf = xmalloc(sizeof(*current_buf)); | |
2347 | 2347 | memset(current_buf, 0, sizeof(*current_buf)); |
2348 | 2348 | |
2349 | 2349 | current_file = file_lookup(name); |
... | ... | @@ -2354,7 +2354,7 @@ |
2354 | 2354 | { |
2355 | 2355 | struct file *iter; |
2356 | 2356 | struct file *file = file_lookup(name); |
2357 | - struct buffer *buf = malloc(sizeof(*buf)); | |
2357 | + struct buffer *buf = xmalloc(sizeof(*buf)); | |
2358 | 2358 | memset(buf, 0, sizeof(*buf)); |
2359 | 2359 | |
2360 | 2360 | current_buf->state = YY_CURRENT_BUFFER; |