blob: 36b5eedcdc7518d9dc734078c2287e16cca9f4d0 [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 default:
106 break;
107 }
108
109 switch (type) {
110 case S_INT:
111 case S_HEX:
112 case S_STRING:
113 printf("%s\n", def);
Roman Zippelf82f3f92007-08-30 05:06:17 +0200114 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 default:
116 ;
117 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700118 printf("%s", line);
Roman Zippelf82f3f92007-08-30 05:06:17 +0200119 return 1;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120}
121
122int conf_string(struct menu *menu)
123{
124 struct symbol *sym = menu->sym;
Sam Ravnborg03d29122007-07-21 00:00:36 +0200125 const char *def;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700126
127 while (1) {
EGRY Gabor534a4502008-01-11 23:44:39 +0100128 printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700129 printf("(%s) ", sym->name);
130 def = sym_get_string_value(sym);
131 if (sym_get_string_value(sym))
132 printf("[%s] ", def);
Roman Zippelf82f3f92007-08-30 05:06:17 +0200133 if (!conf_askvalue(sym, def))
134 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700135 switch (line[0]) {
136 case '\n':
137 break;
138 case '?':
139 /* print help */
140 if (line[1] == '\n') {
Sam Ravnborg03d29122007-07-21 00:00:36 +0200141 printf("\n%s\n", get_help(menu));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 def = NULL;
143 break;
144 }
145 default:
146 line[strlen(line)-1] = 0;
147 def = line;
148 }
149 if (def && sym_set_string_value(sym, def))
150 return 0;
151 }
152}
153
154static int conf_sym(struct menu *menu)
155{
156 struct symbol *sym = menu->sym;
157 int type;
158 tristate oldval, newval;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700159
160 while (1) {
EGRY Gabor534a4502008-01-11 23:44:39 +0100161 printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700162 if (sym->name)
163 printf("(%s) ", sym->name);
164 type = sym_get_type(sym);
165 putchar('[');
166 oldval = sym_get_tristate_value(sym);
167 switch (oldval) {
168 case no:
169 putchar('N');
170 break;
171 case mod:
172 putchar('M');
173 break;
174 case yes:
175 putchar('Y');
176 break;
177 }
178 if (oldval != no && sym_tristate_within_range(sym, no))
179 printf("/n");
180 if (oldval != mod && sym_tristate_within_range(sym, mod))
181 printf("/m");
182 if (oldval != yes && sym_tristate_within_range(sym, yes))
183 printf("/y");
Sam Ravnborg03d29122007-07-21 00:00:36 +0200184 if (menu_has_help(menu))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700185 printf("/?");
186 printf("] ");
Roman Zippelf82f3f92007-08-30 05:06:17 +0200187 if (!conf_askvalue(sym, sym_get_string_value(sym)))
188 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700189 strip(line);
190
191 switch (line[0]) {
192 case 'n':
193 case 'N':
194 newval = no;
195 if (!line[1] || !strcmp(&line[1], "o"))
196 break;
197 continue;
198 case 'm':
199 case 'M':
200 newval = mod;
201 if (!line[1])
202 break;
203 continue;
204 case 'y':
205 case 'Y':
206 newval = yes;
207 if (!line[1] || !strcmp(&line[1], "es"))
208 break;
209 continue;
210 case 0:
211 newval = oldval;
212 break;
213 case '?':
214 goto help;
215 default:
216 continue;
217 }
218 if (sym_set_tristate_value(sym, newval))
219 return 0;
220help:
Sam Ravnborg03d29122007-07-21 00:00:36 +0200221 printf("\n%s\n", get_help(menu));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 }
223}
224
225static int conf_choice(struct menu *menu)
226{
227 struct symbol *sym, *def_sym;
228 struct menu *child;
229 int type;
230 bool is_new;
231
232 sym = menu->sym;
233 type = sym_get_type(sym);
234 is_new = !sym_has_value(sym);
235 if (sym_is_changable(sym)) {
236 conf_sym(menu);
237 sym_calc_value(sym);
238 switch (sym_get_tristate_value(sym)) {
239 case no:
240 return 1;
241 case mod:
242 return 0;
243 case yes:
244 break;
245 }
246 } else {
247 switch (sym_get_tristate_value(sym)) {
248 case no:
249 return 1;
250 case mod:
EGRY Gabor534a4502008-01-11 23:44:39 +0100251 printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700252 return 0;
253 case yes:
254 break;
255 }
256 }
257
258 while (1) {
259 int cnt, def;
260
EGRY Gabor534a4502008-01-11 23:44:39 +0100261 printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262 def_sym = sym_get_choice_value(sym);
263 cnt = def = 0;
Roman Zippel40aee722006-04-09 17:26:39 +0200264 line[0] = 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700265 for (child = menu->list; child; child = child->next) {
266 if (!menu_is_visible(child))
267 continue;
268 if (!child->sym) {
EGRY Gabor534a4502008-01-11 23:44:39 +0100269 printf("%*c %s\n", indent, '*', _(menu_get_prompt(child)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700270 continue;
271 }
272 cnt++;
273 if (child->sym == def_sym) {
274 def = cnt;
275 printf("%*c", indent, '>');
276 } else
277 printf("%*c", indent, ' ');
EGRY Gabor534a4502008-01-11 23:44:39 +0100278 printf(" %d. %s", cnt, _(menu_get_prompt(child)));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279 if (child->sym->name)
280 printf(" (%s)", child->sym->name);
281 if (!sym_has_value(child->sym))
EGRY Gabor534a4502008-01-11 23:44:39 +0100282 printf(_(" (NEW)"));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700283 printf("\n");
284 }
EGRY Gabor534a4502008-01-11 23:44:39 +0100285 printf(_("%*schoice"), indent - 1, "");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700286 if (cnt == 1) {
287 printf("[1]: 1\n");
288 goto conf_childs;
289 }
290 printf("[1-%d", cnt);
Sam Ravnborg03d29122007-07-21 00:00:36 +0200291 if (menu_has_help(menu))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700292 printf("?");
293 printf("]: ");
294 switch (input_mode) {
295 case ask_new:
296 case ask_silent:
297 if (!is_new) {
298 cnt = def;
299 printf("%d\n", cnt);
300 break;
301 }
302 check_stdin();
303 case ask_all:
304 fflush(stdout);
Roman Zippel59c6a3f2006-04-09 17:26:50 +0200305 fgets(line, 128, stdin);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700306 strip(line);
307 if (line[0] == '?') {
Sam Ravnborg03d29122007-07-21 00:00:36 +0200308 printf("\n%s\n", get_help(menu));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309 continue;
310 }
311 if (!line[0])
312 cnt = def;
313 else if (isdigit(line[0]))
314 cnt = atoi(line);
315 else
316 continue;
317 break;
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200318 default:
319 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700320 }
321
322 conf_childs:
323 for (child = menu->list; child; child = child->next) {
324 if (!child->sym || !menu_is_visible(child))
325 continue;
326 if (!--cnt)
327 break;
328 }
329 if (!child)
330 continue;
331 if (line[strlen(line) - 1] == '?') {
Sam Ravnborg03d29122007-07-21 00:00:36 +0200332 printf("\n%s\n", get_help(child));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700333 continue;
334 }
335 sym_set_choice_value(sym, child->sym);
Jan Beulichf5eaa322008-01-24 11:54:23 +0000336 for (child = child->list; child; child = child->next) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700337 indent += 2;
Jan Beulichf5eaa322008-01-24 11:54:23 +0000338 conf(child);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700339 indent -= 2;
340 }
341 return 1;
342 }
343}
344
345static void conf(struct menu *menu)
346{
347 struct symbol *sym;
348 struct property *prop;
349 struct menu *child;
350
351 if (!menu_is_visible(menu))
352 return;
353
354 sym = menu->sym;
355 prop = menu->prompt;
356 if (prop) {
357 const char *prompt;
358
359 switch (prop->type) {
360 case P_MENU:
361 if (input_mode == ask_silent && rootEntry != menu) {
362 check_conf(menu);
363 return;
364 }
365 case P_COMMENT:
366 prompt = menu_get_prompt(menu);
367 if (prompt)
368 printf("%*c\n%*c %s\n%*c\n",
369 indent, '*',
EGRY Gabor534a4502008-01-11 23:44:39 +0100370 indent, '*', _(prompt),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700371 indent, '*');
372 default:
373 ;
374 }
375 }
376
377 if (!sym)
378 goto conf_childs;
379
380 if (sym_is_choice(sym)) {
381 conf_choice(menu);
382 if (sym->curr.tri != mod)
383 return;
384 goto conf_childs;
385 }
386
387 switch (sym->type) {
388 case S_INT:
389 case S_HEX:
390 case S_STRING:
391 conf_string(menu);
392 break;
393 default:
394 conf_sym(menu);
395 break;
396 }
397
398conf_childs:
399 if (sym)
400 indent += 2;
401 for (child = menu->list; child; child = child->next)
402 conf(child);
403 if (sym)
404 indent -= 2;
405}
406
407static void check_conf(struct menu *menu)
408{
409 struct symbol *sym;
410 struct menu *child;
411
412 if (!menu_is_visible(menu))
413 return;
414
415 sym = menu->sym;
Roman Zippel3f23ca22005-11-08 21:34:48 -0800416 if (sym && !sym_has_value(sym)) {
417 if (sym_is_changable(sym) ||
418 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700419 if (!conf_cnt++)
Arnaldo Carvalho de Melo3b9fa092005-05-05 15:09:46 -0700420 printf(_("*\n* Restart config...\n*\n"));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700421 rootEntry = menu_get_parent_menu(menu);
422 conf(rootEntry);
423 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700424 }
425
426 for (child = menu->list; child; child = child->next)
427 check_conf(child);
428}
429
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200430static void conf_do_update(void)
431{
432 /* Update until a loop caused no more changes */
433 do {
434 conf_cnt = 0;
435 check_conf(&rootmenu);
436 } while (conf_cnt);
437}
438
439static int conf_silent_update(void)
440{
441 const char *name;
442
443 if (conf_get_changed()) {
444 name = getenv("KCONFIG_NOSILENTUPDATE");
445 if (name && *name) {
446 fprintf(stderr,
447 _("\n*** Kernel configuration requires explicit update.\n\n"));
448 return 1;
449 }
450 conf_do_update();
451 }
452 return 0;
453}
454
455static int conf_update(void)
456{
457 rootEntry = &rootmenu;
458 conf(&rootmenu);
459 if (input_mode == ask_all) {
460 input_mode = ask_silent;
461 valid_stdin = 1;
462 }
463 conf_do_update();
464 return 0;
465}
466
Linus Torvalds1da177e2005-04-16 15:20:36 -0700467int main(int ac, char **av)
468{
Andres Salomon2f4b4892007-12-17 01:34:58 -0500469 int opt;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700470 const char *name;
471 struct stat tmpstat;
472
EGRY Gabor534a4502008-01-11 23:44:39 +0100473 setlocale(LC_ALL, "");
474 bindtextdomain(PACKAGE, LOCALEDIR);
475 textdomain(PACKAGE);
476
Andres Salomon2f4b4892007-12-17 01:34:58 -0500477 while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
478 switch (opt) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700479 case 'o':
480 input_mode = ask_new;
481 break;
482 case 's':
483 input_mode = ask_silent;
484 valid_stdin = isatty(0) && isatty(1) && isatty(2);
485 break;
486 case 'd':
487 input_mode = set_default;
488 break;
489 case 'D':
490 input_mode = set_default;
Andres Salomon2f4b4892007-12-17 01:34:58 -0500491 defconfig_file = optarg;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700492 break;
493 case 'n':
494 input_mode = set_no;
495 break;
496 case 'm':
497 input_mode = set_mod;
498 break;
499 case 'y':
500 input_mode = set_yes;
501 break;
502 case 'r':
503 input_mode = set_random;
Ladislav Michl07f76682008-01-09 16:36:19 +0100504 srand(time(NULL));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700505 break;
506 case 'h':
EGRY Gabor534a4502008-01-11 23:44:39 +0100507 printf(_("See README for usage info\n"));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508 exit(0);
Andres Salomon2f4b4892007-12-17 01:34:58 -0500509 break;
510 default:
EGRY Gabor534a4502008-01-11 23:44:39 +0100511 fprintf(stderr, _("See README for usage info\n"));
Andres Salomon2f4b4892007-12-17 01:34:58 -0500512 exit(1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700513 }
514 }
Andres Salomon2f4b4892007-12-17 01:34:58 -0500515 if (ac == optind) {
Arnaldo Carvalho de Melo3b9fa092005-05-05 15:09:46 -0700516 printf(_("%s: Kconfig file missing\n"), av[0]);
Randy Dunlap250725a2006-06-08 22:12:50 -0700517 exit(1);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700518 }
Andres Salomon2f4b4892007-12-17 01:34:58 -0500519 name = av[optind];
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 conf_parse(name);
521 //zconfdump(stdout);
522 switch (input_mode) {
523 case set_default:
524 if (!defconfig_file)
525 defconfig_file = conf_get_default_confname();
526 if (conf_read(defconfig_file)) {
EGRY Gabor534a4502008-01-11 23:44:39 +0100527 printf(_("***\n"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528 "*** Can't find default configuration \"%s\"!\n"
EGRY Gabor534a4502008-01-11 23:44:39 +0100529 "***\n"), defconfig_file);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700530 exit(1);
531 }
532 break;
533 case ask_silent:
534 if (stat(".config", &tmpstat)) {
Arnaldo Carvalho de Melo3b9fa092005-05-05 15:09:46 -0700535 printf(_("***\n"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536 "*** You have not yet configured your kernel!\n"
Randy Dunlap7ac1c142007-04-04 21:58:41 -0700537 "*** (missing kernel .config file)\n"
Linus Torvalds1da177e2005-04-16 15:20:36 -0700538 "***\n"
539 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
540 "*** \"make menuconfig\" or \"make xconfig\").\n"
Arnaldo Carvalho de Melo3b9fa092005-05-05 15:09:46 -0700541 "***\n"));
Linus Torvalds1da177e2005-04-16 15:20:36 -0700542 exit(1);
543 }
544 case ask_all:
545 case ask_new:
546 conf_read(NULL);
547 break;
Roman Zippel90389162005-11-08 21:34:49 -0800548 case set_no:
549 case set_mod:
550 case set_yes:
551 case set_random:
552 name = getenv("KCONFIG_ALLCONFIG");
553 if (name && !stat(name, &tmpstat)) {
Roman Zippel669bfad2006-06-08 22:12:42 -0700554 conf_read_simple(name, S_DEF_USER);
Roman Zippel90389162005-11-08 21:34:49 -0800555 break;
556 }
557 switch (input_mode) {
558 case set_no: name = "allno.config"; break;
559 case set_mod: name = "allmod.config"; break;
560 case set_yes: name = "allyes.config"; break;
561 case set_random: name = "allrandom.config"; break;
562 default: break;
563 }
564 if (!stat(name, &tmpstat))
Roman Zippel669bfad2006-06-08 22:12:42 -0700565 conf_read_simple(name, S_DEF_USER);
Roman Zippel90389162005-11-08 21:34:49 -0800566 else if (!stat("all.config", &tmpstat))
Roman Zippel669bfad2006-06-08 22:12:42 -0700567 conf_read_simple("all.config", S_DEF_USER);
Roman Zippel90389162005-11-08 21:34:49 -0800568 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700569 default:
570 break;
571 }
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200572 switch (input_mode) {
573 case set_no:
574 conf_set_all_new_symbols(def_no);
575 break;
576 case set_yes:
577 conf_set_all_new_symbols(def_yes);
578 break;
579 case set_mod:
580 conf_set_all_new_symbols(def_mod);
581 break;
582 case set_random:
583 conf_set_all_new_symbols(def_random);
584 break;
Sam Ravnborg09748e12008-06-30 23:02:59 +0200585 case set_default:
586 conf_set_all_new_symbols(def_default);
587 break;
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200588 case ask_silent:
Sam Ravnborgcd9140e1e2008-06-30 22:53:04 +0200589 case ask_new:
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200590 if (conf_silent_update())
591 exit(1);
592 break;
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200593 case ask_all:
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200594 if (conf_update())
595 exit(1);
596 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700597 }
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200598
Sam Ravnborg22127f22008-08-04 22:18:07 +0200599 if (conf_write(NULL)) {
Sam Ravnborgf443d2e2008-06-30 22:45:38 +0200600 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
601 exit(1);
602 }
603 /* ask_silent is used during the build so we shall update autoconf.
604 * All other commands are only used to generate a config.
605 */
Roman Zippelc955cca2006-06-08 22:12:39 -0700606 if (input_mode == ask_silent && conf_write_autoconf()) {
607 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
608 return 1;
609 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700610 return 0;
611}