Browse Source

Minor updates from linux 2.6.1

Eric Andersen 21 years ago
parent
commit
81744d00c2
3 changed files with 32 additions and 15 deletions
  1. 2 2
      extra/config/Kconfig-language.txt
  2. 29 12
      extra/config/conf.c
  3. 1 1
      extra/config/confdata.c

+ 2 - 2
extra/config/Kconfig-language.txt

@@ -141,8 +141,8 @@ Expressions are listed in decreasing order of precedence.
     otherwise 'y'.
     otherwise 'y'.
 (4) Returns the value of the expression. Used to override precedence.
 (4) Returns the value of the expression. Used to override precedence.
 (5) Returns the result of (2-/expr/).
 (5) Returns the result of (2-/expr/).
-(6) Returns the result of max(/expr/, /expr/).
-(7) Returns the result of min(/expr/, /expr/).
+(6) Returns the result of min(/expr/, /expr/).
+(7) Returns the result of max(/expr/, /expr/).
 
 
 An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
 An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
 respectively for calculations). A menu entry becomes visible when it's
 respectively for calculations). A menu entry becomes visible when it's

+ 29 - 12
extra/config/conf.c

@@ -26,6 +26,7 @@ enum {
 	set_no,
 	set_no,
 	set_random
 	set_random
 } input_mode = ask_all;
 } input_mode = ask_all;
+char *defconfig_file;
 
 
 static int indent = 1;
 static int indent = 1;
 static int valid_stdin = 1;
 static int valid_stdin = 1;
@@ -174,7 +175,7 @@ int conf_string(struct menu *menu)
 			break;
 			break;
 		case '?':
 		case '?':
 			/* print help */
 			/* print help */
-			if (line[1] == 0) {
+			if (line[1] == '\n') {
 				help = nohelp_text;
 				help = nohelp_text;
 				if (menu->sym->help)
 				if (menu->sym->help)
 					help = menu->sym->help;
 					help = menu->sym->help;
@@ -483,11 +484,12 @@ static void check_conf(struct menu *menu)
 
 
 int main(int ac, char **av)
 int main(int ac, char **av)
 {
 {
+	int i = 1;
 	const char *name;
 	const char *name;
 	struct stat tmpstat;
 	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':
 		case 'o':
 			input_mode = ask_new;
 			input_mode = ask_new;
 			break;
 			break;
@@ -498,6 +500,15 @@ int main(int ac, char **av)
 		case 'd':
 		case 'd':
 			input_mode = set_default;
 			input_mode = set_default;
 			break;
 			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':
 		case 'n':
 			input_mode = set_no;
 			input_mode = set_no;
 			break;
 			break;
@@ -516,18 +527,21 @@ int main(int ac, char **av)
 			printf("%s [-o|-s] config\n", av[0]);
 			printf("%s [-o|-s] config\n", av[0]);
 			exit(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);
 	conf_parse(name);
 	//zconfdump(stdout);
 	//zconfdump(stdout);
 	switch (input_mode) {
 	switch (input_mode) {
 	case set_default:
 	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"
 			printf("***\n"
 				"*** Can't find default configuration \"%s\"!\n"
 				"*** Can't find default configuration \"%s\"!\n"
-				"***\n", name);
+				"***\n", defconfig_file);
 			exit(1);
 			exit(1);
 		}
 		}
 		break;
 		break;
@@ -536,8 +550,8 @@ int main(int ac, char **av)
 			printf("***\n"
 			printf("***\n"
 				"*** You have not yet configured uClibc!\n"
 				"*** You have not yet configured uClibc!\n"
 				"***\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");
 				"***\n");
 			exit(1);
 			exit(1);
 		}
 		}
@@ -561,6 +575,9 @@ int main(int ac, char **av)
 		conf_cnt = 0;
 		conf_cnt = 0;
 		check_conf(&rootmenu);
 		check_conf(&rootmenu);
 	} while (conf_cnt);
 	} while (conf_cnt);
-	conf_write(NULL);
+	if (conf_write(NULL)) {
+		fprintf(stderr, "\n*** Error during writing of the uClibc configuration.\n\n");
+		return 1;
+	}
 	return 0;
 	return 0;
 }
 }

+ 1 - 1
extra/config/confdata.c

@@ -52,7 +52,7 @@ static char *conf_expand_value(const char *in)
 char *conf_get_default_confname(void)
 char *conf_get_default_confname(void)
 {
 {
 	struct stat buf;
 	struct stat buf;
-	static char fullname[4096+1];
+	static char fullname[PATH_MAX+1];
 	char *env, *name;
 	char *env, *name;
 
 
 	name = conf_expand_value(conf_defname);
 	name = conf_expand_value(conf_defname);