1
0
Fork 0
mirror of git://git.psyc.eu/libpsyc synced 2024-08-15 03:19:02 +00:00

not automatic yet, but at least it exits cleanly

This commit is contained in:
psyc://psyced.org/~lynX 2011-04-26 00:10:02 +02:00
parent a214bb2cae
commit ad415322eb
15 changed files with 14 additions and 23 deletions

View file

@ -8,8 +8,8 @@ all: $(TARGETS)
./testMatch
./isRoutingVar
test:
for f in packets/*; do echo -e "\n>> $$f"; ./testParser $$f; done
test: $(TARGETS)
for f in packets/*; do echo "\n>> $$f"; ./testParser $$f; done
clean:
rm -f $(TARGETS)

View file

@ -1,4 +1,3 @@
|
:_target psyc://p5B084547.dip.t-dialin.net/@test
:_source something

View file

@ -1,4 +1,3 @@
|
:_source psyc://heise.de/~user
_request_some_things

View file

@ -1,4 +1,3 @@
|
:_source psyc://nonexisting.dns.tld/~user
_request_some_things

View file

@ -1,4 +1,3 @@
|
:_source psyc://foo/~bar
:_target psyc://bar/~baz
:_tag sch1828hu3r2cm

View file

@ -1,4 +1,3 @@
|
:_source psyc://foo/~bar
:_target psyc://bar/~baz
:_tag sch1828hu3r2cm

View file

@ -1,4 +1,3 @@
|
:_source psyc://foo/~bar
:_target psyc://bar/~baz
:_tag sch1828hu3r2cm

View file

@ -1,4 +1,3 @@
|
:_source psyc://foo/~bar
:_target psyc://bar/~baz
:_tag sch1828hu3r2cm

View file

@ -1,4 +1,3 @@
|
=_source psyc://foo/~bar
:_target psyc://bar/~baz
=_list_foo |foo|bar|baz

View file

@ -1,4 +1,3 @@
|
=_source psyc://foo/~bar
:_target psyc://bar/~baz
=_list_foo foo|bar|baz

View file

@ -1,4 +1,3 @@
|
=_source psyc://foo/~bar
:_target psyc://bar/~baz
=_list_foo |foo|bar|baz

View file

@ -1,4 +1,3 @@
|
:_list_understand_modules _state|_fragments|_context
_request_features

View file

@ -1,4 +1,3 @@
|
:_source psyc://nb.tgbit.net/~foo
:_target psyc://nb.tgbit.net/~bar
:_tag f00b4rb4z

View file

@ -1,4 +1,3 @@
|
:_source psyc://nb.tgbit.net/~foo
:_target psyc://nb2.tgbit.net/~bar
:_tag f00b4rb4z

View file

@ -17,16 +17,18 @@ int main(int argc, char** argv)
return -1;
indx = read(file,(void*)buffer,sizeof(buffer));
write(1, ">> INPUT\n", 9);
write(1, buffer, indx);
write(1, ">> PARSE\n", 9);
// write(1, ">> INPUT\n", 9);
// write(1, buffer, indx);
// write(1, ">> PARSE\n", 9);
psyc_initParseState(&state);
psyc_nextParseBuffer(&state, psyc_newString(buffer, indx));
// try parsing that now
while ((ret = psyc_parse(&state, &oper, &name, &value)))
{
// while ((ret = psyc_parse(&state, &oper, &name, &value)))
// {
do {
ret = psyc_parse(&state, &oper, &name, &value);
switch (ret)
{
case PSYC_PARSE_ROUTING:
@ -67,15 +69,17 @@ int main(int argc, char** argv)
}
break;
case PSYC_PARSE_COMPLETE:
printf("Done parsing.\n");
// printf("Done parsing.\n");
ret = 0;
continue;
case PSYC_PARSE_INSUFFICIENT:
printf("Insufficient data.\n");
return 0;
return -1;
default:
printf("Error while parsing: %i\n", ret);
return 1;
}
}
} while (ret);
return 0;
}