From bae324db5f8f55d20e2f17a7df17e7a8c528fe73 Mon Sep 17 00:00:00 2001 From: Marenz Date: Sat, 20 Feb 2010 22:29:09 +0100 Subject: [PATCH] fixed method output in test and in parser --- src/parser.c | 11 +++++------ src/tests/fake_dns.txt | 1 + src/tests/testParser.c | 8 ++++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/parser.c b/src/parser.c index 135953c..e7bb231 100644 --- a/src/parser.c +++ b/src/parser.c @@ -224,7 +224,11 @@ inline int PSYC_parseElement( return -5; // report error } else + { + *name = data+*cursor; + *nlength=1; method=1; + } } else { @@ -247,12 +251,7 @@ inline int PSYC_parseElement( && data[*cursor] != '_') // AND not '_'. must be invalid then return -1; // return parser error. - if(1 == method) // for the method.. - { - *name=data+*cursor; // the name starts here. - *nlength=1; // the initial length is 1. - }else - *nlength+=1; + *nlength+=1; /* now checking how long the name of the variable is. */ unsigned int i=0; diff --git a/src/tests/fake_dns.txt b/src/tests/fake_dns.txt index 0158dff..ae6cde6 100644 --- a/src/tests/fake_dns.txt +++ b/src/tests/fake_dns.txt @@ -2,5 +2,6 @@ :_source psyc://heise.de/~user _request_some_things +content! | diff --git a/src/tests/testParser.c b/src/tests/testParser.c index 8594bd6..aff1350 100644 --- a/src/tests/testParser.c +++ b/src/tests/testParser.c @@ -54,6 +54,14 @@ int main(int argc, char** argv) write(0,"\n",1); } + if(ret == 3 || ret == 2) + { + write(0,varname,nl); + write(0," = ",3); + write(0,varvalue,vl); + write(0,"\n",1); + } + if(tmp != cursor) tmp=cursor; else