mirror of
git://git.psyc.eu/libpsyc
synced 2024-08-15 03:19:02 +00:00
testServer: s/write/printf/
This commit is contained in:
parent
23633f0eb6
commit
6785ed048c
1 changed files with 16 additions and 12 deletions
|
@ -228,7 +228,8 @@ int main(int argc, char **argv)
|
||||||
ret = -1;
|
ret = -1;
|
||||||
break;
|
break;
|
||||||
case PSYC_PARSE_INSUFFICIENT:
|
case PSYC_PARSE_INSUFFICIENT:
|
||||||
printf("# Insufficient data.\n");
|
if (verbose)
|
||||||
|
printf("# Insufficient data.\n");
|
||||||
contbytes = parsers[i].buffer.length - parsers[i].cursor;
|
contbytes = parsers[i].buffer.length - parsers[i].cursor;
|
||||||
if (contbytes > 0) { // copy end of parsebuf before start of recvbuf
|
if (contbytes > 0) { // copy end of parsebuf before start of recvbuf
|
||||||
assert(recvbuf - contbytes >= buf); // make sure it's still in the buffer
|
assert(recvbuf - contbytes >= buf); // make sure it's still in the buffer
|
||||||
|
@ -250,7 +251,8 @@ int main(int argc, char **argv)
|
||||||
case PSYC_PARSE_BODY:
|
case PSYC_PARSE_BODY:
|
||||||
if (oper) {
|
if (oper) {
|
||||||
mod->oper = oper;
|
mod->oper = oper;
|
||||||
if (verbose) write(1, &oper, 1);
|
if (verbose)
|
||||||
|
printf("%c", oper);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.length) {
|
if (name.length) {
|
||||||
|
@ -260,8 +262,7 @@ int main(int argc, char **argv)
|
||||||
memcpy((void*)pname->ptr, name.ptr, name.length);
|
memcpy((void*)pname->ptr, name.ptr, name.length);
|
||||||
name.length = 0;
|
name.length = 0;
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
write(1, pname->ptr, pname->length);
|
printf("%.*s = ", (int)pname->length, pname->ptr);
|
||||||
write(1, " = ", 3);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,16 +274,21 @@ int main(int argc, char **argv)
|
||||||
pvalue->length += value.length;
|
pvalue->length += value.length;
|
||||||
value.length = 0;
|
value.length = 0;
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
write(1, pvalue->ptr, pvalue->length);
|
printf("%.*s", (int)pvalue->length, pvalue->ptr);
|
||||||
if (parsers[i].valueLength > pvalue->length)
|
if (parsers[i].valueLength > pvalue->length)
|
||||||
write(1, "...", 3);
|
printf("...");
|
||||||
write(1, "\n", 1);
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
} else if (verbose) {
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (verbose)
|
||||||
|
printf("\t\t\t\t\t\t\t\t# n:%ld v:%ld c:%ld r:%ld\n", pname->length, pvalue->length, parsers[i].contentParsed, parsers[i].routingLength);
|
||||||
|
|
||||||
if (name.length >= 5 && memcmp(name.ptr, "_list", 5) == 0) {
|
if (name.length >= 5 && memcmp(name.ptr, "_list", 5) == 0) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
write(1, ">>> LIST START\n", 15);
|
printf("## LIST START\n");
|
||||||
psyc_initParseListState(&listState);
|
psyc_initParseListState(&listState);
|
||||||
psyc_nextParseListBuffer(&listState, value);
|
psyc_nextParseListBuffer(&listState, value);
|
||||||
do {
|
do {
|
||||||
|
@ -292,11 +298,9 @@ int main(int argc, char **argv)
|
||||||
retl = 0;
|
retl = 0;
|
||||||
case PSYC_PARSE_LIST_ELEM:
|
case PSYC_PARSE_LIST_ELEM:
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
write(1, "|", 1);
|
printf("|%.*s\n", (int)elem.length, elem.ptr);
|
||||||
write(1, elem.ptr, elem.length);
|
|
||||||
write(1, "\n", 1);
|
|
||||||
if (ret == PSYC_PARSE_LIST_END)
|
if (ret == PSYC_PARSE_LIST_END)
|
||||||
write(1, ">>> LIST END\n", 13);
|
printf("## LIST END");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue