From: Ahmad Reza Cheraghi <a_r_cheraghi@yahoo.com>
To: Daniel Thaler <thalerd@in.tum.de>, Lee Revell <rlrevell@joe-job.com>
Cc: David Lang <dlang@digitalinsight.com>,
Hua Zhong <hzhong@gmail.com>,
marekw1977@yahoo.com.au, linux-kernel@vger.kernel.org
Subject: Re: Automatic Configuration of a Kernel
Date: Thu, 15 Sep 2005 13:58:37 -0700 (PDT) [thread overview]
Message-ID: <20050915205837.88151.qmail@web51001.mail.yahoo.com> (raw)
In-Reply-To: <4328EC72.6050507@in.tum.de>
[-- Attachment #1: Type: text/plain, Size: 751 bytes --]
--- Daniel Thaler <thalerd@in.tum.de> wrote:
> Lee Revell wrote:
> > Why does this have to be in the kernel again?
> Isn't this exactly what
> > you get with a fully modular config and hotplug?
>
> It doesn't go in the kernel. If I understand
> correctly, it's a script that is
> invoked by 'make autoconfig'. Note that I didn't
> read the patch, because it's a
> .tgz on a website and I couldn't be bothered to
> download it.
Since im a new Bee, I didn't know that I patched
shouldnt be tgz. So here is a new patch as URL and
attachment.
The URL :
www.energyparty.de/ahmad/autoconfig.patch
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
[-- Attachment #2: 1146041466-autoconfig.patch --]
[-- Type: application/octet-stream, Size: 71135 bytes --]
diff -urN linux.org/Documentation/autoconf.txt linux-2.6.13/Documentation/autoconf.txt
--- linux.org/Documentation/autoconf.txt 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/Documentation/autoconf.txt 2005-09-15 15:36:35.000000000 +0200
@@ -0,0 +1,161 @@
+
+Constist:
+********
+
+The Linux Auto-Config consist of Files, auto_conf.c, an upgraded conf.c and Makefile, a directory
+(rules) which contains a rules_list and the scripts, and a xmlparser written by Tim Hockin.
+
+
+
+
+How does it work:
+*****************
+
+The trick of all is a framworking program, that means adding binaries or scripts without
+touching the real program. The program starts like if you are starting a make config, but at that point
+where it wants an input from you, the function auto_conf gets called with that option-question
+as a parameter. We are comparing this option with in a list manual-written
+Kconfig option. Each of those options in the list has its own script which will be
+executed in parallel by accordance. For putting an option in the rules_list you need
+the Option and a script that does the work for the option and then gives a value
+to the stout. This value will be redirected through a pipe to our main program which will
+write the config-name for the option into the .config file.
+
+
+
+
+How to add a rule:
+*******************
+
+
+The basic of the script is that it must give an answer to stdout.
+Since the rules_list is written in xml there are some conditions for adding rules.
+To add a rule (for the specified option), you have to know first the option name
+and the name of the menu that contains it.
+The easiest way, to do this, is to run make menuconfig, and see in which menu or submenu your option belongs to.
+Each of those has its own XML-Tag:
+
+
+<rules>: beginnging of the list.
+
+<menu name="menu name" must_have=" number ">:
+ Has the attribute "name" and "must_have". In attribute "name" the name of the menu should be written.
+ Attribute "must_have" shows the min. number of option, that in a menu should be choosen for a proper Kernel.
+ <menu> can contains options or submenus(the same as <menu>).
+
+<option name="option name"> rule </option>
+ In the attribut name the option name should be written. And the contain of the Option Tag
+ is the name of rule that belongs to that option.
+
+example:
+
+<rules>
+ <menu name="Networking support" must_have="1">
+ <option name="Networking support">egrep1.pm "Network|Ethernet"</option>
+ <menu name="Networking menus">
+ <option name="Packet socket">yes1.pm</option>
+ <option name="Packet socket: mmapped IO">yes1.pm</option>
+ </menu>
+ </menu>
+</rules>
+
+
+How to make a rule
+*******************
+
+A rule can be either a script or binary or... The main job is to
+give out an answer to stout for the actually option-question, it doesn't matter
+how.
+
+We have three types of answer:
+
+sym-answers: either y, n, m or \n.
+
+string-answer: can be maximal 128 characters
+
+option-answer: By the manual configuration normally you have to type an number
+ but a rule for an option should give out an y, if it want to be choosen.
+
+
+
+
+
+For example: the option is "Networking Support"
+ the program looks in the our list (which is called rules_list)
+ to find the "Networking Support" and if this option is in there,
+ a certain script (which we call it a rule) will be executed.
+ In this example the script name is hw_grep1.pm which
+ reads a given Parameter and searches for this Parameter,
+ lspci and dmesg with the help of grep. In this Case the Parameter
+ will be "Ethernet|Network".
+
+ hw_grep1.pm:
+
+ $found='';
+ $found=`lspci | grep "@ARGV"`;
+ if($found ne '') {
+ print("y\n");
+ }
+ else {
+ $found=`grep -E "@ARGV" /var/log/dmesg `;
+ if($found ne ''){
+ print("y\n");
+ }
+ else {
+ print("n\n");
+ }
+ }
+ 1;
+
+
+
+
+
+ This script checks if there is an Ethernet or
+ a Network card on the target System.
+ If it is true, it gives in this case a 'y' to stdout.
+ And for some options there can't be any script-rules, for instance software such as FTP or TCPIP etc...,
+ those question either get answered as 'build in' or as 'module'.
+ !! the answers must always have a '\n' at the end
+
+The rule-binary should be copied in the directory <KERNELVERSION>/scripts/kconfig/rules/
+
+
+
+Messages:
+*******************
+
+When the amount of needed Options in some menus are not choosen,
+messages will be given out in the stdout, at the end of the configuration.
+Containig Name of the menus.
+
+This can be happen:
+
+1. if for some options they rules are not applied. The reason for that is for some Hardware Option there is no rule.
+
+2. if your System doesn't support the Hardware i.e. you don't have an ethernet Card.
+
+In this case either your upgrade the autoconfig with rules or your contact me.
+
+If you are getting messages please include the following information:
+
+1. a copy of your lspci, /proc/cpuinfo and /var/log/dmesg
+
+2. a copy of your messages
+
+
+
+TO DO:
+*******************
+
+1. The Framework has to be extend for the Systems that aren't supported.
+
+2 .A way to ask for the Hardware-Devices directly from the I/O.
+
+
+Contact:
+*******************
+
+Suggestion and comments are welcome.
+
+Email: Ahmad Reza Cheraghi <a_r_cheraghi@yahoo.com>
diff -urN linux.org/scripts/kconfig/auto_conf.c linux-2.6.13/scripts/kconfig/auto_conf.c
--- linux.org/scripts/kconfig/auto_conf.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/auto_conf.c 2005-09-15 15:39:40.000000000 +0200
@@ -0,0 +1,302 @@
+/**************************************************************************************
+* *
+* auto_conf.c: Framework for autogeneration a Kernel Configuration *
+* *
+* This project was done in the Niederrhein University of Applied Sciences *
+* *
+* Copyright (C) 2005 Ahmad Reza Cheraghi <a_r_cheraghi@yahoo.com> *
+* This is free software, see GNU General Public License 2 for details. *
+* *
+* *
+* This Framework autogenerate a Configuration based on the given rules *
+* It does not guaranty that a Kernel can work after this generation since *
+* it is in his test-stage. *
+* *
+* *
+* Report errors, bugs, additions, wishes and comments to me: *
+* <a_r_cheraghi@yahoo.com> *
+* *
+* For futher information please refer to the README.txt *
+* *
+* *
+**************************************************************************************/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/wait.h>
+
+#include "xmlparser.h"
+
+static struct xml_element *ret;
+signed char answerbuf[128];
+int error_flag = 0;
+
+static int reading_xml_tree(struct xml_element* element, const char * option);
+
+enum {
+ read_tree,
+ check_tree
+} tree_mode = read_tree;
+
+
+
+/************************************************************************
+ * exec_rule() *
+ * *
+ * calls a child process, that redirect stout to the pipe *
+ * and execute the rule-script throught the Unix Process *
+ * system(). *
+ * The parent reads from the pipe, and copied in the variable *
+ * answer. *
+ ***********************************************************************/
+
+static int exec_rule(const char* rule)
+{
+ int pd[2];
+ pid_t childpid;
+ char directory[128];
+
+ /*
+ * reading the dirctory where the rules are
+ */
+ strncpy(directory,"scripts/kconfig/rules/", 128);
+
+ strcat(directory, rule);
+
+ pipe(pd);
+
+ if (( childpid = fork() ) == 0) {
+ dup2(pd[1], STDOUT_FILENO);
+
+ close(pd[0]);
+ close(pd[1]);
+ /*
+ * calling the rule
+ */
+ system(directory);
+ exit(0);
+ }
+ close(pd[1]);
+ /*
+ * waiting for the child process to complete
+ */
+ while ( wait ((int *) 0) != childpid)
+ continue;
+ /*
+ * reading from the pipe, that is the answer from the rule
+ */
+ read( pd[0], answerbuf, 128 );
+ close(pd[0]);
+ return 0;
+}
+
+
+/************************************************************************
+* get_rule() *
+* *
+* compares the option from the rules_list with the actual *
+* option, if they are the same, the rule that is containing *
+* int the list will be read and give to the function exec_rule *
+* *
+* After that, it will be checked if the answer is positive and it *
+* so and if the menu has a priority for arising the must_have *
+* counter. *
+* *
+***********************************************************************/
+
+static int get_rule (struct xml_element* child, const char * option)
+{
+ struct xml_prop *attribute;
+ char content[128];
+ attribute = NULL;
+
+ attribute = get_next_attribute(child, attribute);
+
+ if (attribute==NULL) {
+ return 0;
+ }
+
+ if (strcmp(get_attribute_name(attribute),"name") != 0) {
+ printf("error in rules_list by Tag <option>\n");
+ exit(1);
+ }
+ /*
+ * comparing actual option with attribute
+ */
+ if (( strcmp(get_attribute_value(attribute),option)) != 0) {
+ return 0;
+ }
+
+ /*
+ * reading in the rule(script-)-namei from list
+ */
+ strcpy(content, get_element_content(child));
+ /*
+ * executing the script
+ */
+ exec_rule(content);
+ if (child->parent->m_h_prior == 1) {
+ /*
+ * if answer is positive
+ */
+ if(answerbuf[0] == 'y' && answerbuf[1] == '\n') {
+ /*
+ * then arise the must_have
+ * counter
+ */
+ child->parent->m_h_cnt++;
+ }
+ }
+ return 0;
+}
+
+
+/************************************************************************
+* init_must_have() *
+* *
+* if there is any must_have attribute in the <menu> tag *
+* it will be initialised, here. *
+* *
+***********************************************************************/
+
+
+
+static int init_must_have(struct xml_element* child){
+
+ struct xml_prop *attribute;
+ attribute = NULL;
+ while ( (attribute = get_next_attribute(child, attribute))) {
+ if (strcmp(get_attribute_name(attribute),"must_have") == 0) {
+ if ( child->m_h_prior != 1) {
+ child->m_h_prior = 1;
+ if (attribute->prev) {
+ strncpy(child->option_name,
+ get_attribute_value(attribute->prev)
+ ,128);
+ } else {
+ printf("error in"
+ "rules_list by Tag <menu>\n");
+ exit(1);
+ }
+ child->m_h_value =
+ atoi(get_attribute_value(attribute));
+ child->m_h_cnt = 0;
+ }
+ }
+ }
+ return 0;
+}
+
+
+/************************************************************************
+* reading_xml_tag() *
+* *
+* This function reads the needed xml tags, they are the <option> *
+* and <menu> tag. *
+* *
+***********************************************************************/
+
+
+static int reading_xml_tag(struct xml_element* child, const char * option)
+{
+ switch (tree_mode) {
+ case read_tree:
+ if (strcmp(get_element_name(child), "menu") == 0) {
+ init_must_have(child);
+ } else if ((strcmp(get_element_name(child), "option")) == 0) {
+ get_rule(child, option);
+ }
+ break;
+
+ case check_tree:
+ if (strcmp(get_element_name(child), "menu") == 0) {
+ if (child->m_h_prior==0) {
+ return 0;
+ }
+ if ((child->m_h_cnt) < (child->m_h_value) ) {
+ error_flag = 1;
+ printf("\n\n*********************error**"
+ "*******************\n");
+ printf("from %i needed options are %i"
+ " choosen in menu \" %s \"\n"
+ , child->m_h_value,child->m_h_cnt,
+ child->option_name);
+ }
+ }
+ break;
+ }
+ return 0;
+}
+
+
+/************************************************************************
+* reading_xml_tree() *
+* *
+* the xml list is copied in struct variable, which conist of *
+* childs and nodes. *
+* The reading of this variable will be done by recursive *
+* calling the raeding_xml_tree() *
+* *
+***********************************************************************/
+
+
+int
+reading_xml_tree(struct xml_element* element, const char * option)
+{
+ struct xml_element *child;
+ child = NULL;
+ /*
+ * Asking for a child
+ */
+ if((child = get_first_child(element))) {
+ reading_xml_tag(child, option);
+ reading_xml_tree(child, option);
+ }
+
+ if( (child = get_next_node(element)) ) {
+ reading_xml_tag(child, option);
+ reading_xml_tree(child, option);
+ }
+ return 0;
+}
+
+
+int
+auto_conf(char *option, char answer[128])
+{
+ static int flag = 0;
+ struct xml_buffer buffer;
+ tree_mode = read_tree;
+ answerbuf[0] = '\n';
+ answerbuf[1] = 0;
+ answerbuf[2] = 0;
+
+ if (flag == 0) {
+ buffer = load_xml_file("scripts/kconfig/rules/rules_list.xml");
+ if ( xml_parse_buffer(buffer, &ret) ) {
+ printf("error by parsing \n");
+ }
+ free(buffer.text);
+ flag = 1;
+ }
+ reading_xml_tree(ret, option);
+ strncpy(answer,answerbuf,128);
+ printf("%s", answer);
+ return 0;
+}
+
+void must_have(void)
+{
+ tree_mode = check_tree;
+ reading_xml_tree(ret, NULL);
+ if(error_flag)
+ printf("\nIf messages are shown above it is not guarantied\n"
+ "that the Kernel will work properly after installing\n"
+ "or your System does't support the above HW\n "
+ "for further help please refer to the Documentation/autoconf.txt\n");
+}
diff -urN linux.org/scripts/kconfig/conf.c linux-2.6.13/scripts/kconfig/conf.c
--- linux.org/scripts/kconfig/conf.c 2005-08-29 01:41:01.000000000 +0200
+++ linux-2.6.13/scripts/kconfig/conf.c 2005-09-06 11:07:42.000000000 +0200
@@ -12,7 +12,8 @@
#define LKC_DIRECT_LINK
#include "lkc.h"
-
+int auto_conf(const char *option, char line[128]);
+void must_have(void);
static void conf(struct menu *menu);
static void check_conf(struct menu *menu);
@@ -24,21 +25,22 @@
set_yes,
set_mod,
set_no,
- set_random
+ set_random,
+ set_auto
} input_mode = ask_all;
char *defconfig_file;
static int indent = 1;
static int valid_stdin = 1;
static int conf_cnt;
-static char line[128];
+static signed char line[128];
static struct menu *rootEntry;
static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n");
-static void strip(char *str)
+static void strip(signed char *str)
{
- char *p = str;
+ signed char *p = str;
int l;
while ((isspace(*p)))
@@ -63,7 +65,7 @@
}
}
-static void conf_askvalue(struct symbol *sym, const char *def)
+static void conf_askvalue(struct symbol *sym, const char *def, const char *option)
{
enum symbol_type type = sym_get_type(sym);
tristate val;
@@ -80,7 +82,6 @@
line[1] = 0;
return;
}
-
switch (input_mode) {
case ask_new:
case ask_silent:
@@ -89,6 +90,24 @@
return;
}
check_stdin();
+ case set_auto:
+ fflush(stdout);
+ auto_conf(option, line);
+ if(line[0]=='y'){
+ if (!(sym_tristate_within_range(sym, yes))){
+ line[0] = 'm';
+ line[1] = '\n';
+ line[2] = 0;
+ }
+ }
+ if(line[0]=='m'){
+ if (!(sym_tristate_within_range(sym, mod))){
+ line[0] = 'y';
+ line[1] = '\n';
+ line[2] = 0;
+ }
+ }
+ return;
case ask_all:
fflush(stdout);
fgets(line, 128, stdin);
@@ -169,7 +188,7 @@
def = sym_get_string_value(sym);
if (sym_get_string_value(sym))
printf("[%s] ", def);
- conf_askvalue(sym, def);
+ conf_askvalue(sym, def, menu_get_prompt(menu));
switch (line[0]) {
case '\n':
break;
@@ -226,9 +245,10 @@
if (sym->help)
printf("/?");
printf("] ");
- conf_askvalue(sym, sym_get_string_value(sym));
+ conf_askvalue(sym, sym_get_string_value(sym), menu_get_prompt(menu));
+ if(input_mode==set_auto)
+ line[1]=0;
strip(line);
-
switch (line[0]) {
case 'n':
case 'N':
@@ -326,6 +346,23 @@
if (!sym_has_value(child->sym))
printf(" (NEW)");
printf("\n");
+/***************{****************** NEW ***********************************************/
+#if 1
+ if(input_mode==set_auto){
+ auto_conf(menu_get_prompt(child), line);
+ if(line[0]=='y'){
+ sprintf(line, "%i", cnt);
+ break;
+ }
+ else {
+ line[0] = '\n';
+ line[1] = 0;
+ }
+ }
+#endif
+/*************************************************************************************/
+
+
}
printf("%*schoice", indent - 1, "");
if (cnt == 1) {
@@ -348,6 +385,7 @@
case ask_all:
fflush(stdout);
fgets(line, 128, stdin);
+ case set_auto:
strip(line);
if (line[0] == '?') {
printf("\n%s\n", menu->sym->help ?
@@ -484,7 +522,7 @@
int main(int ac, char **av)
{
- int i = 1;
+ int i = 1;
const char *name;
struct stat tmpstat;
@@ -493,6 +531,9 @@
case 'o':
input_mode = ask_new;
break;
+ case 'a':
+ input_mode = set_auto;
+ break;
case 's':
input_mode = ask_silent;
valid_stdin = isatty(0) && isatty(1) && isatty(2);
@@ -557,6 +598,7 @@
}
case ask_all:
case ask_new:
+ case set_auto:
conf_read(NULL);
break;
default:
@@ -566,7 +608,7 @@
if (input_mode != ask_silent) {
rootEntry = &rootmenu;
conf(&rootmenu);
- if (input_mode == ask_all) {
+ if (input_mode == ask_all || input_mode == set_auto) {
input_mode = ask_silent;
valid_stdin = 1;
}
@@ -575,6 +617,8 @@
conf_cnt = 0;
check_conf(&rootmenu);
} while (conf_cnt);
+ if(av[1][1]=='a')
+ must_have();
if (conf_write(NULL)) {
fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n"));
return 1;
diff -urN linux.org/scripts/kconfig/Makefile linux-2.6.13/scripts/kconfig/Makefile
--- linux.org/scripts/kconfig/Makefile 2005-08-29 01:41:01.000000000 +0200
+++ linux-2.6.13/scripts/kconfig/Makefile 2005-09-06 11:07:42.000000000 +0200
@@ -2,7 +2,7 @@
# Kernel configuration targets
# These targets are used from top-level makefile
-.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-config
+.PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig
xconfig: $(obj)/qconf
$< arch/$(ARCH)/Kconfig
@@ -17,19 +17,16 @@
config: $(obj)/conf
$< arch/$(ARCH)/Kconfig
+autoconfig: $(obj)/conf
+ @if [ -f .config ]; then rm .config; fi;
+ $< -a arch/$(ARCH)/Kconfig
+
oldconfig: $(obj)/conf
$< -o arch/$(ARCH)/Kconfig
silentoldconfig: $(obj)/conf
$< -s arch/$(ARCH)/Kconfig
-update-po-config: $(obj)/kxgettext
- xgettext --default-domain=linux \
- --add-comments --keyword=_ --keyword=N_ \
- --files-from=scripts/kconfig/POTFILES.in \
- -o scripts/kconfig/linux.pot
- scripts/kconfig/kxgettext arch/$(ARCH)/Kconfig >> scripts/kconfig/linux.pot
-
.PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig
randconfig: $(obj)/conf
@@ -57,12 +54,10 @@
# Help text used by make help
help:
- @echo ' config - Update current config utilising a line-oriented program'
+ @echo ' oldconfig - Update current config utilising a line-oriented program'
@echo ' menuconfig - Update current config utilising a menu based program'
@echo ' xconfig - Update current config utilising a QT based front-end'
@echo ' gconfig - Update current config utilising a GTK based front-end'
- @echo ' oldconfig - Update current config utilising a provided .config as base'
- @echo ' randconfig - New config with random answer to all options'
@echo ' defconfig - New config with default answer to all options'
@echo ' allmodconfig - New config selecting modules when possible'
@echo ' allyesconfig - New config where all options are accepted with yes'
@@ -79,11 +74,9 @@
# Based on GTK which needs to be installed to compile it
# object files used by all kconfig flavours
-hostprogs-y := conf mconf qconf gconf kxgettext
-conf-objs := conf.o zconf.tab.o
+hostprogs-y := conf mconf qconf gconf
+conf-objs := conf.o auto_conf.o xmlparser.o xmlutil.o zconf.tab.o
mconf-objs := mconf.o zconf.tab.o
-kxgettext-objs := kxgettext.o zconf.tab.o
-
ifeq ($(MAKECMDGOALS),xconfig)
qconf-target := 1
endif
@@ -115,11 +108,7 @@
HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \
-D LKC_DIRECT_LINK
-$(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o $(obj)/kxgettext: $(obj)/zconf.tab.h
-
-$(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped
-$(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped
-$(obj)/lex.zconf.c: $(src)/lex.zconf.c_shipped
+$(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o: $(obj)/zconf.tab.h
$(obj)/qconf.o: $(obj)/.tmp_qtcheck
diff -urN linux.org/scripts/kconfig/rules/4gbmem.pm linux-2.6.13/scripts/kconfig/rules/4gbmem.pm
--- linux.org/scripts/kconfig/rules/4gbmem.pm 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/rules/4gbmem.pm 2005-09-06 11:07:42.000000000 +0200
@@ -0,0 +1,14 @@
+#!/usr/bin/perl
+
+$mem_var=`cat /proc/meminfo | grep MemTotal`;
+chop($mem_var);
+$mem_var=~/['0-9']+/g;
+$mem_var=$&;
+
+if(4290000 < $mem_var && $mem_var < 640000000) {
+ print("y\n");
+}
+
+else {
+ print("n\n");
+}
diff -urN linux.org/scripts/kconfig/rules/arch.pm linux-2.6.13/scripts/kconfig/rules/arch.pm
--- linux.org/scripts/kconfig/rules/arch.pm 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/rules/arch.pm 2005-09-15 12:16:19.000000000 +0200
@@ -0,0 +1,9 @@
+#!/usr/bin/perl
+
+$test='';
+$test=`uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/`;
+chop($test);
+if($test eq "@ARGV"){ print("y\n");}
+else{print("n\n");}
+1;
+
diff -urN linux.org/scripts/kconfig/rules/cpugrep.pm linux-2.6.13/scripts/kconfig/rules/cpugrep.pm
--- linux.org/scripts/kconfig/rules/cpugrep.pm 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/rules/cpugrep.pm 2005-09-06 11:07:42.000000000 +0200
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+
+#########################################################################
+# #
+# cpugrep can be used with a Parameter. #
+# It searches after the name of the cpu. #
+# If there is a success it gives a y to stout. #
+# #
+#########################################################################
+
+
+$found='';
+$found=`grep "@ARGV" /proc/cpuinfo`;
+
+if ($found ne '') {
+ print("y\n");
+}
+
+else {
+ print("n\n");
+}
+1;
+
diff -urN linux.org/scripts/kconfig/rules/getchar.pm linux-2.6.13/scripts/kconfig/rules/getchar.pm
--- linux.org/scripts/kconfig/rules/getchar.pm 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/rules/getchar.pm 2005-09-06 11:07:42.000000000 +0200
@@ -0,0 +1,3 @@
+#!/usr/bin/perl
+
+getc();
diff -urN linux.org/scripts/kconfig/rules/highmem.pm linux-2.6.13/scripts/kconfig/rules/highmem.pm
--- linux.org/scripts/kconfig/rules/highmem.pm 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/rules/highmem.pm 2005-09-06 11:07:42.000000000 +0200
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+
+$mem_var=`cat /proc/meminfo | grep MemTotal`;
+chop($mem_var);
+$mem_var=~/['0-9']+/g;
+$mem_var=$&;
+
+if($mem_var > 640000000){
+ print("y\n");
+ }
+
+else{print("n\n");}
diff -urN linux.org/scripts/kconfig/rules/hw_egrep.pm linux-2.6.13/scripts/kconfig/rules/hw_egrep.pm
--- linux.org/scripts/kconfig/rules/hw_egrep.pm 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/rules/hw_egrep.pm 2005-09-06 11:07:42.000000000 +0200
@@ -0,0 +1,17 @@
+#!/usr/bin/perl
+
+$found='';
+$found=`lspci | grep -E "@ARGV" `;
+if($found ne '') {
+ print("y\n");
+}
+else {
+ $found=`grep -E "@ARGV" /var/log/dmesg `;
+ if($found ne '') {
+ print("y\n");
+ }
+ else {
+ print("n\n");
+ }
+}
+1;
diff -urN linux.org/scripts/kconfig/rules/hw_grep.pm linux-2.6.13/scripts/kconfig/rules/hw_grep.pm
--- linux.org/scripts/kconfig/rules/hw_grep.pm 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/rules/hw_grep.pm 2005-09-15 12:16:09.000000000 +0200
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+#########################################################################
+# #
+# hw_grep can be used with a Parameter. #
+# It searches then in lspci after the Name of the Parameter #
+# If there is a success it gives a y to stout. #
+# #
+#########################################################################
+
+$found='';
+$found=`lspci | grep "@ARGV"`;
+if($found ne '') {
+ print("y\n");
+}
+else {
+ $found=`grep -E "@ARGV" /var/log/dmesg `;
+ if($found ne ''){
+ print("y\n");
+ }
+ else {
+ print("n\n");
+ }
+}
+1;
+
diff -urN linux.org/scripts/kconfig/rules/mod1.pm linux-2.6.13/scripts/kconfig/rules/mod1.pm
--- linux.org/scripts/kconfig/rules/mod1.pm 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/rules/mod1.pm 2005-09-06 11:07:42.000000000 +0200
@@ -0,0 +1,5 @@
+#!/usr/bin/perl
+
+
+print("m\n");
+
diff -urN linux.org/scripts/kconfig/rules/offhimem.pm linux-2.6.13/scripts/kconfig/rules/offhimem.pm
--- linux.org/scripts/kconfig/rules/offhimem.pm 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/rules/offhimem.pm 2005-09-06 11:07:42.000000000 +0200
@@ -0,0 +1,12 @@
+#!/usr/bin/perl
+
+$mem_var=`cat /proc/meminfo | grep MemTotal`;
+chop($mem_var);
+$mem_var=~/['0-9']+/g;
+$mem_var=$&;
+
+if($mem_var < 4290000){
+ print("y\n");
+ }
+
+else{print("n\n");}
diff -urN linux.org/scripts/kconfig/rules/rules_list.xml linux-2.6.13/scripts/kconfig/rules/rules_list.xml
--- linux.org/scripts/kconfig/rules/rules_list.xml 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/rules/rules_list.xml 2005-09-13 17:54:13.000000000 +0200
@@ -0,0 +1,301 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rules>
+ <menu name="Code maturity level options">
+ <option name="Prompt for development and/or incomplete code/drivers"> yes1.pm</option>
+ <option name="Select only drivers expected to compile cleanly">yes1.pm</option>
+ </menu>
+ <menu name="General setup">
+ <option name="Support for paging of anonymous memory (swap)"> yes1.pm</option>
+ <option name="System V IPC">yes1.pm</option>
+ <option name="Sysctl support">yes1.pm</option>
+ <option name="Support for hot-pluggable devices">yes1.pm</option>
+ <option name="Kernel Userspace Events">yes1.pm</option>
+ <option name="Kernel .config support">yes1.pm</option>
+ <option name="Enable access to .config through /proc/config.gz">yes1.pm</option>
+ </menu>
+ <menu name="Loadable module support">
+ <option name="Enable loadable module support">yes1.pm</option>
+ <option name="Module unloading">yes1.pm</option>
+ <option name="Forced module unloading">yes1.pm</option>
+ <option name="Module versioning support (EXPERIMENTAL)">yes1.pm</option>
+ <option name="Automatic kernel module loading">yes1.pm</option>
+ </menu>
+ <menu name="Processor type and features">
+ <menu name="Subarchitecture Type" must_have="1">
+ <option name="PC-compatible">arch.pm i386</option>
+ </menu>
+ <menu name="Processor family" must_have="1">
+ <option name="Pentium M">cpugrep.pm "Pentium(R) M"</option>
+ <option name="Athlon/Duron/K7">cpugrep.pm "Athlon"</option>
+ <option name="Pentium-4/Celeron(P4-based)/Pentium-4 M/Xeon">cpugrep.pm "Pentium(R) 4"</option>
+ </menu>
+ <option name="Preemptible Kernel">yes1.pm</option>
+ <option name="Local APIC support on uniprocessors">yes1.pm</option>
+ <option name="IO-APIC support on uniprocessors">yes1.pm</option>
+ <option name="Machine Check Exception">yes1.pm</option>
+ <option name="/dev/cpu/*/msr - Model-specific register support">mod1.pm</option>
+ <option name="/dev/cpu/*/cpuid - CPU information support">yes1.pm</option>
+ <menu name="High Memory Support">
+ <option name="off">offhimem.pm</option>
+ <option name="4GB">4gbmem.pm</option>
+ <option name="64GB">highmem.pm</option>
+ </menu>
+ <option name="MTRR (Memory Type Range Register) support">yes1.pm</option>
+ </menu>
+ <menu name="Power management menus (ACPI, APM)">
+ <option name="Power Management support">yes1.pm</option>
+ <option name="Software Suspend (EXPERIMENTAL)">yes1.pm</option>
+ <option name="Sleep States (EXPERIMENTAL)">yes1.pm</option>
+ <menu name="ACPI (Advanced Configuration and Power Interface) Support">
+ <option name="ACPI Support">PentiumM.pm</option>
+ <option name="AC Adapter">yes1.pm</option>
+ <option name="Button">yes1.pm</option>
+ <menu name="Video">mod1.pm</menu>
+ <option name="Fan">yes1.pm</option>
+ <option name="Processor">yes1.pm</option>
+ <option name="Thermal Zone">yes1.pm</option>
+ </menu>
+ <menu name="APM (Advanced Power Management) BIOS Support">
+ <option name="APM (Advanced Power Management) BIOS support">mod1.pm</option>
+ <option name="RTC stores time in GMT">yes1.pm</option>
+ <option name="Use real mode APM BIOS call to power off">yes1.pm</option>
+ </menu>
+ <menu name="CPU Frequency scaling">
+ <option name="CPU Frequency scaling">yes1.pm</option>
+ <option name="powersave' governor">mod1.pm</option>
+ <option name="'userspace' governor for userspace frequency scaling">mod1.pm</option>
+ <option name="ACPI Processor P-States driver">mod1.pm</option>
+ <option name="Intel Enhanced SpeedStep">cpugrep.pm "Pentium(R) M"</option>
+ </menu>
+ </menu>
+ <menu name="Bus menus (PCI, PCMCIA, EISA, MCA, ISA)" must_have="1">
+ <option name="PCI support">hw_grep.pm "PCI bridge"</option>
+ <option name="PCI device name database">yes1.pm</option>
+ <menu name="PCI Hotplug Support">
+ <option name="Support for PCI Hotplug (EXPERIMENTAL)">mod1.pm</option>
+ <option name="Fake PCI Hotplug driver">mod1.pm</option>
+ </menu>
+ </menu>
+ <menu name=" Executable file formats">
+ <option name="Kernel support for ELF binaries">yes1.pm</option>
+ <option name="Kernel support for a.out and ECOFF binaries">mod1.pm</option>
+ <option name="Kernel support for MISC binaries">mod1.pm</option>
+ </menu>
+ <menu name="Device Drivers">
+ <menu name="Generic Driver Options">
+ <option name="Select only drivers that don't need compile-time external firmware">yes1.pm</option>
+ <option name="Prevent firmware from being built">yes1.pm</option>
+ <option name="Hotplug firmware loading support">mod1.pm</option>
+ </menu>
+ <menu name="ATA/ATAPI/MFM/RLL support" must_have="6">
+ <option name="ATA/ATAPI/MFM/RLL support">hw_egrep.pm "ATA|ATAPI|MFM|RLL"</option>
+ <option name="Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy support">yes1.pm</option>
+ <option name="Include IDE/ATA-2 DISK support">hw_egrep.pm "ATA|IDE"</option>
+ <option name="Use multi-mode by default">yes1.pm</option>
+ <option name="Include IDE/ATAPI CDROM support">yes1.pm</option>
+ <option name="SCSI emulation support">mod1.pm</option>
+ <option name="generic/default IDE chipset support">yes1.pm</option>
+ <option name="PCI IDE chipset support">hw_egrep.pm "IDE|PCI"</option>
+ <option name="Generic PCI IDE Chipset Support">hw_egrep.pm "IDE|PCI"</option>
+ <option name="Generic PCI bus-master DMA support">hw_grep.pm "PCI"</option>
+ <option name="Intel PIIXn chipsets support">hw_egrep.pm "ICH"</option>
+ <option name="VIA82CXXX chipset support">hw_egrep.pm "VT82C*"</option>
+ </menu>
+ <menu name="IEEE 1394 (FireWire) support" must_have="1">
+ <option name="IEEE 1394 (FireWire) support">hw_grep.pm "FireWire (IEEE 1394)"</option>
+ <option name="OUI Database built-in">yes1.pm</option>
+ <option name="OHCI-1394 support">mod1.pm</option>
+ <option name="OHCI-1394 Video support">mod1.pm</option>
+ <option name="SBP-2 support (Harddisks etc.)">mod1.pm</option>
+ <option name="OHCI-DV I/O support">mod1.pm</option>
+ <option name="Raw IEEE1394 I/O support">mod1.pm</option>
+ <option name="IEC61883-1 Plug support">mod1.pm</option>
+ <option name="IEC61883-6 (Audio transmission) support">mod1.pm</option>
+ </menu>
+ <menu name="Networking support" must_have="1">
+ <option name="Networking support">hw_egrep.pm "Network|Ethernet"</option>
+ <menu name="Networking menus">
+ <option name="Packet socket">yes1.pm</option>
+ <option name="Packet socket: mmapped IO">yes1.pm</option>
+ <option name="Unix domain sockets">yes1.pm</option>
+ <option name="PF_KEY sockets">mod1.pm</option>
+ <option name="TCP/IP networking">yes1.pm</option>
+ <option name="IP: multicasting">yes1.pm</option>
+ <option name="IP: AH transformation">mod1.pm</option>
+ <option name="IP: ESP transformation">mod1.pm</option>
+ <option name="IP: IPComp transformation">mod1.pm</option>
+ <option name="IP: tunnel transformation">mod1.pm</option>
+ <option name="IP: TCP socket monitoring interface">yes1.pm</option>
+ <option name="Network packet filtering (replaces ipchains)">yes1.pm</option>
+ <menu name="Network packet filtering (replaces ipchains)">
+ <menu name="IP: Netfilter Configuration">
+ <option name="Connection tracking (required for masq/NAT)">mod1.pm</option>
+ <option name="FTP protocol support">mod1.pm</option>
+ <option name="IRC protocol support">mod1.pm</option>
+ <option name="IRC protocol support">mod1.pm</option>
+ <option name="IP tables support (required for filtering/masq/NAT)">mod1.pm</option>
+ <option name="limit match support">mod1.pm</option>
+ <option name="MAC address match support">mod1.pm</option>
+ <option name="Packet type match support">mod1.pm</option>
+ <option name="netfilter MARK match support">mod1.pm</option>
+ <option name="Multiple port match support">mod1.pm</option>
+ <option name="TOS match support">mod1.pm</option>
+ <option name="ECN match support">mod1.pm</option>
+ <option name="DSCP target support">mod1.pm</option>
+ <option name="MARK target support">mod1.pm</option>
+ <option name="ARP tables support">mod1.pm</option>
+ </menu>
+ </menu>
+ <option name="IPsec user configuration interface">mod1.pm</option>
+ </menu>
+ <option name="Network device support">hw_egrep.pm "Network|Ethernet"</option>
+ <menu name="Ethernet (10 or 100Mbit)" must_have="1">
+ <option name="Ethernet (10 or 100Mbit)">yes1.pm</option>
+ <option name="Generic Media Independent Interface device support">yes1.pm</option>
+ <option name="EISA, VLB, PCI and on board controllers">yes1.pm</option>
+ <option name="3COM cards">hw_grep.pm "3Com"</option>
+ <option name="3c590/3c900 series (592/595/597) "Vortex/Boomerang" support">mod1.pm</option>
+ <option name="3cr990 series "Typhoon" support">mod1.pm</option>
+ <option name="Intel(R) PRO/100+ support">hw_grep.pm "PRO/100"</option>
+ <option name="RealTek RTL-8129/8130/8139 PCI Fast Ethernet Adapter support">
+ hw_egrep.pm "RTL-8129|RTL-8130|RTL-8139"</option>
+ <option name="RealTek RTL-8139 PCI Fast Ethernet Adapter support">hw_grep.pm "RTL-8139"</option>
+ <option name="Support for uncommon RTL-8139 rev. K (automatic channel equalization)">yes1.pm</option>
+ </menu>
+ <menu name="Wireless LAN (non-hamradio)" must_have="1">
+ <option name="Wireless LAN drivers (non-hamradio) & Wireless Extensions">hw_egrep.pm "Wireless|WLan|WLAN"</option>
+ <option name="STRIP (Metricom starmode radio IP)">mod1.pm</option>
+ <option name="Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)">mod1.pm</option>
+ <option name="Prism 2.5 PCI 802.11b adaptor support (EXPERIMENTAL)">mod1.pm</option>
+ </menu>
+ <option name="PLIP (parallel port) support">mod1.pm</option>
+ <option name="PPP (point-to-point protocol) support">mod1.pm</option>
+ <option name="PPP multilink support (EXPERIMENTAL)">yes1.pm</option>
+ <option name="PPP support for async serial ports">mod1.pm</option>
+ <option name="PPP support for sync tty ports">mod1.pm</option>
+ <option name="PPP Deflate compression">mod1.pm</option>
+ <option name="PPP BSD-Compress compression">mod1.pm</option>
+ <option name="PPP over Ethernet (EXPERIMENTAL)">mod1.pm</option>
+ </menu>
+ <menu name="Input device suppor">
+ <option name="Provide legacy /dev/psaux device">yes1.pm</option>
+ <option name="Event interface">yes1.pm</option>
+ <option name="Mice">yes1.pm</option>
+ <option name="PS/2 mouse">yes1.pm</option>
+ </menu>
+ <menu name="Character devices" must_have="2">
+ <option name="Legacy (BSD) PTY support">yes1.pm</option>
+ <option name="/dev/agpgart (AGP Support)">hw_grep.pm "AGP"</option>
+ <option name="Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)">hw_egrep.pm "Rage|Radeon|Banshee|Voodoo"</option>
+ <option name="ATI Radeon">hw_grep.pm "Radeon"</option>
+ <option name="NVIDIA nForce/nForce2 chipset support">hw_egrep.pm "*Force*"</option>
+ <option name="Intel 830M, 845G, 852GM, 855GM, 865G">hw_egrep.pm "830M|845G|852GM|855GM|865G"</option>
+
+ </menu>
+ <menu name="Multimedia devices">
+ <option name="Video For Linux">mod1.pm</option>
+ </menu>
+ <menu name="Graphics support" must_have="2">
+ <option name="Support for frame buffer devices">hw_grep.pm "VGA"</option>
+ <option name="ATI Radeon display support">hw_grep.pm "Radeon"</option>
+ <option name="Intel 830M/845G/852GM/855GM/865G support">hw_egrep.pm "830M|845G|852GM|855GM|865G"</option>
+ <option name="nVidia Riva support">hw_egrep.pm "Riva|GeForce"</option>
+ <option name="DDC/I2C for ATI Radeon support">yes1.pm</option>
+ <menu name="Console display driver support">
+ <option name="Video mode selection support">yes1.pm</option>
+ <option name="Framebuffer Console support">yes1.pm</option>
+ </menu>
+ <menu name="Logo configuration">
+ <option name="Bootup logo">yes1.pm</option>
+ <option name="Standard 224-color Linux logo">yes1.pm</option>
+ </menu>
+ </menu>
+ <menu name="Sound" must_have="1">
+ <option name="Sound card support">hw_grep.pm "audio"</option>
+ <menu name="Advanced Linux Sound Architecture" must_have="1">
+ <option name="Advanced Linux Sound Architecture">hw_grep.pm "audio"</option>
+ <option name="Sequencer support">yes1.pm</option>
+ <option name="OSS Mixer API">yes1.pm</option>
+ <option name="OSS PCM (digital audio) API">yes1.pm</option>
+ <option name="OSS Sequencer API">yes1.pm</option>
+ </menu>
+ <menu name="Generic devices">
+ <option name="Virtual MIDI soundcard">mod1.pm</option>
+ <option name="MOTU MidiTimePiece AV multiport MIDI">mod1.pm</option>
+ <option name="UART16550 serial MIDI driver">mod1.pm</option>
+ <option name="Generic MPU-401 UART driver">mod1.pm</option>
+ </menu>
+ <menu name="PCI devices" must_have="1">
+ <option name="Intel/SiS/nVidia/AMD/ALi AC97 Controller">hw_egrep.pm "Intel|SiS|nVidia|AMD|ALi AC'97"
+</option>
+ <option name="(Creative) Ensoniq AudioPCI 1370">hw_egrep.pm "Ensoniq|AudioPCI"</option>
+ <option name="(Creative) Ensoniq AudioPCI 1371/1373">hw_egrep.pm "Ensoniq|AudioPCI"</option>
+ </menu>
+ </menu>
+ <menu name="USB support" must_have="3">
+ <option name="Support for Host-side USB">hw_grep.pm "USB"</option>
+ <option name="USB device filesystem">yes1.pm</option>
+ <option name="Enforce USB bandwidth allocation">yes1.pm</option>
+ <option name="EHCI HCD (USB 2.0) support">hw_grep.pm "EHCI"</option>
+ <option name="UHCI HCD (most Intel and VIA) support">hw_grep.pm "UHCI"</option>
+ <option name="USB Human Interface Device (full HID) support">yes1.pm</option>
+ <option name="USB Audio support">mod1.pm</option>
+ <option name="USB Bluetooth TTY support">mod1.pm</option>
+ <option name="USB MIDI support">mod1.pm</option>
+ <option name="USB Modem (CDC ACM) support">mod1.pm</option>
+ <option name="USB Printer support">mod1.pm</option>
+ <option name="USB Mass Storage support">mod1.pm</option>
+ <option name="USB Mass Storage verbose debug">yes1.pm</option>
+ <option name="Freecom USB/ATAPI Bridge support">yes1.pm</option>
+ <option name="ISD-200 USB/ATA Bridge support">yes1.pm</option>
+ <option name="Microtech/ZiO! CompactFlash/SmartMedia support">yes1.pm</option>
+ <option name="HP CD-Writer 82xx support (EXPERIMENTAL)">yes1.pm</option>
+ <option name="SanDisk SDDR-09 (and other SmartMedia) support (EXPERIMENTAL)">yes1.pm</option>
+ <option name="SanDisk SDDR-55 SmartMedia support (EXPERIMENTAL)">yes1.pm</option>
+ <option name="Lexar Jumpshot Compact Flash Reader (EXPERIMENTAL)">yes1.pm</option>
+ <option name="USB testing driver (DEVELOPMENT)">mod1.pm</option>
+ </menu>
+ </menu>
+ <menu name="File systems">
+ <option name="Second extended fs support">yes1.pm</option>
+ <option name="Ext3 journalling file system support">yes1.pm</option>
+ <option name="Ext3 extended attributes">yes1.pm</option>
+ <option name="Kernel automounter version 4 support (also supports v3)">yes1.pm</option>
+ <menu name="CD-ROM/DVD Filesystems">
+ <option name="ISO 9660 CDROM file system support">mod1.pm</option>
+ <option name="Microsoft Joliet CDROM extensions">yes1.pm</option>
+ <option name="Transparent decompression extension">yes1.pm</option>
+ <option name="UDF file system support">mod1.pm</option>
+ </menu>
+ <menu name="DOS/FAT/NT Filesystems">
+ <option name="MSDOS fs support">mod1.pm</option>
+ <option name="VFAT (Windows-95) fs support">mod1.pm</option>
+ </menu>
+ <menu name="Pseudo filesystems">
+ <option name="/proc file system support">yes1.pm</option>
+ <option name="/proc/kcore support">yes1.pm</option>
+ </menu>
+ <menu name="Native Language Support">
+ <option name="Base native language support">yes1.pm</option>
+ <option name="Codepage 437 (United States, Canada)">yes1.pm</option>
+ <option name="NLS ISO 8859-1 (Latin 1; Western European Languages)">yes1.pm</option>
+ <option name="NLS ISO 8859-15 (Latin 9; Western European Languages with Euro)"
+ >yes1.pm</option>
+ </menu>
+ </menu>
+ <menu name="Kernel hacking">
+ <option name="Kernel debugging">yes1.pm</option>
+ <option name="Magic SysRq key">yes1.pm</option>
+ </menu>
+ <menu name="Cryptographic menus">
+ <option name="Cryptographic API">yes1.pm</option>
+ <option name="SHA1 digest algorithm">mod1.pm</option>
+ <option name="ARC4 cipher algorithm">mod1.pm</option>
+ <option name="Deflate compression algorithm">mod1.pm</option>
+ <option name="CRC32c CRC algorithm">mod1.pm</option>
+ </menu>
+ <menu name="Library routines">
+ <option name="CRC-CCITT functions">mod1.pm</option>
+ <option name="CRC32c (Castagnoli, et al) Cyclic Redundancy-Check">mod1.pm</option>
+ </menu>
+</rules>
diff -urN linux.org/scripts/kconfig/rules/yes1.pm linux-2.6.13/scripts/kconfig/rules/yes1.pm
--- linux.org/scripts/kconfig/rules/yes1.pm 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/rules/yes1.pm 2005-09-06 11:07:42.000000000 +0200
@@ -0,0 +1,5 @@
+#!/usr/bin/perl
+
+
+print("yes\n");
+
diff -urN linux.org/scripts/kconfig/xmlparser.c linux-2.6.13/scripts/kconfig/xmlparser.c
--- linux.org/scripts/kconfig/xmlparser.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/xmlparser.c 2005-09-06 11:07:42.000000000 +0200
@@ -0,0 +1,919 @@
+/***************************************************************************
+ * *
+ * Simple XML Parser. *
+ * copyright (C) Tim Hockin <thockin@hockin.org> *
+ * *
+ * Heavily modified by *
+ * copyright (C) 2004, 2005 Michael Buesch <mbuesch@freenet.de> *
+ * *
+ * Released under the LGPL version 2.1 (http://www.gnu.org) *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version 2.1 *
+ * as published by the Free Software Foundation. *
+ * *
+ ***************************************************************************/
+
+#include "xmlparser.h"
+#include "xmlutil.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#define XML_PAGE "<fieldbus name=Ahmad length=12><board type=INTEL>Asus</board><board><board device name>\
+ /dev/pbboard0</board device name></board></fieldbus>"
+
+
+#define STRING_CAP_STEP 100 /* byte */
+
+
+struct xml_context
+{
+ const char *buf;
+ size_t size;
+ size_t pos;
+ unsigned int lineno;
+};
+
+typedef enum xml_state
+{
+ ST_TAGSTART,
+ ST_START_STAG,
+ ST_STAG_NAME_DONE,
+ ST_PROPNAME,
+ ST_GETEQ,
+ ST_GOTEQ,
+ ST_PROPVAL,
+ ST_SQ_PROPVAL,
+ ST_POST_PROPVAL,
+ ST_END_SETAG,
+ ST_END_STAG,
+ ST_CONTENT,
+ ST_MAYBE_COMMENT,
+ ST_NEWTAG_START,
+ ST_START_ETAG,
+ ST_ETAG_NAME,
+ ST_END_ETAG
+} state_t;
+
+
+struct xml_element* get_first_child(struct xml_element *parent){
+
+ if(parent->first_child)
+ return parent->first_child;
+ return NULL;
+}
+
+struct xml_element* get_next_element(struct xml_element *element, struct xml_element *child){
+
+ if(child)
+ return child->next;
+
+ return NULL;
+
+}
+
+struct xml_element* get_next_node(struct xml_element *element){
+
+ if(element->next)
+ return element->next;
+ return NULL;
+
+}
+
+char * get_element_name(struct xml_element *element){
+
+ if(element->name)
+ return element->name->s;
+ return 0;
+}
+
+char * get_element_content(struct xml_element *element){
+
+ if(element->content)
+ return element->content->s;
+ return 0;
+}
+struct xml_prop *get_next_attribute( struct xml_element *element, struct xml_prop* attribute){
+ if(!element->first_prop)
+ return NULL;
+ if(attribute){
+ return attribute->next;}
+ else
+ return element->first_prop;
+}
+
+char *get_attribute_name(struct xml_prop* attribute){
+ if(attribute->name->s)
+ return attribute->name->s;
+ return NULL;
+}
+
+
+char *get_attribute_value(struct xml_prop* attribute){
+ return attribute->value->s;
+}
+
+struct xml_element *get_element_parent(struct xml_element *element){
+ if(element->parent)
+ return element->parent;
+ else return NULL;
+}
+
+
+
+
+static struct xml_string * alloc_xml_string(void)
+{
+ struct xml_string *s;
+
+ s = malloc(sizeof(*s));
+ if (!s) {
+ printf("Out of memory\n");
+ return 0;
+ }
+ s->s = malloc(STRING_CAP_STEP);
+ if (!s->s) {
+ printf("Out of memory\n");
+ free(s);
+ return 0;
+ }
+ s->s[0] = '\0';
+ s->size = 0;
+ s->_capacity = STRING_CAP_STEP;
+
+ return s;
+}
+
+static void free_xml_string(struct xml_string *s)
+{
+ if (!s)
+ return;
+ free(s->s);
+ free(s);
+}
+
+static int xml_string_append_c(struct xml_string *s, char c)
+{
+ if (s->size + 1 == s->_capacity) {
+ size_t new_cap;
+ char *new_buf;
+
+ new_cap = s->_capacity + STRING_CAP_STEP;
+ new_buf = realloc(s->s, new_cap);
+ if (!new_buf) {
+ printf("Out of memory\n");
+ return 1;
+ }
+ s->s = new_buf;
+ s->_capacity = new_cap;
+ }
+ s->size++;
+ s->s[s->size - 1] = c;
+ s->s[s->size] = '\0';
+ return 0;
+}
+
+static int xml_string_copy(struct xml_string *to, struct xml_string *from)
+{
+ if (from->size + 1 > to->_capacity) {
+ char *new_buf;
+
+ new_buf = realloc(to->s, from->size + 1);
+ if (!new_buf) {
+ printf("Out of memory\n");
+ return 1;
+ }
+ to->s = new_buf;
+ to->_capacity = from->size + 1;
+ }
+ memcpy(to->s, from->s, from->size + 1);
+ to->size = from->size;
+ return 0;
+}
+
+static void xml_string_clear(struct xml_string *s)
+{
+ s->size = 0;
+ /* We don't reset capacity here. */
+}
+
+static struct xml_prop * alloc_xml_prop(void)
+{
+ struct xml_prop *p;
+
+ p = malloc(sizeof(*p));
+ if (!p) {
+ printf("Out of memory\n");
+ return 0;
+ }
+ p->name = alloc_xml_string();
+ if (!p->name) {
+ free(p);
+ return 0;
+ }
+ p->value = alloc_xml_string();
+ if (!p->value) {
+ free_xml_string(p->name);
+ free(p);
+ return 0;
+ }
+ p->next = 0;
+ p->prev = 0;
+
+ return p;
+}
+
+static void free_xml_prop(struct xml_prop *p)
+{
+ if (!p)
+ return;
+ free_xml_string(p->value);
+ free_xml_string(p->name);
+ free(p);
+}
+
+static struct xml_element * alloc_xml_element(void)
+{
+ struct xml_element *e;
+
+ e = malloc(sizeof(*e));
+ if (!e) {
+ printf("Out of memory\n");
+ return 0;
+ }
+ e->name = alloc_xml_string();
+ if (!e->name) {
+ free(e);
+ return 0;
+ }
+ e->content = alloc_xml_string();
+ if (!e->content) {
+ free_xml_string(e->name);
+ free(e);
+ return 0;
+ }
+ e->first_prop = 0;
+ e->last_prop = 0;
+ e->first_child = 0;
+ e->last_child = 0;
+ e->next = 0;
+ e->prev = 0;
+ e->parent = 0;
+ return e;
+}
+
+void xml_free_element(struct xml_element *e)
+{
+ struct xml_element *child;
+ struct xml_prop *prop;
+
+ if (!e)
+ return;
+
+ child = e->first_child;
+ while (child) {
+ struct xml_element *del;
+
+ del = child;
+ child = child->next;
+ xml_free_element(del);
+ }
+
+ prop = e->first_prop;
+ while (prop) {
+ struct xml_prop *del;
+
+ del = prop;
+ prop = prop->next;
+ free_xml_prop(del);
+ }
+
+ free_xml_string(e->name);
+ free_xml_string(e->content);
+ free(e);
+}
+
+static void xml_element_append_child(struct xml_element *parent,
+ struct xml_element *child)
+{
+ child->next = 0;
+ child->prev = 0;
+ if (!parent->first_child)
+ parent->first_child = child;
+ if (parent->last_child) {
+ parent->last_child->next = child;
+ child->prev = parent->last_child;
+ }
+ parent->last_child = child;
+ child->parent=parent;
+}
+
+static void xml_element_append_prop(struct xml_element *e,
+ struct xml_prop *prop)
+{
+ prop->next = 0;
+ prop->prev = 0;
+ if (!e->first_prop)
+ e->first_prop = prop;
+ if (e->last_prop) {
+ e->last_prop->next = prop;
+ prop->prev = e->last_prop;
+ }
+ e->last_prop = prop;
+}
+
+static int is_name_start(char c)
+{
+ return (simple_isalpha(c) || c == '_' || c == ':');
+}
+
+static int is_name(char c)
+{
+ return (is_name_start(c) ||
+ simple_isdigit(c) ||
+ c == '.' ||
+ c == '-');
+}
+
+static int next_char(struct xml_context *ctx, char *c)
+{
+ if (ctx->pos == ctx->size){
+ return 0;}
+ *c = ctx->buf[ctx->pos];
+
+ if (*c == '\0'){
+ return 0;}
+ if (*c == '\n'){
+ ctx->lineno++;}
+ ctx->pos++;
+ return 1;
+}
+
+static void prolog(struct xml_context *ctx)
+{
+ char cur = ' ';
+ char prev = ' ';
+
+ while (next_char(ctx, &cur)) {
+ if (cur == '>' && prev == '?')
+ return;
+ prev = cur;
+ }
+}
+
+static void comment(struct xml_context *ctx)
+{
+ char cur = ' ';
+ char prev = ' ';
+ char prev2 = ' ';
+
+ while (next_char(ctx, &cur)) {
+ if (cur == '>' && prev == '-' && prev2 == '-')
+ return;
+ prev2 = prev;
+ prev = cur;
+ }
+}
+
+static char unescape(struct xml_context *ctx)
+{
+ char buf[16];
+ unsigned int i = 0;
+ const char *escapes[] = {
+ "lt;",
+ "gt;",
+ "amp;",
+ "apos;",
+ "quot;",
+ "nbsp;",
+ NULL
+ };
+ const char esc_vals[] = {
+ '<',
+ '>',
+ '&',
+ '\'',
+ '"',
+ ' ',
+ '\0'
+ };
+
+ /* we assume we got a '&' before we got here */
+ if (!next_char(ctx, buf + i)) {
+ printf("ERROR: premature EOF (line %d)\n", ctx->lineno);
+ return -1;
+ }
+ while ((buf[i] != ';') && (!simple_isspace(buf[i])) && (i < sizeof(buf)-1)) {
+ i++;
+ if (!next_char(ctx, buf + i)) {
+ printf("ERROR: premature EOF (line %d)\n", ctx->lineno);
+ return -1;
+ }
+ }
+ buf[i + 1] = '\0';
+
+ /* got an escape */
+ if (buf[i] == ';') {
+ i = 0;
+ /* got a &# style escape */
+ if (buf[0] == '#') {
+ char charesc = -1;
+ int base = 10;
+ i++;
+ if (simple_tolower(buf[i]) == 'x') {
+ base = 16;
+ i++;
+ }
+ while (buf[i] != ';') {
+ int decval;
+
+ /* convert buf[i]) */
+ if (simple_isdigit(buf[i])) {
+ decval = buf[i] - '0';
+ } else if (simple_isxdigit(buf[i])) {
+ decval = (simple_tolower(buf[i]) - 'a') + 10;
+ } else {
+ return -1;
+ }
+ charesc *= base;
+ charesc += decval;
+ }
+ return charesc;
+ }
+ /* got a 'normal' escape */
+ while (escapes[i]) {
+ if (!simple_strcasecmp(buf, escapes[i])) {
+ return esc_vals[i];
+ }
+ i++;
+ }
+ }
+
+ return -1;
+}
+
+static int add_content_char(struct xml_context *ctx,
+ struct xml_element *e,
+ char c)
+{
+ if (e->content->size == 0) {
+ /* This is the first phase of the content
+ * string whitespace cleanup.
+ * Second phase is in cleanup_string()
+ */
+ if (simple_isspace(c) || c == '\n'){
+
+ return 0;}
+ }
+ return xml_string_append_c(e->content, c);
+}
+
+static void cleanup_string(struct xml_string *s)
+{
+ size_t i;
+ char c;
+
+ /* This is the second phase of the content
+ * string whitespace cleanup.
+ * The first phase is in add_content_char()
+ */
+ if (s->size <= 0)
+ return;
+ i = s->size - 1;
+ do {
+ c = s->s[i];
+ } while ((simple_isspace(c) || c == '\n') && (i-- > 0));
+ s->size = i + 1;
+ s->s[s->size] = '\0';
+}
+
+struct xml_element * parse_element(struct xml_context *ctx, char first)
+{
+ char c;
+ state_t state = ST_TAGSTART;
+ struct xml_element *e = 0;
+ struct xml_prop *p = 0;
+ struct xml_element *ret = 0;
+ int flag=0;
+
+ struct xml_string *propname = 0;
+ struct xml_string *propval = 0;
+ struct xml_string *endname = 0;
+
+ ret = alloc_xml_element();
+ if (!ret)
+ goto out_fail;
+ propname = alloc_xml_string();
+ if (!propname)
+ goto out_fail;
+ propval = alloc_xml_string();
+ if (!propval)
+ goto out_fail;
+ endname = alloc_xml_string();
+ if (!endname)
+ goto out_fail;
+
+ /* we got a '<' */
+ if (is_name_start(first)) {
+ if (xml_string_append_c(ret->name, simple_tolower(first)))
+ goto out_fail;
+ state = ST_START_STAG;
+ } else
+ state = ST_TAGSTART;
+
+ while (next_char(ctx, &c)) {
+ switch (state) {
+ /* start */
+ case ST_TAGSTART:
+ if (simple_isspace(c)) {
+ /* state = CURRENT_STATE; */
+ } else if (is_name_start(c)) {
+ if (xml_string_append_c(ret->name, simple_tolower(c)))
+ goto out_fail;
+ state = ST_START_STAG;
+ } else
+ goto out_inval_char;
+ break;
+ /* we got the start of a keyword for an stag */
+ case ST_START_STAG:
+ if (is_name(c)) {
+ if (xml_string_append_c(ret->name, simple_tolower(c)))
+ goto out_fail;
+ /* state = CURRENT_STATE; */
+ } else if (simple_isspace(c))
+ state = ST_STAG_NAME_DONE;
+ else if (c == '>')
+ state = ST_END_STAG;
+ else if (c == '/')
+ state = ST_END_SETAG;
+ else
+ goto out_inval_char;
+ break;
+ /* keyword done - look for next prop or other */
+ case ST_STAG_NAME_DONE:
+ if (simple_isspace(c)) {
+ /* state = CURRENT_STATE; */
+ } else if (c == '>'){
+ state = ST_END_STAG;}
+ else if (c == '/')
+ state = ST_END_SETAG;
+ else if (is_name_start(c)) {
+ /* must be a propname */
+ if (xml_string_append_c(propname, simple_tolower(c)))
+ goto out_fail;
+ state = ST_PROPNAME;
+ } else
+ goto out_inval_char;
+ break;
+ /* found start of a propname */
+ case ST_PROPNAME:
+ if (is_name(c)) {
+ if (xml_string_append_c(propname, simple_tolower(c)))
+ goto out_fail;
+ /* state = CURRENT_STATE; */
+ } else if (c == '=')
+ state = ST_GOTEQ;
+ else if (simple_isspace(c))
+ state = ST_GETEQ;
+ else
+ goto out_inval_char;
+ break;
+ /* got propname, get '=' */
+ case ST_GETEQ:
+ if (simple_isspace(c)) {
+ /* state = CURRENT_STATE; */
+ } else if (c == '=')
+ state = ST_GOTEQ;
+ else
+ goto out_inval_char;
+ break;
+ /* got '=' - find propval */
+ case ST_GOTEQ:
+ if (simple_isspace(c)) {
+ /* state = CURRENT_STATE; */
+ } else if (c == '"')
+ state = ST_PROPVAL;
+ else if (c == '\'')
+ state = ST_SQ_PROPVAL;
+ else
+ goto out_inval_char;
+ break;
+ /* got a quoted propval */
+ case ST_PROPVAL:
+ if (c == '&') {
+ char lc = unescape(ctx);
+ if (lc > 0) {
+ if (xml_string_append_c(propval, lc))
+ goto out_fail;
+ }
+ } else if (c == '"') {
+ p = alloc_xml_prop();
+ if (!p)
+ goto out_fail;
+ if (xml_string_copy(p->name, propname))
+ goto out_fail;
+ if (xml_string_copy(p->value, propval))
+ goto out_fail;
+ xml_element_append_prop(ret, p);
+ p = 0;
+ xml_string_clear(propname);
+ xml_string_clear(propval);
+ state = ST_STAG_NAME_DONE;
+ } else if (c == '<')
+ goto out_inval_char;
+ else {
+ if (xml_string_append_c(propval, c))
+ goto out_fail;
+ /* state = CURRENT_STATE; */
+ }
+ break;
+ /* got a single-quoted propval */
+ case ST_SQ_PROPVAL:
+ if (c == '&') {
+ char lc = unescape(ctx);
+ if (lc > 0) {
+ if (xml_string_append_c(propval, lc))
+ goto out_fail;
+ }
+ } else if (c == '\'') {
+ p = alloc_xml_prop();
+ if (!p)
+ goto out_fail;
+ if (xml_string_copy(p->name, propname))
+ goto out_fail;
+ if (xml_string_copy(p->value, propval))
+ goto out_fail;
+ xml_element_append_prop(ret, p);
+ p = 0;
+ xml_string_clear(propname);
+ xml_string_clear(propval);
+ state = ST_STAG_NAME_DONE;
+ } else if (c == '<') {
+ /* spec says this is an error */
+ goto out_inval_char;
+ } else {
+ if (xml_string_append_c(propval, c))
+ goto out_fail;
+ /* state = CURRENT_STATE; */
+ }
+ break;
+ /* spec says we must have a space between props */
+ case ST_POST_PROPVAL:
+ if (simple_isspace(c))
+ state = ST_STAG_NAME_DONE;
+ else if (c == '>')
+ state = ST_END_STAG;
+ else if (c == '/')
+ state = ST_END_SETAG;
+ else
+ goto out_inval_char;
+ break;
+ /* got a '/', suggesting an empty element */
+ case ST_END_SETAG:
+ if (simple_isspace(c)) {
+ /* state = CURRENT_STATE; */
+ } else if (c == '>')
+ goto out_success;
+ else
+ goto out_inval_char;
+ break;
+ /* time to look for content */
+ case ST_END_STAG:
+ if (simple_isspace(c)) {
+ /* state = CURRENT_STATE; */
+ } else if (c == '&') {
+ char lc = unescape(ctx);
+ if (lc > 0) {
+ if (add_content_char(ctx, ret, lc))
+ goto out_fail;
+ }
+ state = ST_CONTENT;
+ } else if (c == '<'){
+ state = ST_MAYBE_COMMENT;}
+ else {
+ if (add_content_char(ctx, ret, c))
+ goto out_fail;
+ state = ST_CONTENT;
+ }
+ break;
+ /* processing content */
+ case ST_CONTENT:
+ if (simple_isspace(c)) {
+ if (add_content_char(ctx, ret, c)){
+ printf("element %s\n", get_element_name(ret) );
+ printf("fail2\n");
+ goto out_fail;}
+ /* state = CURRENT_STATE; */
+ }
+ else if (c == '<')
+ state = ST_MAYBE_COMMENT;
+ else if (c == '&') {
+ char lc = unescape(ctx);
+ if (lc > 0) {
+ if (add_content_char(ctx, ret, lc))
+ goto out_fail;
+ }
+ }
+ else {
+ if (add_content_char(ctx, ret, c)){
+ goto out_fail;}
+ /* state = CURRENT_STATE; */
+ }
+ break;
+ /* got a '<' - check for a comment */
+ case ST_MAYBE_COMMENT:
+ if (c == '!')
+ comment(ctx);
+ else if (simple_isspace(c))
+ state = ST_NEWTAG_START;
+ else if (c == '/')
+ state = ST_START_ETAG;
+ else {
+ e = parse_element(ctx, c);
+ if (!e)
+ goto out_fail;
+ xml_element_append_child(ret, e);
+ e = 0;
+ state = ST_CONTENT;
+ flag=1;
+ }
+ break;
+ /* got a '<' in content - figure it out */
+ case ST_NEWTAG_START:
+ if (simple_isspace(c)) {
+ /* state = CURRENT_STATE; */
+ } else if (c == '/')
+ state = ST_START_ETAG;
+ else {
+ e = parse_element(ctx, c);
+ if (!e)
+ goto out_fail;
+ xml_element_append_child(ret, e);
+ e = 0;
+ state = ST_CONTENT;
+ }
+ break;
+ /* got a </ */
+ case ST_START_ETAG:
+ if (simple_isspace(c)) {
+ /* state = CURRENT_STATE; */
+ } else if (is_name_start(c)) {
+ if (xml_string_append_c(endname, c))
+ goto out_fail;
+ state = ST_ETAG_NAME;
+ } else
+ goto out_inval_char;
+ break;
+ /* reading all of </name */
+ case ST_ETAG_NAME:
+ if (is_name(c)) {
+ if (xml_string_append_c(endname, c))
+ goto out_fail;
+ /* state = CURRENT_STATE; */
+ } else if (simple_isspace(c))
+ state = ST_END_ETAG;
+ else if (c == '>') {
+ if (ret->name->size == endname->size &&
+ simple_strncasecmp(ret->name->s, endname->s, endname->size) == 0) {
+ goto out_success;
+ } else {
+ /* not a match! */
+ printf("endname (%s) != element->name (%s)\n",
+ endname->s, ret->name->s);
+ state = ST_CONTENT;
+ xml_string_clear(endname);
+ }
+ } else
+ goto out_inval_char;
+ break;
+ /* just get '>' and wrap up */
+ case ST_END_ETAG:
+ if (simple_isspace(c)) {
+ /* state = CURRENT_STATE; */
+ } else if (c == '>') {
+ if (ret->name->size == endname->size &&
+ simple_strncasecmp(ret->name->s, endname->s, endname->size) == 0) {
+ goto out_success;
+ } else {
+ /* not a match! */
+ printf("endname (%s) != element->name (%s)\n",
+ endname->s, ret->name->s);
+ state = ST_CONTENT;
+ xml_string_clear(endname);
+ }
+ } else
+ goto out_inval_char;
+ break;
+ }
+ }
+ printf("ERROR: premature EOF (line %d)\n", ctx->lineno);
+ goto out_fail;
+
+out_inval_char:
+ printf("invalid char '%c' in state %d (line %d)\n",
+ c, state, ctx->lineno);
+out_fail:
+ xml_free_element(ret);
+ xml_free_element(e);
+ free_xml_prop(p);
+ free_xml_string(propname);
+ free_xml_string(propval);
+ free_xml_string(endname);
+ return 0;
+
+out_success:
+ free_xml_string(propname);
+ free_xml_string(propval);
+ free_xml_string(endname);
+ cleanup_string(ret->content);
+ return ret;
+}
+
+int xml_parse_buffer(struct xml_buffer buffer, struct xml_element **ret)
+{
+ struct xml_element *root;
+ struct xml_element *e;
+ struct xml_context ctx;
+ char c;
+ int can_prolog = 1;
+
+ root = alloc_xml_element();
+ strcpy(root->name->s, "root");
+ if (!root)
+ return 1;
+ ctx.buf = buffer.text;
+ ctx.size = buffer.text_size;
+ ctx.pos = 0;
+ ctx.lineno = 1;
+
+ while (next_char(&ctx, &c)) {
+ if (simple_isspace(c))
+ continue;
+ else if (c == '<') {
+ if (!next_char(&ctx, &c))
+ goto out_premat_eof;
+ /* handle a prolog ("<?") */
+ if (c == '?' && can_prolog) {
+ prolog(&ctx);
+ continue;
+ }
+ can_prolog = 0;
+
+ /* handle a comment ("<!") */
+ if (c == '!') {
+ comment(&ctx);
+ continue;
+ }
+
+ e = parse_element(&ctx, c);
+ if (!e)
+ goto out_fail;
+ xml_element_append_child(root, e);
+ } else
+ goto out_inval_char;
+ }
+ //printf("bla");
+ *ret = root;
+ return 0;
+
+out_premat_eof:
+ printf("ERROR: premature EOF (line %d)\n", ctx.lineno);
+ goto out_fail;
+
+out_inval_char:
+ printf("invalid char '%c' in state top (line %d)\n",
+ c, ctx.lineno);
+
+out_fail:
+ printf("out_fail\n");
+ xml_free_element(root);
+ return 1;
+}
+
+struct xml_buffer load_xml_file(char *source){
+
+ FILE *p_InText;
+ struct xml_buffer buffer;
+
+ p_InText = fopen (source , "r");
+
+ if (p_InText == NULL)
+ {
+ printf("Fehler beim lesen der Datei \n");
+ exit(1);
+ } /*End If */
+
+ else
+ {
+ fseek( p_InText, 0 , SEEK_END);
+ buffer.text_size = ftell(p_InText);
+ buffer.text = (char*) malloc(sizeof(char)*buffer.text_size);
+ rewind(p_InText);
+ fread(buffer.text, 1, buffer.text_size, p_InText);
+ return buffer;
+ } /* End else */
+
+}
+
+
diff -urN linux.org/scripts/kconfig/xmlparser.h linux-2.6.13/scripts/kconfig/xmlparser.h
--- linux.org/scripts/kconfig/xmlparser.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/xmlparser.h 2005-09-13 17:52:59.000000000 +0200
@@ -0,0 +1,76 @@
+/***************************************************************************
+ * *
+ * Simple XML Parser. *
+ * copyright (C) Tim Hockin <thockin@hockin.org> *
+ * *
+ * Heavily modified by *
+ * copyright (C) 2004, 2005 Michael Buesch <mbuesch@freenet.de> *
+ * *
+ * Released under the LGPL version 2.1 (http://www.gnu.org) *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version 2.1 *
+ * as published by the Free Software Foundation. *
+ * *
+ ***************************************************************************/
+
+#ifndef PWMANAGER_DUMP_XMLPARSER_H_
+#define PWMANAGER_DUMP_XMLPARSER_H_
+
+#include <stddef.h>
+
+
+struct xml_string
+{
+ char *s;
+ size_t size;
+ /* internal: */
+ size_t _capacity;
+};
+
+struct xml_prop
+{
+ struct xml_string *name;
+ struct xml_string *value;
+
+ struct xml_prop *next;
+ struct xml_prop *prev;
+};
+
+struct xml_element
+{
+ struct xml_string *name;
+ struct xml_string *content;
+
+ struct xml_prop *first_prop;
+ struct xml_prop *last_prop;
+
+ struct xml_element *first_child;
+ struct xml_element *last_child;
+ struct xml_element *parent;
+ struct xml_element *next;
+ struct xml_element *prev;
+ char option_name[128];
+ int m_h_value;
+ int m_h_cnt;
+ int m_h_prior;
+};
+
+struct xml_buffer{
+ char *text;
+ size_t text_size;
+};
+
+int xml_parse_buffer(struct xml_buffer buffer, struct xml_element **ret);
+void xml_free_element(struct xml_element *e);
+
+struct xml_element* get_first_child(struct xml_element *parent);
+struct xml_element* get_next_node(struct xml_element *element);
+char * get_element_name(struct xml_element *element);
+char * get_element_content(struct xml_element *element);
+struct xml_prop *get_next_attribute( struct xml_element *element, struct xml_prop* attribute);
+char *get_attribute_name(struct xml_prop* attribute);
+char *get_attribute_value(struct xml_prop* attribute);
+struct xml_element *get_element_parent(struct xml_element *element);
+struct xml_buffer load_xml_file(char *source);
+
+#endif /* PWMANAGER_DUMP_XMLPARSER_H_ */
diff -urN linux.org/scripts/kconfig/xmlutil.c linux-2.6.13/scripts/kconfig/xmlutil.c
--- linux.org/scripts/kconfig/xmlutil.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/xmlutil.c 2005-09-06 11:07:42.000000000 +0200
@@ -0,0 +1,105 @@
+#include "xmlutil.h"
+
+int simple_isupper(int c)
+{
+ return (c >= 'A' && c <= 'Z');
+}
+
+int simple_islower(int c)
+{
+ return (c >= 'a' && c <= 'z');
+}
+
+int simple_isalpha(int c)
+{
+ return (simple_isupper(c) || simple_islower(c));
+}
+
+int simple_isdigit(int c)
+{
+ return (c >= '0' && c <= '9');
+}
+
+int simple_isdigit_string(const char *s)
+{
+ while (*s) {
+ if (!simple_isdigit(*s))
+ return 0;
+ s++;
+ }
+ return 1;
+}
+
+int simple_isspace(int c)
+{
+ switch (c) {
+ case ' ':
+ case '\f':
+ case '\n':
+ case '\r':
+ case '\t':
+ case '\v':
+ return 1;
+ }
+ return 0;
+}
+
+int simple_tolower(int c)
+{
+ if (!simple_isupper(c))
+ return c;
+ return (c - 'A' + 'a');
+}
+
+int simple_toupper(int c)
+{
+ if (!simple_islower(c))
+ return c;
+ return (c - 'a' + 'A');
+}
+
+int simple_isxdigit(int c)
+{
+ if (simple_isdigit(c))
+ return 1;
+ if (c >= 'A' && c <= 'F')
+ return 1;
+ if (c >= 'a' && c <= 'f')
+ return 1;
+ return 0;
+}
+
+int simple_strcasecmp(const char *s1, const char *s2)
+{
+ unsigned char *c1, *c2;
+
+ c1 = (unsigned char *)s1;
+ c2 = (unsigned char *)s2;
+ while (*c1 && *c2 &&
+ simple_tolower(*c1) == simple_tolower(*c2)) {
+ c1++;
+ c2++;
+ }
+
+ return *c1 - *c2;
+}
+
+int simple_strncasecmp(const char *s1, const char *s2, size_t n)
+{
+ unsigned char *c1, *c2;
+
+ if (n <= 0)
+ return 0;
+ c1 = (unsigned char *)s1;
+ c2 = (unsigned char *)s2;
+ while (*c1 && *c2 &&
+ simple_tolower(*c1) == simple_tolower(*c2)) {
+ n--;
+ if (n <= 0)
+ return 0;
+ c1++;
+ c2++;
+ }
+
+ return *c1 - *c2;
+}
diff -urN linux.org/scripts/kconfig/xmlutil.h linux-2.6.13/scripts/kconfig/xmlutil.h
--- linux.org/scripts/kconfig/xmlutil.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.13/scripts/kconfig/xmlutil.h 2005-09-06 11:07:42.000000000 +0200
@@ -0,0 +1,18 @@
+#ifndef PWMANAGER_DUMP_STRINGCASE_H_
+#define PWMANAGER_DUMP_STRINGCASE_H_
+
+#include <stddef.h>
+
+int simple_isupper(int c);
+int simple_islower(int c);
+int simple_isalpha(int c);
+int simple_isdigit(int c);
+int simple_isdigit_string(const char *s);
+int simple_isspace(int c);
+int simple_tolower(int c);
+int simple_toupper(int c);
+int simple_isxdigit(int c);
+int simple_strcasecmp(const char *s1, const char *s2);
+int simple_strncasecmp(const char *s1, const char *s2, size_t n);
+
+#endif /* PWMANAGER_DUMP_STRINGCASE_H_ */
next prev parent reply other threads:[~2005-09-15 20:58 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-14 22:38 Ahmad Reza Cheraghi
2005-09-14 22:53 ` Michal Piotrowski
2005-09-14 23:49 ` Daniel Thaler
2005-09-15 0:09 ` Marek W
2005-09-15 0:37 ` Hua Zhong
2005-09-15 2:03 ` David Lang
2005-09-15 3:04 ` Lee Revell
2005-09-15 3:37 ` Daniel Thaler
2005-09-15 4:16 ` Lee Revell
2005-09-15 8:12 ` Ahmad Reza Cheraghi
2005-09-15 11:20 ` Masoud Sharbiani
2005-09-15 20:58 ` Ahmad Reza Cheraghi [this message]
2005-09-15 21:04 ` Jesper Juhl
2005-09-15 4:18 ` Marek W
2005-09-15 6:18 ` Valdis.Kletnieks
2005-09-15 7:33 ` Marek W
2005-09-15 9:48 ` Ahmad Reza Cheraghi
2005-09-15 10:44 ` David Lang
2005-09-15 10:26 ` David Lang
2005-09-15 14:58 ` Nix
2005-09-15 17:08 ` David Lang
2005-09-15 20:36 ` Valdis.Kletnieks
2005-09-15 20:50 ` Nix
2005-09-15 8:53 ` Chris White
2005-09-15 7:58 ` Ahmad Reza Cheraghi
2005-09-15 9:12 ` Emmanuel Fleury
2005-09-15 9:56 ` Ahmad Reza Cheraghi
2005-09-16 4:02 ` Chris White
2005-09-16 7:12 ` Emmanuel Fleury
2005-09-16 17:38 ` Pavel Machek
2005-09-16 17:50 ` Enrico Weigelt
2005-09-15 11:21 ` Roman Zippel
2005-09-15 12:01 ` Emmanuel Fleury
2005-09-15 13:02 ` Ahmad Reza Cheraghi
2005-09-15 13:28 ` Emmanuel Fleury
2005-09-15 13:03 ` Ahmad Reza Cheraghi
2005-09-17 1:27 ` Roman Zippel
2005-09-16 8:11 ` Coywolf Qi Hunt
2005-09-16 8:19 ` Emmanuel Fleury
2005-09-16 8:32 ` Ahmad Reza Cheraghi
2005-09-16 8:50 ` Emmanuel Fleury
2005-09-16 9:19 ` Ahmad Reza Cheraghi
2005-09-26 12:08 Ahmad Reza Cheraghi
2005-09-26 13:57 ` Michal Piotrowski
2005-09-26 14:06 ` Michal Piotrowski
2005-09-27 8:05 ` Coywolf Qi Hunt
2005-09-27 8:11 ` Emmanuel Fleury
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050915205837.88151.qmail@web51001.mail.yahoo.com \
--to=a_r_cheraghi@yahoo.com \
--cc=dlang@digitalinsight.com \
--cc=hzhong@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marekw1977@yahoo.com.au \
--cc=rlrevell@joe-job.com \
--cc=thalerd@in.tum.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome