[BusyBox-cvs] busybox/scripts/config conf.c, 1.2, 1.3 confdata.c, 1.5, 1.6
Erik Andersen
andersen at busybox.net
Fri Jan 16 12:48:56 UTC 2004
Update of /var/cvs/busybox/scripts/config
In directory nail:/tmp/cvs-serv21793
Modified Files:
conf.c confdata.c
Log Message:
Minor updates from linux 2.6.1
Index: confdata.c
===================================================================
RCS file: /var/cvs/busybox/scripts/config/confdata.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- confdata.c 13 Jan 2004 10:57:32 -0000 1.5
+++ confdata.c 16 Jan 2004 12:48:53 -0000 1.6
@@ -52,7 +52,7 @@
char *conf_get_default_confname(void)
{
struct stat buf;
- static char fullname[4096+1];
+ static char fullname[PATH_MAX+1];
char *env, *name;
name = conf_expand_value(conf_defname);
Index: conf.c
===================================================================
RCS file: /var/cvs/busybox/scripts/config/conf.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- conf.c 5 Aug 2003 02:18:24 -0000 1.2
+++ conf.c 16 Jan 2004 12:48:53 -0000 1.3
@@ -26,6 +26,7 @@
set_no,
set_random
} input_mode = ask_all;
+char *defconfig_file;
static int indent = 1;
static int valid_stdin = 1;
@@ -174,7 +175,7 @@
break;
case '?':
/* print help */
- if (line[1] == 0) {
+ if (line[1] == '\n') {
help = nohelp_text;
if (menu->sym->help)
help = menu->sym->help;
@@ -483,11 +484,12 @@
int main(int ac, char **av)
{
+ int i = 1;
const char *name;
struct stat tmpstat;
- if (ac > 1 && av[1][0] == '-') {
- switch (av[1][1]) {
+ if (ac > i && av[i][0] == '-') {
+ switch (av[i++][1]) {
case 'o':
input_mode = ask_new;
break;
@@ -498,6 +500,15 @@
case 'd':
input_mode = set_default;
break;
+ case 'D':
+ input_mode = set_default;
+ defconfig_file = av[i++];
+ if (!defconfig_file) {
+ printf("%s: No default config file specified\n",
+ av[0]);
+ exit(1);
+ }
+ break;
case 'n':
input_mode = set_no;
break;
@@ -516,18 +527,21 @@
printf("%s [-o|-s] config\n", av[0]);
exit(0);
}
- name = av[2];
- } else
- name = av[1];
+ }
+ name = av[i];
+ if (!name) {
+ printf("%s: configuration file missing\n", av[0]);
+ }
conf_parse(name);
//zconfdump(stdout);
switch (input_mode) {
case set_default:
- name = conf_get_default_confname();
- if (conf_read(name)) {
+ if (!defconfig_file)
+ defconfig_file = conf_get_default_confname();
+ if (conf_read(defconfig_file)) {
printf("***\n"
"*** Can't find default configuration \"%s\"!\n"
- "***\n", name);
+ "***\n", defconfig_file);
exit(1);
}
break;
@@ -536,8 +550,8 @@
printf("***\n"
"*** You have not yet configured BusyBox!\n"
"***\n"
- "*** Please run some configurator (e.g. \"make config\" or\n"
- "*** \"make oldconfig\" or \"make menuconfig\").\n"
+ "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
+ "*** \"make menuconfig\" or \"make config\").\n"
"***\n");
exit(1);
}
@@ -561,6 +575,9 @@
conf_cnt = 0;
check_conf(&rootmenu);
} while (conf_cnt);
- conf_write(NULL);
+ if (conf_write(NULL)) {
+ fprintf(stderr, "\n*** Error during writing of the BusyBox configuration.\n\n");
+ return 1;
+ }
return 0;
}
More information about the busybox-cvs
mailing list