浏览代码

Merge an update from upstream

Eric Andersen 22 年之前
父节点
当前提交
e89052ae8b

+ 2 - 1
extra/config/conf.c

@@ -115,6 +115,7 @@ static void conf_askvalue(struct symbol *sym, const char *def)
 			exit(1);
 		}
 	case ask_all:
+		fflush(stdout);
 		fgets(line, 128, stdin);
 		return;
 	case set_default:
@@ -364,7 +365,7 @@ static int conf_choice(struct menu *menu)
 			for (cmenu = menu->list; cmenu; cmenu = cmenu->next) {
 				if (!cmenu->sym || !menu_is_visible(cmenu))
 					continue;
-				if (!strncmp(line, menu_get_prompt(cmenu), len)) {
+				if (!strncasecmp(line, menu_get_prompt(cmenu), len)) {
 					def_menu = cmenu;
 					break;
 				}

+ 17 - 10
extra/config/confdata.c

@@ -148,17 +148,24 @@ int conf_read(const char *name)
 				break;
 			}
 			switch (sym->type) {
-			case S_TRISTATE:
-				if (p[0] == 'm')
-					sym->def = symbol_mod.curr;
-				else
+  			case S_TRISTATE:
+				if (p[0] == 'm') {
+					S_TRI(sym->def) = mod;
+					sym->flags &= ~SYMBOL_NEW;
+					break;
+				}
 			case S_BOOLEAN:
-				if (p[0] == 'n')
-					sym->def = symbol_no.curr;
-				else
-					sym->def = symbol_yes.curr;
-				sym->flags &= ~SYMBOL_NEW;
-				break;
+				if (p[0] == 'y') {
+					S_TRI(sym->def) = yes;
+					sym->flags &= ~SYMBOL_NEW;
+					break;
+				}
+				if (p[0] == 'n') {
+					S_TRI(sym->def) = no;
+					sym->flags &= ~SYMBOL_NEW;
+					break;
+				}
+  				break;
 			case S_STRING:
 				if (*p++ != '"')
 					break;

+ 1 - 1
extra/config/expr.h

@@ -169,7 +169,7 @@ struct menu {
 	//char *help;
 	struct file *file;
 	int lineno;
-	//void *data;
+	void *data;
 };
 
 #ifndef SWIG

文件差异内容过多而无法显示
+ 158 - 167
extra/config/lex.zconf.c_shipped


+ 58 - 7
extra/config/mconf.c

@@ -1,6 +1,9 @@
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  * Released under the terms of the GNU GPL v2.0.
+ *
+ * Introduced single menu mode (show all sub-menus in one large tree).
+ * 2002-11-06 Petr Baudis <pasky@ucw.cz>
  */
 
 #include <sys/ioctl.h>
@@ -12,6 +15,7 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
+#include <termios.h>
 #include <unistd.h>
 
 #define LKC_DIRECT_LINK
@@ -80,10 +84,12 @@ static char buf[4096], *bufptr = buf;
 static char input_buf[4096];
 static char *args[1024], **argptr = args;
 static int indent = 0;
+static struct termios ios_org;
 static int rows, cols;
 static struct menu *current_menu;
 static int child_count;
 static int do_resize;
+static int single_menu_mode;
 
 static void conf(struct menu *menu);
 static void conf_choice(struct menu *menu);
@@ -274,10 +280,20 @@ static void build_conf(struct menu *menu)
 			case P_MENU:
 				child_count++;
 				cprint("m%p", menu);
-				if (menu->parent != &rootmenu)
-					cprint1("   %*c", indent + 1, ' ');
-				cprint1("%s  --->", prompt);
+
+				if (single_menu_mode) {
+					cprint1("%s%*c%s",
+						menu->data ? "-->" : "++>",
+						indent + 1, ' ', prompt);
+				} else {
+					if (menu->parent != &rootmenu)
+						cprint1("   %*c", indent + 1, ' ');
+					cprint1("%s  --->", prompt);
+				}
+
 				cprint_done();
+				if (single_menu_mode && menu->data)
+					goto conf_childs;
 				return;
 			default:
 				if (prompt) {
@@ -392,6 +408,7 @@ static void conf(struct menu *menu)
 	char active_entry[40];
 	int stat, type, i;
 
+	unlink("lxdialog.scrltmp");
 	active_entry[0] = 0;
 	while (1) {
 		cprint_init();
@@ -442,7 +459,10 @@ static void conf(struct menu *menu)
 		case 0:
 			switch (type) {
 			case 'm':
-				conf(submenu);
+				if (single_menu_mode)
+					submenu->data = (void *) !submenu->data;
+				else
+					conf(submenu);
 				break;
 			case 't':
 				if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)
@@ -484,6 +504,8 @@ static void conf(struct menu *menu)
 		case 6:
 			if (type == 't')
 				sym_toggle_tristate_value(sym);
+			else if (type == 'm')
+				conf(submenu);
 			break;
 		}
 	}
@@ -518,11 +540,19 @@ static void show_helptext(const char *title, const char *text)
 static void show_help(struct menu *menu)
 {
 	const char *help;
+	char *helptext;
+	struct symbol *sym = menu->sym;
 
-	help = menu->sym->help;
+	help = sym->help;
 	if (!help)
 		help = nohelp_text;
-	show_helptext(menu_get_prompt(menu), help);
+	if (sym->name) {
+		helptext = malloc(strlen(sym->name) + strlen(help) + 16);
+		sprintf(helptext, "%s:\n\n%s", sym->name, help);
+		show_helptext(menu_get_prompt(menu), helptext);
+		free(helptext);
+	} else
+		show_helptext(menu_get_prompt(menu), help);
 }
 
 static void show_readme(void)
@@ -679,14 +709,35 @@ static void conf_save(void)
 	}
 }
 
+static void conf_cleanup(void)
+{
+	tcsetattr(1, TCSAFLUSH, &ios_org);
+	unlink(".help.tmp");
+	unlink("lxdialog.scrltmp");
+}
+
 int main(int ac, char **av)
 {
+	struct symbol *sym;
+	char *mode;
 	int stat;
+
 	conf_parse(av[1]);
 	conf_read(NULL);
 
-	sprintf(menu_backtitle, "uClibc v%s Configuration", getenv("VERSION"));
+	sym = sym_lookup("VERSION", 0);
+	sym_calc_value(sym);
+	sprintf(menu_backtitle, "uClibc v%s Configuration",
+		sym_get_string_value(sym));
 
+	mode = getenv("MENUCONFIG_MODE");
+	if (mode) {
+		if (!strcasecmp(mode, "single_menu"))
+			single_menu_mode = 1;
+	}
+  
+	tcgetattr(1, &ios_org);
+	atexit(conf_cleanup);
 	init_wsize();
 	conf(&rootmenu);
 

+ 6 - 2
extra/config/symbol.c

@@ -61,24 +61,28 @@ void sym_init(void)
 
 	uname(&uts);
 
+#if 0
 	sym = sym_lookup("ARCH", 0);
 	sym->type = S_STRING;
 	sym->flags |= SYMBOL_AUTO;
 	p = getenv("ARCH");
 	if (p)
 		sym_add_default(sym, p);
+#endif
 
-	sym = sym_lookup("KERNELRELEASE", 0);
+	sym = sym_lookup("VERSION", 0);
 	sym->type = S_STRING;
 	sym->flags |= SYMBOL_AUTO;
-	p = getenv("KERNELRELEASE");
+	p = getenv("VERSION");
 	if (p)
 		sym_add_default(sym, p);
 
+#if 0
 	sym = sym_lookup("UNAME_RELEASE", 0);
 	sym->type = S_STRING;
 	sym->flags |= SYMBOL_AUTO;
 	sym_add_default(sym, uts.release);
+#endif
 
 	sym = sym_lookup("TARGET_ARCH", 0);
 	sym->type = S_STRING;

+ 24 - 15
extra/config/zconf.l

@@ -1,4 +1,4 @@
-%option backup nostdinit noyywrap full ecs
+%option backup nostdinit noyywrap never-interactive full ecs
 %option 8bit backup nodefault perf-report perf-report
 %x COMMAND HELP STRING PARAM
 %{
@@ -83,8 +83,6 @@ n	[A-Za-z0-9_]
 
 .	{
 	unput(yytext[0]);
-	//printf("new config: ");
-	//symbol_end(NULL);
 	BEGIN(COMMAND);
 }
 
@@ -144,31 +142,43 @@ n	[A-Za-z0-9_]
 		return T_WORD;
 	}
 	.
+	<<EOF>> {
+		BEGIN(INITIAL);
+	}
 }
 
 <STRING>{
-	[^'"\n\\]+	{
+	[^'"\\\n]+/\n	{
+		append_string(yytext, yyleng);
+		zconflval.string = text;
+		return T_STRING;
+	}
+	[^'"\\\n]+	{
 		append_string(yytext, yyleng);
 	}
+	\\.?/\n	{
+		append_string(yytext+1, yyleng);
+		zconflval.string = text;
+		return T_STRING;
+	}
+	\\.?	{
+		append_string(yytext+1, yyleng);
+	}
 	\'|\"	{
 		if (str == yytext[0]) {
 			BEGIN(PARAM);
 			zconflval.string = text;
-			//printf("s:%s\n", text);
 			return T_STRING;
 		} else
 			append_string(yytext, 1);
 	}
-	\\[ \t]*\n	append_string(yytext+yyleng-1, 1); current_file->lineno++;
-	\\[ \t]*	append_string(yytext+1, yyleng-1);
-	\\.		append_string(yytext+1, 1);
 	\n	{
-		//printf(":%d: open string!\n", current_file->lineno+1);
-		exit(0);
+		printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
+		BEGIN(INITIAL);
+		return T_EOL;
 	}
 	<<EOF>>	{
-		//printf(":%d: open string!\n", current_file->lineno+1);
-		exit(0);
+		BEGIN(INITIAL);
 	}
 }
 
@@ -221,6 +231,7 @@ n	[A-Za-z0-9_]
 		zconf_endfile();
 		return T_EOF;
 	}
+	fclose(yyin);
 	yyterminate();
 }
 
@@ -245,7 +256,6 @@ void zconf_initscan(const char *name)
 		printf("can't find file %s\n", name);
 		exit(1);
 	}
-	//fprintf(stderr, "zconf_initscan: %s\n", name);
 
 	current_buf = malloc(sizeof(*current_buf));
 	memset(current_buf, 0, sizeof(*current_buf));
@@ -271,8 +281,6 @@ void zconf_nextfile(const char *name)
 	buf->parent = current_buf;
 	current_buf = buf;
 
-	//fprintf(stderr, "zconf_nextfile: %s\n", name);
-
 	if (file->flags & FILE_BUSY) {
 		printf("recursive scan (%s)?\n", name);
 		exit(1);
@@ -297,6 +305,7 @@ static struct buffer *zconf_endfile(void)
 
 	parent = current_buf->parent;
 	if (parent) {
+		fclose(yyin);
 		yy_delete_buffer(YY_CURRENT_BUFFER);
 		yy_switch_to_buffer(parent->state);
 	}

文件差异内容过多而无法显示
+ 495 - 384
extra/config/zconf.tab.c_shipped


+ 109 - 37
extra/config/zconf.tab.h_shipped

@@ -1,53 +1,125 @@
+/* A Bison parser, made from zconf.y, by GNU bison 1.75.  */
+
+/* Skeleton parser for Yacc-like parsing with Bison,
+   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+/* As a special exception, when this file is copied by Bison into a
+   Bison output file, you may use that output file without restriction.
+   This special exception was added by the Free Software Foundation
+   in version 1.24 of Bison.  */
+
 #ifndef BISON_ZCONF_TAB_H
 # define BISON_ZCONF_TAB_H
 
+/* Tokens.  */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     T_MAINMENU = 258,
+     T_MENU = 259,
+     T_ENDMENU = 260,
+     T_SOURCE = 261,
+     T_CHOICE = 262,
+     T_ENDCHOICE = 263,
+     T_COMMENT = 264,
+     T_CONFIG = 265,
+     T_HELP = 266,
+     T_HELPTEXT = 267,
+     T_IF = 268,
+     T_ENDIF = 269,
+     T_DEPENDS = 270,
+     T_REQUIRES = 271,
+     T_OPTIONAL = 272,
+     T_PROMPT = 273,
+     T_DEFAULT = 274,
+     T_TRISTATE = 275,
+     T_BOOLEAN = 276,
+     T_INT = 277,
+     T_HEX = 278,
+     T_WORD = 279,
+     T_STRING = 280,
+     T_UNEQUAL = 281,
+     T_EOF = 282,
+     T_EOL = 283,
+     T_CLOSE_PAREN = 284,
+     T_OPEN_PAREN = 285,
+     T_ON = 286,
+     T_OR = 287,
+     T_AND = 288,
+     T_EQUAL = 289,
+     T_NOT = 290
+   };
+#endif
+#define T_MAINMENU 258
+#define T_MENU 259
+#define T_ENDMENU 260
+#define T_SOURCE 261
+#define T_CHOICE 262
+#define T_ENDCHOICE 263
+#define T_COMMENT 264
+#define T_CONFIG 265
+#define T_HELP 266
+#define T_HELPTEXT 267
+#define T_IF 268
+#define T_ENDIF 269
+#define T_DEPENDS 270
+#define T_REQUIRES 271
+#define T_OPTIONAL 272
+#define T_PROMPT 273
+#define T_DEFAULT 274
+#define T_TRISTATE 275
+#define T_BOOLEAN 276
+#define T_INT 277
+#define T_HEX 278
+#define T_WORD 279
+#define T_STRING 280
+#define T_UNEQUAL 281
+#define T_EOF 282
+#define T_EOL 283
+#define T_CLOSE_PAREN 284
+#define T_OPEN_PAREN 285
+#define T_ON 286
+#define T_OR 287
+#define T_AND 288
+#define T_EQUAL 289
+#define T_NOT 290
+
+
+
+
 #ifndef YYSTYPE
-typedef union
-{
+#line 33 "zconf.y"
+typedef union {
 	int token;
 	char *string;
 	struct symbol *symbol;
 	struct expr *expr;
 	struct menu *menu;
 } yystype;
+/* Line 1281 of /usr/share/bison/yacc.c.  */
+#line 118 "zconf.tab.h"
 # define YYSTYPE yystype
-# define YYSTYPE_IS_TRIVIAL 1
 #endif
-# define	T_MAINMENU	257
-# define	T_MENU	258
-# define	T_ENDMENU	259
-# define	T_SOURCE	260
-# define	T_CHOICE	261
-# define	T_ENDCHOICE	262
-# define	T_COMMENT	263
-# define	T_CONFIG	264
-# define	T_HELP	265
-# define	T_HELPTEXT	266
-# define	T_IF	267
-# define	T_ENDIF	268
-# define	T_DEPENDS	269
-# define	T_REQUIRES	270
-# define	T_OPTIONAL	271
-# define	T_PROMPT	272
-# define	T_DEFAULT	273
-# define	T_TRISTATE	274
-# define	T_BOOLEAN	275
-# define	T_INT	276
-# define	T_HEX	277
-# define	T_WORD	278
-# define	T_STRING	279
-# define	T_UNEQUAL	280
-# define	T_EOF	281
-# define	T_EOL	282
-# define	T_CLOSE_PAREN	283
-# define	T_OPEN_PAREN	284
-# define	T_ON	285
-# define	T_OR	286
-# define	T_AND	287
-# define	T_EQUAL	288
-# define	T_NOT	289
-
 
 extern YYSTYPE zconflval;
 
+
 #endif /* not BISON_ZCONF_TAB_H */
+

部分文件因为文件数量过多而无法显示