blob: bd2a27e1967aca1baaa1a71d970e30bc2ff0029d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
3 * Released under the terms of the GNU GPL v2.0.
4 */
5
EGRY Gabor534a4502008-01-11 23:44:39 +01006#include <locale.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07007#include <ctype.h>
Randy Dunlap9dfb5632006-04-18 22:21:53 -07008#include <stdio.h>
Ladislav Michl75ff4302008-01-09 16:36:19 +01009#include <stdlib.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070010#include <string.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011#include <time.h>
Ladislav Michl75ff4302008-01-09 16:36:19 +010012#include <unistd.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <sys/stat.h>
14
15#define LKC_DIRECT_LINK
16#include "lkc.h"
17
18static void conf(struct menu *menu);
19static void check_conf(struct menu *menu);
20
21enum {
22 ask_all,
23 ask_new,
24 ask_silent,
25 set_default,
26 set_yes,
27 set_mod,
28 set_no,
29 set_random
30} input_mode = ask_all;
31char *defconfig_file;
32
33static int indent = 1;
34static int valid_stdin = 1;
35static int conf_cnt;
J.A. Magallon48b9d032005-06-25 14:59:22 -070036static char line[128];
Linus Torvalds1da177e2005-04-16 15:20:36 -070037static struct menu *rootEntry;
38
Arnaldo Carvalho de Melo3b9fa092005-05-05 15:09:46 -070039static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -070040
Sam Ravnborg03d29122007-07-21 00:00:36 +020041static const char *get_help(struct menu *menu)
42{
43 if (menu_has_help(menu))
EGRY Gabor534a4502008-01-11 23:44:39 +010044 return _(menu_get_help(menu));
Sam Ravnborg03d29122007-07-21 00:00:36 +020045 else
46 return nohelp_text;
47}
48
J.A. Magallon48b9d032005-06-25 14:59:22 -070049static void strip(char *str)
Linus Torvalds1da177e2005-04-16 15:20:36 -070050{
J.A. Magallon48b9d032005-06-25 14:59:22 -070051 char *p = str;
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 int l;
53
54 while ((isspace(*p)))
55 p++;
56 l = strlen(p);
57 if (p != str)
58 memmove(str, p, l + 1);
59 if (!l)
60 return;
61 p = str + l - 1;
62 while ((isspace(*p)))
63 *p-- = 0;
64}
65
66static void check_stdin(void)
67{
68 if (!valid_stdin && input_mode == ask_silent) {
Arnaldo Carvalho de Melo3b9fa092005-05-05 15:09:46 -070069 printf(_("aborted!\n\n"));
70 printf(_("Console input/output is redirected. "));
71 printf(_("Run 'make oldconfig' to update configuration.\n\n"));
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 exit(1);
73 }
74}
75
Roman Zippelf82f3f92007-08-30 05:06:17 +020076static int conf_askvalue(struct symbol *sym, const char *def)
Linus Torvalds1da177e2005-04-16 15:20:36 -070077{
78 enum symbol_type type = sym_get_type(sym);
Linus Torvalds1da177e2005-04-16 15:20:36 -070079
80 if (!sym_has_value(sym))
EGRY Gabor534a4502008-01-11 23:44:39 +010081 printf(_("(NEW) "));
Linus Torvalds1da177e2005-04-16 15:20:36 -070082
83 line[0] = '\n';
84 line[1] = 0;
85
86 if (!sym_is_changable(sym)) {
87 printf("%s\n", def);
88 line[0] = '\n';
89 line[1] = 0;
Roman Zippelf82f3f92007-08-30 05:06:17 +020090 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070091 }
92
93 switch (input_mode) {
94 case ask_new:
95 case ask_silent:
96 if (sym_has_value(sym)) {
97 printf("%s\n", def);
Roman Zippelf82f3f92007-08-30 05:06:17 +020098 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070099 }
100 check_stdin();
101 case ask_all:
102 fflush(stdout);
Roman Zippel59c6a3f2006-04-09 17:26:50 +0200103 fgets(line, 128, stdin);
Roman Zippelf82f3f92007-08-30 05:06:17 +0200104 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700105 case set_default:
106 printf("%s\n", def);
Roman Zippelf82f3f92007-08-30 05:06:17 +0200107 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 default:
109 break;
110 }
111
112 switch (type) {
113 case S_INT:
114 case S_HEX:
115 case S_STRING:
116 printf("%s\n", def);
Roman Zippelf82f3f92007-08-30 05:06:17 +0200117 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 default:
119 ;
120 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700121 printf("%s", line);
Roman Zippelf82f3f92007-08-30 05:06:17 +0200122 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700123}
124
125int conf_string(struct menu *menu)
126{
127 struct symbol *sym = menu->sym;
Sam Ravnborg03d29122007-07-21 00:00:36 +0200128 const char *def;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129
130 while (1) {
EGRY Gabor534a4502008-01-11 23:44:39 +0100131 printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 printf("(%s) ", sym->name);
133 def = sym_get_string_value(sym);
134 if (sym_get_string_value(sym))
135 printf("[%s] ", def);
Roman Zippelf82f3f92007-08-30 05:06:17 +0200136 if (!conf_askvalue(sym, def))
137 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 switch (line[0]) {
139 case '\n':
140 break;
141 case '?':
142 /* print help */
143 if (line[1] == '\n') {
Sam Ravnborg03d29122007-07-21 00:00:36 +0200144 printf("\n%s\n", get_help(menu));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700145 def = NULL;
146 break;
147 }
148 default:
149 line[strlen(line)-1] = 0;
150 def = line;
151 }
152 if (def && sym_set_string_value(sym, def))
153 return 0;
154 }
155}
156
157static int conf_sym(struct menu *menu)
158{
159 struct symbol *sym = menu->sym;
160 int type;
161 tristate oldval, newval;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162
163 while (1) {
EGRY Gabor534a4502008-01-11 23:44:39 +0100164 printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700165 if (sym->name)
166 printf("(%s) ", sym->name);
167 type = sym_get_type(sym);
168 putchar('[');
169 oldval = sym_get_tristate_value(sym);
170 switch (oldval) {
171 case no:
172 putchar('N');
173 break;
174 case mod:
175 putchar('M');
176 break;
177 case yes:
178 putchar('Y');
179 break;
180 }
181 if (oldval != no && sym_tristate_within_range(sym, no))
182 printf("/n");
183 if (oldval != mod && sym_tristate_within_range(sym, mod))
184 printf("/m");
185 if (oldval != yes && sym_tristate_within_range(sym, yes))
186 printf("/y");
Sam Ravnborg03d29122007-07-21 00:00:36 +0200187 if (menu_has_help(menu))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700188 printf("/?");
189 printf("] ");
Roman Zippelf82f3f92007-08-30 05:06:17 +0200190 if (!conf_askvalue(sym, sym_get_string_value(sym)))
191 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700192 strip(line);
193
194 switch (line[0]) {
195 case 'n':
196 case 'N':
197 newval = no;
198 if (!line[1] || !strcmp(&line[1], "o"))
199 break;
200 continue;
201 case 'm':
202 case 'M':
203 newval = mod;
204 if (!line[1])
205 break;
206 continue;
207 case 'y':
208 case 'Y':
209 newval = yes;
210 if (!line[1] || !strcmp(&line[1], "es"))
211 break;
212 continue;
213 case 0:
214 newval = oldval;
215 break;
216 case '?':
217 goto help;
218 default:
219 continue;
220 }
221 if (sym_set_tristate_value(sym, newval))
222 return 0;
223help:
Sam Ravnborg03d29122007-07-21 00:00:36 +0200224 printf("\n%s\n", get_help(menu));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225 }
226}
227
228static int conf_choice(struct menu *menu)
229{
230 struct symbol *sym, *def_sym;
231 struct menu *child;
232 int type;
233 bool is_new;
234
235 sym = menu->sym;
236 type = sym_get_type(sym);
237 is_new = !sym_has_value(sym);
238 if (sym_is_changable(sym)) {
239 conf_sym(menu);
240 sym_calc_value(sym);
241 switch (sym_get_tristate_value(sym)) {
242 case no:
243 return 1;
244 case mod:
245 return 0;
246 case yes:
247 break;
248 }
249 } else {
250 switch (sym_get_tristate_value(sym)) {
251 case no:
252 return 1;
253 case mod:
EGRY Gabor534a4502008-01-11 23:44:39 +0100254 printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700255 return 0;
256 case yes:
257 break;
258 }
259 }
260
261 while (1) {
262 int cnt, def;
263
EGRY Gabor534a4502008-01-11 23:44:39 +0100264 printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265 def_sym = sym_get_choice_value(sym);
266 cnt = def = 0;
Roman Zippel40aee722006-04-09 17:26:39 +0200267 line[0] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700268 for (child = menu->list; child; child = child->next) {
269 if (!menu_is_visible(child))
270 continue;
271 if (!child->sym) {
EGRY Gabor534a4502008-01-11 23:44:39 +0100272 printf("%*c %s\n", indent, '*', _(menu_get_prompt(child)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700273 continue;
274 }
275 cnt++;
276 if (child->sym == def_sym) {
277 def = cnt;
278 printf("%*c", indent, '>');
279 } else
280 printf("%*c", indent, ' ');
EGRY Gabor534a4502008-01-11 23:44:39 +0100281 printf(" %d. %s", cnt, _(menu_get_prompt(child)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282 if (child->sym->name)
283 printf(" (%s)", child->sym->name);
284 if (!sym_has_value(child->sym))
EGRY Gabor534a4502008-01-11 23:44:39 +0100285 printf(_(" (NEW)"));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286 printf("\n");
287 }
EGRY Gabor534a4502008-01-11 23:44:39 +0100288 printf(_("%*schoice"), indent - 1, "");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700289 if (cnt == 1) {
290 printf("[1]: 1\n");
291 goto conf_childs;
292 }
293 printf("[1-%d", cnt);
Sam Ravnborg03d29122007-07-21 00:00:36 +0200294 if (menu_has_help(menu))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295 printf("?");
296 printf("]: ");
297 switch (input_mode) {
298 case ask_new:
299 case ask_silent:
300 if (!is_new) {
301 cnt = def;
302 printf("%d\n", cnt);
303 break;
304 }
305 check_stdin();
306 case ask_all:
307 fflush(stdout);
Roman Zippel59c6a3f2006-04-09 17:26:50 +0200308 fgets(line, 128, stdin);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309 strip(line);
310 if (line[0] == '?') {
Sam Ravnborg03d29122007-07-21 00:00:36 +0200311 printf("\n%s\n", get_help(menu));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 continue;
313 }
314 if (!line[0])
315 cnt = def;
316 else if (isdigit(line[0]))
317 cnt = atoi(line);
318 else
319 continue;
320 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700321 case set_default:
Linus Torvalds1da177e2005-04-16 15:20:36 -0700322 cnt = def;
323 printf("%d\n", cnt);
324 break;
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200325 default:
326 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700327 }
328
329 conf_childs:
330 for (child = menu->list; child; child = child->next) {
331 if (!child->sym || !menu_is_visible(child))
332 continue;
333 if (!--cnt)
334 break;
335 }
336 if (!child)
337 continue;
338 if (line[strlen(line) - 1] == '?') {
Sam Ravnborg03d29122007-07-21 00:00:36 +0200339 printf("\n%s\n", get_help(child));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700340 continue;
341 }
342 sym_set_choice_value(sym, child->sym);
Jan Beulichf5eaa322008-01-24 11:54:23 +0000343 for (child = child->list; child; child = child->next) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700344 indent += 2;
Jan Beulichf5eaa322008-01-24 11:54:23 +0000345 conf(child);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700346 indent -= 2;
347 }
348 return 1;
349 }
350}
351
352static void conf(struct menu *menu)
353{
354 struct symbol *sym;
355 struct property *prop;
356 struct menu *child;
357
358 if (!menu_is_visible(menu))
359 return;
360
361 sym = menu->sym;
362 prop = menu->prompt;
363 if (prop) {
364 const char *prompt;
365
366 switch (prop->type) {
367 case P_MENU:
368 if (input_mode == ask_silent && rootEntry != menu) {
369 check_conf(menu);
370 return;
371 }
372 case P_COMMENT:
373 prompt = menu_get_prompt(menu);
374 if (prompt)
375 printf("%*c\n%*c %s\n%*c\n",
376 indent, '*',
EGRY Gabor534a4502008-01-11 23:44:39 +0100377 indent, '*', _(prompt),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700378 indent, '*');
379 default:
380 ;
381 }
382 }
383
384 if (!sym)
385 goto conf_childs;
386
387 if (sym_is_choice(sym)) {
388 conf_choice(menu);
389 if (sym->curr.tri != mod)
390 return;
391 goto conf_childs;
392 }
393
394 switch (sym->type) {
395 case S_INT:
396 case S_HEX:
397 case S_STRING:
398 conf_string(menu);
399 break;
400 default:
401 conf_sym(menu);
402 break;
403 }
404
405conf_childs:
406 if (sym)
407 indent += 2;
408 for (child = menu->list; child; child = child->next)
409 conf(child);
410 if (sym)
411 indent -= 2;
412}
413
414static void check_conf(struct menu *menu)
415{
416 struct symbol *sym;
417 struct menu *child;
418
419 if (!menu_is_visible(menu))
420 return;
421
422 sym = menu->sym;
Roman Zippel3f23ca22005-11-08 21:34:48 -0800423 if (sym && !sym_has_value(sym)) {
424 if (sym_is_changable(sym) ||
425 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700426 if (!conf_cnt++)
Arnaldo Carvalho de Melo3b9fa092005-05-05 15:09:46 -0700427 printf(_("*\n* Restart config...\n*\n"));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700428 rootEntry = menu_get_parent_menu(menu);
429 conf(rootEntry);
430 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431 }
432
433 for (child = menu->list; child; child = child->next)
434 check_conf(child);
435}
436
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200437static void conf_do_update(void)
438{
439 /* Update until a loop caused no more changes */
440 do {
441 conf_cnt = 0;
442 check_conf(&rootmenu);
443 } while (conf_cnt);
444}
445
446static int conf_silent_update(void)
447{
448 const char *name;
449
450 if (conf_get_changed()) {
451 name = getenv("KCONFIG_NOSILENTUPDATE");
452 if (name && *name) {
453 fprintf(stderr,
454 _("\n*** Kernel configuration requires explicit update.\n\n"));
455 return 1;
456 }
457 conf_do_update();
458 }
459 return 0;
460}
461
462static int conf_update(void)
463{
464 rootEntry = &rootmenu;
465 conf(&rootmenu);
466 if (input_mode == ask_all) {
467 input_mode = ask_silent;
468 valid_stdin = 1;
469 }
470 conf_do_update();
471 return 0;
472}
473
Linus Torvalds1da177e2005-04-16 15:20:36 -0700474int main(int ac, char **av)
475{
Andres Salomon2f4b4892007-12-17 01:34:58 -0500476 int opt;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700477 const char *name;
478 struct stat tmpstat;
479
EGRY Gabor534a4502008-01-11 23:44:39 +0100480 setlocale(LC_ALL, "");
481 bindtextdomain(PACKAGE, LOCALEDIR);
482 textdomain(PACKAGE);
483
Andres Salomon2f4b4892007-12-17 01:34:58 -0500484 while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
485 switch (opt) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700486 case 'o':
487 input_mode = ask_new;
488 break;
489 case 's':
490 input_mode = ask_silent;
491 valid_stdin = isatty(0) && isatty(1) && isatty(2);
492 break;
493 case 'd':
494 input_mode = set_default;
495 break;
496 case 'D':
497 input_mode = set_default;
Andres Salomon2f4b4892007-12-17 01:34:58 -0500498 defconfig_file = optarg;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700499 break;
500 case 'n':
501 input_mode = set_no;
502 break;
503 case 'm':
504 input_mode = set_mod;
505 break;
506 case 'y':
507 input_mode = set_yes;
508 break;
509 case 'r':
510 input_mode = set_random;
Ladislav Michl07f76682008-01-09 16:36:19 +0100511 srand(time(NULL));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700512 break;
513 case 'h':
EGRY Gabor534a4502008-01-11 23:44:39 +0100514 printf(_("See README for usage info\n"));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 exit(0);
Andres Salomon2f4b4892007-12-17 01:34:58 -0500516 break;
517 default:
EGRY Gabor534a4502008-01-11 23:44:39 +0100518 fprintf(stderr, _("See README for usage info\n"));
Andres Salomon2f4b4892007-12-17 01:34:58 -0500519 exit(1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 }
521 }
Andres Salomon2f4b4892007-12-17 01:34:58 -0500522 if (ac == optind) {
Arnaldo Carvalho de Melo3b9fa092005-05-05 15:09:46 -0700523 printf(_("%s: Kconfig file missing\n"), av[0]);
Randy Dunlap250725a2006-06-08 22:12:50 -0700524 exit(1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700525 }
Andres Salomon2f4b4892007-12-17 01:34:58 -0500526 name = av[optind];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700527 conf_parse(name);
528 //zconfdump(stdout);
529 switch (input_mode) {
530 case set_default:
531 if (!defconfig_file)
532 defconfig_file = conf_get_default_confname();
533 if (conf_read(defconfig_file)) {
EGRY Gabor534a4502008-01-11 23:44:39 +0100534 printf(_("***\n"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700535 "*** Can't find default configuration \"%s\"!\n"
EGRY Gabor534a4502008-01-11 23:44:39 +0100536 "***\n"), defconfig_file);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700537 exit(1);
538 }
539 break;
540 case ask_silent:
541 if (stat(".config", &tmpstat)) {
Arnaldo Carvalho de Melo3b9fa092005-05-05 15:09:46 -0700542 printf(_("***\n"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700543 "*** You have not yet configured your kernel!\n"
Randy Dunlap7ac1c142007-04-04 21:58:41 -0700544 "*** (missing kernel .config file)\n"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 "***\n"
546 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
547 "*** \"make menuconfig\" or \"make xconfig\").\n"
Arnaldo Carvalho de Melo3b9fa092005-05-05 15:09:46 -0700548 "***\n"));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700549 exit(1);
550 }
551 case ask_all:
552 case ask_new:
553 conf_read(NULL);
554 break;
Roman Zippel90389162005-11-08 21:34:49 -0800555 case set_no:
556 case set_mod:
557 case set_yes:
558 case set_random:
559 name = getenv("KCONFIG_ALLCONFIG");
560 if (name && !stat(name, &tmpstat)) {
Roman Zippel669bfad2006-06-08 22:12:42 -0700561 conf_read_simple(name, S_DEF_USER);
Roman Zippel90389162005-11-08 21:34:49 -0800562 break;
563 }
564 switch (input_mode) {
565 case set_no: name = "allno.config"; break;
566 case set_mod: name = "allmod.config"; break;
567 case set_yes: name = "allyes.config"; break;
568 case set_random: name = "allrandom.config"; break;
569 default: break;
570 }
571 if (!stat(name, &tmpstat))
Roman Zippel669bfad2006-06-08 22:12:42 -0700572 conf_read_simple(name, S_DEF_USER);
Roman Zippel90389162005-11-08 21:34:49 -0800573 else if (!stat("all.config", &tmpstat))
Roman Zippel669bfad2006-06-08 22:12:42 -0700574 conf_read_simple("all.config", S_DEF_USER);
Roman Zippel90389162005-11-08 21:34:49 -0800575 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700576 default:
577 break;
578 }
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200579 switch (input_mode) {
580 case set_no:
581 conf_set_all_new_symbols(def_no);
582 break;
583 case set_yes:
584 conf_set_all_new_symbols(def_yes);
585 break;
586 case set_mod:
587 conf_set_all_new_symbols(def_mod);
588 break;
589 case set_random:
590 conf_set_all_new_symbols(def_random);
591 break;
592 case ask_silent:
593 if (conf_silent_update())
594 exit(1);
595 break;
596 case ask_new:
597 case ask_all:
598 case set_default:
599 if (conf_update())
600 exit(1);
601 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700602 }
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200603
604 if (conf_get_changed() && conf_write(NULL)) {
605 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
606 exit(1);
607 }
608 /* ask_silent is used during the build so we shall update autoconf.
609 * All other commands are only used to generate a config.
610 */
Roman Zippelc955cca2006-06-08 22:12:39 -0700611 if (input_mode == ask_silent && conf_write_autoconf()) {
612 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
613 return 1;
614 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700615 return 0;
616}