summaryrefslogtreecommitdiff
path: root/scripts/config/conf.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-01-16 12:49:06 +0000
committerEric Andersen <andersen@codepoet.org>2004-01-16 12:49:06 +0000
commit16f94a672213047fc9c6722a5c4c7a3a9a0dbcb4 (patch)
tree6af9f154995d3e7b79b2c9b58dfb4867d705fcac /scripts/config/conf.c
parent17b4a20a9c4dc7ec9fdf91cea34b35bc4ef6e070 (diff)
downloadbusybox-w32-16f94a672213047fc9c6722a5c4c7a3a9a0dbcb4.tar.gz
busybox-w32-16f94a672213047fc9c6722a5c4c7a3a9a0dbcb4.tar.bz2
busybox-w32-16f94a672213047fc9c6722a5c4c7a3a9a0dbcb4.zip
Minor updates from linux 2.6.1
Diffstat (limited to 'scripts/config/conf.c')
-rw-r--r--scripts/config/conf.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/scripts/config/conf.c b/scripts/config/conf.c
index 013a679dd..3b0c1c1b5 100644
--- a/scripts/config/conf.c
+++ b/scripts/config/conf.c
@@ -26,6 +26,7 @@ enum {
26 set_no, 26 set_no,
27 set_random 27 set_random
28} input_mode = ask_all; 28} input_mode = ask_all;
29char *defconfig_file;
29 30
30static int indent = 1; 31static int indent = 1;
31static int valid_stdin = 1; 32static int valid_stdin = 1;
@@ -174,7 +175,7 @@ int conf_string(struct menu *menu)
174 break; 175 break;
175 case '?': 176 case '?':
176 /* print help */ 177 /* print help */
177 if (line[1] == 0) { 178 if (line[1] == '\n') {
178 help = nohelp_text; 179 help = nohelp_text;
179 if (menu->sym->help) 180 if (menu->sym->help)
180 help = menu->sym->help; 181 help = menu->sym->help;
@@ -483,11 +484,12 @@ static void check_conf(struct menu *menu)
483 484
484int main(int ac, char **av) 485int main(int ac, char **av)
485{ 486{
487 int i = 1;
486 const char *name; 488 const char *name;
487 struct stat tmpstat; 489 struct stat tmpstat;
488 490
489 if (ac > 1 && av[1][0] == '-') { 491 if (ac > i && av[i][0] == '-') {
490 switch (av[1][1]) { 492 switch (av[i++][1]) {
491 case 'o': 493 case 'o':
492 input_mode = ask_new; 494 input_mode = ask_new;
493 break; 495 break;
@@ -498,6 +500,15 @@ int main(int ac, char **av)
498 case 'd': 500 case 'd':
499 input_mode = set_default; 501 input_mode = set_default;
500 break; 502 break;
503 case 'D':
504 input_mode = set_default;
505 defconfig_file = av[i++];
506 if (!defconfig_file) {
507 printf("%s: No default config file specified\n",
508 av[0]);
509 exit(1);
510 }
511 break;
501 case 'n': 512 case 'n':
502 input_mode = set_no; 513 input_mode = set_no;
503 break; 514 break;
@@ -516,18 +527,21 @@ int main(int ac, char **av)
516 printf("%s [-o|-s] config\n", av[0]); 527 printf("%s [-o|-s] config\n", av[0]);
517 exit(0); 528 exit(0);
518 } 529 }
519 name = av[2]; 530 }
520 } else 531 name = av[i];
521 name = av[1]; 532 if (!name) {
533 printf("%s: configuration file missing\n", av[0]);
534 }
522 conf_parse(name); 535 conf_parse(name);
523 //zconfdump(stdout); 536 //zconfdump(stdout);
524 switch (input_mode) { 537 switch (input_mode) {
525 case set_default: 538 case set_default:
526 name = conf_get_default_confname(); 539 if (!defconfig_file)
527 if (conf_read(name)) { 540 defconfig_file = conf_get_default_confname();
541 if (conf_read(defconfig_file)) {
528 printf("***\n" 542 printf("***\n"
529 "*** Can't find default configuration \"%s\"!\n" 543 "*** Can't find default configuration \"%s\"!\n"
530 "***\n", name); 544 "***\n", defconfig_file);
531 exit(1); 545 exit(1);
532 } 546 }
533 break; 547 break;
@@ -536,8 +550,8 @@ int main(int ac, char **av)
536 printf("***\n" 550 printf("***\n"
537 "*** You have not yet configured BusyBox!\n" 551 "*** You have not yet configured BusyBox!\n"
538 "***\n" 552 "***\n"
539 "*** Please run some configurator (e.g. \"make config\" or\n" 553 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
540 "*** \"make oldconfig\" or \"make menuconfig\").\n" 554 "*** \"make menuconfig\" or \"make config\").\n"
541 "***\n"); 555 "***\n");
542 exit(1); 556 exit(1);
543 } 557 }
@@ -561,6 +575,9 @@ int main(int ac, char **av)
561 conf_cnt = 0; 575 conf_cnt = 0;
562 check_conf(&rootmenu); 576 check_conf(&rootmenu);
563 } while (conf_cnt); 577 } while (conf_cnt);
564 conf_write(NULL); 578 if (conf_write(NULL)) {
579 fprintf(stderr, "\n*** Error during writing of the BusyBox configuration.\n\n");
580 return 1;
581 }
565 return 0; 582 return 0;
566} 583}