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:
parent
3baf88d81b
commit
6058b8b58c
15 changed files with 14 additions and 23 deletions
|
@ -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)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
:_target psyc://p5B084547.dip.t-dialin.net/@test
|
||||
:_source something
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
:_source psyc://heise.de/~user
|
||||
|
||||
_request_some_things
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
:_source psyc://nonexisting.dns.tld/~user
|
||||
|
||||
_request_some_things
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
:_source psyc://foo/~bar
|
||||
:_target psyc://bar/~baz
|
||||
:_tag sch1828hu3r2cm
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
:_source psyc://foo/~bar
|
||||
:_target psyc://bar/~baz
|
||||
:_tag sch1828hu3r2cm
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
:_source psyc://foo/~bar
|
||||
:_target psyc://bar/~baz
|
||||
:_tag sch1828hu3r2cm
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
:_source psyc://foo/~bar
|
||||
:_target psyc://bar/~baz
|
||||
:_tag sch1828hu3r2cm
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
=_source psyc://foo/~bar
|
||||
:_target psyc://bar/~baz
|
||||
=_list_foo |foo|bar|baz
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
=_source psyc://foo/~bar
|
||||
:_target psyc://bar/~baz
|
||||
=_list_foo foo|bar|baz
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
=_source psyc://foo/~bar
|
||||
:_target psyc://bar/~baz
|
||||
=_list_foo |foo|bar|baz
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
:_list_understand_modules _state|_fragments|_context
|
||||
|
||||
_request_features
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
:_source psyc://test.psyc.eu/~foo
|
||||
:_target psyc://test.psyc.eu/~bar
|
||||
:_tag f00b4rb4z
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
|
||||
:_source psyc://test.psyc.eu/~foo
|
||||
:_target psyc://test2.psyc.eu/~bar
|
||||
:_tag f00b4rb4z
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue