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
a214bb2cae
commit
ad415322eb
15 changed files with 14 additions and 23 deletions
|
@ -8,8 +8,8 @@ all: $(TARGETS)
|
||||||
./testMatch
|
./testMatch
|
||||||
./isRoutingVar
|
./isRoutingVar
|
||||||
|
|
||||||
test:
|
test: $(TARGETS)
|
||||||
for f in packets/*; do echo -e "\n>> $$f"; ./testParser $$f; done
|
for f in packets/*; do echo "\n>> $$f"; ./testParser $$f; done
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(TARGETS)
|
rm -f $(TARGETS)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
:_target psyc://p5B084547.dip.t-dialin.net/@test
|
:_target psyc://p5B084547.dip.t-dialin.net/@test
|
||||||
:_source something
|
:_source something
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
:_source psyc://heise.de/~user
|
:_source psyc://heise.de/~user
|
||||||
|
|
||||||
_request_some_things
|
_request_some_things
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
:_source psyc://nonexisting.dns.tld/~user
|
:_source psyc://nonexisting.dns.tld/~user
|
||||||
|
|
||||||
_request_some_things
|
_request_some_things
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
:_source psyc://foo/~bar
|
:_source psyc://foo/~bar
|
||||||
:_target psyc://bar/~baz
|
:_target psyc://bar/~baz
|
||||||
:_tag sch1828hu3r2cm
|
:_tag sch1828hu3r2cm
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
:_source psyc://foo/~bar
|
:_source psyc://foo/~bar
|
||||||
:_target psyc://bar/~baz
|
:_target psyc://bar/~baz
|
||||||
:_tag sch1828hu3r2cm
|
:_tag sch1828hu3r2cm
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
:_source psyc://foo/~bar
|
:_source psyc://foo/~bar
|
||||||
:_target psyc://bar/~baz
|
:_target psyc://bar/~baz
|
||||||
:_tag sch1828hu3r2cm
|
:_tag sch1828hu3r2cm
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
:_source psyc://foo/~bar
|
:_source psyc://foo/~bar
|
||||||
:_target psyc://bar/~baz
|
:_target psyc://bar/~baz
|
||||||
:_tag sch1828hu3r2cm
|
:_tag sch1828hu3r2cm
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
=_source psyc://foo/~bar
|
=_source psyc://foo/~bar
|
||||||
:_target psyc://bar/~baz
|
:_target psyc://bar/~baz
|
||||||
=_list_foo |foo|bar|baz
|
=_list_foo |foo|bar|baz
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
=_source psyc://foo/~bar
|
=_source psyc://foo/~bar
|
||||||
:_target psyc://bar/~baz
|
:_target psyc://bar/~baz
|
||||||
=_list_foo foo|bar|baz
|
=_list_foo foo|bar|baz
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
=_source psyc://foo/~bar
|
=_source psyc://foo/~bar
|
||||||
:_target psyc://bar/~baz
|
:_target psyc://bar/~baz
|
||||||
=_list_foo |foo|bar|baz
|
=_list_foo |foo|bar|baz
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
:_list_understand_modules _state|_fragments|_context
|
:_list_understand_modules _state|_fragments|_context
|
||||||
|
|
||||||
_request_features
|
_request_features
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
:_source psyc://nb.tgbit.net/~foo
|
:_source psyc://nb.tgbit.net/~foo
|
||||||
:_target psyc://nb.tgbit.net/~bar
|
:_target psyc://nb.tgbit.net/~bar
|
||||||
:_tag f00b4rb4z
|
:_tag f00b4rb4z
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
|
||||||
:_source psyc://nb.tgbit.net/~foo
|
:_source psyc://nb.tgbit.net/~foo
|
||||||
:_target psyc://nb2.tgbit.net/~bar
|
:_target psyc://nb2.tgbit.net/~bar
|
||||||
:_tag f00b4rb4z
|
:_tag f00b4rb4z
|
||||||
|
|
|
@ -17,16 +17,18 @@ int main(int argc, char** argv)
|
||||||
return -1;
|
return -1;
|
||||||
indx = read(file,(void*)buffer,sizeof(buffer));
|
indx = read(file,(void*)buffer,sizeof(buffer));
|
||||||
|
|
||||||
write(1, ">> INPUT\n", 9);
|
// write(1, ">> INPUT\n", 9);
|
||||||
write(1, buffer, indx);
|
// write(1, buffer, indx);
|
||||||
write(1, ">> PARSE\n", 9);
|
// write(1, ">> PARSE\n", 9);
|
||||||
|
|
||||||
psyc_initParseState(&state);
|
psyc_initParseState(&state);
|
||||||
psyc_nextParseBuffer(&state, psyc_newString(buffer, indx));
|
psyc_nextParseBuffer(&state, psyc_newString(buffer, indx));
|
||||||
|
|
||||||
// try parsing that now
|
// 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)
|
switch (ret)
|
||||||
{
|
{
|
||||||
case PSYC_PARSE_ROUTING:
|
case PSYC_PARSE_ROUTING:
|
||||||
|
@ -67,15 +69,17 @@ int main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PSYC_PARSE_COMPLETE:
|
case PSYC_PARSE_COMPLETE:
|
||||||
printf("Done parsing.\n");
|
// printf("Done parsing.\n");
|
||||||
|
ret = 0;
|
||||||
continue;
|
continue;
|
||||||
case PSYC_PARSE_INSUFFICIENT:
|
case PSYC_PARSE_INSUFFICIENT:
|
||||||
printf("Insufficient data.\n");
|
printf("Insufficient data.\n");
|
||||||
return 0;
|
return -1;
|
||||||
default:
|
default:
|
||||||
printf("Error while parsing: %i\n", ret);
|
printf("Error while parsing: %i\n", ret);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
} while (ret);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue