X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=util%2Fsrwtst.c;h=e7411c522d799e26bf2f5a79b1c18b2b3e4c1a93;hp=9208cd68c8fb8b9f44796cd7ea9e40916aee6de6;hb=2f570511e1ca2d63705dc425e9e7bc3f3d744f64;hpb=7ef1b50f481cda83d012cc3d69d83f9313836f1f diff --git a/util/srwtst.c b/util/srwtst.c index 9208cd6..e7411c5 100644 --- a/util/srwtst.c +++ b/util/srwtst.c @@ -1,7 +1,10 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -17,7 +20,6 @@ int main(int argc, char **argv) char buf[163840]; char *content_buf = buf; int content_len; - int ret; size_t no; Z_SOAP *soap_package = 0; ODR decode, encode; @@ -34,8 +36,8 @@ int main(int argc, char **argv) decode = odr_createmem(ODR_DECODE); encode = odr_createmem(ODR_ENCODE); content_len = no; - ret = z_soap_codec(decode, &soap_package, - &content_buf, &content_len, h); + z_soap_codec(decode, &soap_package, + &content_buf, &content_len, h); if (!soap_package) { fprintf(stderr, "Decoding seriously failed\n"); @@ -49,20 +51,9 @@ int main(int argc, char **argv) { Z_SRW_PDU *sr = (Z_SRW_PDU *) soap_package->u.generic->p; if (sr->which == Z_SRW_searchRetrieve_request) - { + { Z_SRW_searchRetrieveRequest *req = sr->u.request; - switch(req->query_type) - { - case Z_SRW_query_type_cql: - fprintf(stderr, "CQL: %s\n", req->query.cql); - break; - case Z_SRW_query_type_xcql: - fprintf(stderr, "XCQL\n"); - break; - case Z_SRW_query_type_pqf: - fprintf(stderr, "PQF: %s\n", req->query.pqf); - break; - } + fprintf(stderr, "%s: %s\n", req->queryType, req->query); } else if (sr->which == Z_SRW_searchRetrieve_response) { @@ -85,8 +76,7 @@ int main(int argc, char **argv) } } - ret = z_soap_codec(encode, &soap_package, - &content_buf, &content_len, h); + z_soap_codec(encode, &soap_package, &content_buf, &content_len, h); if (content_buf && content_len) { printf("%.*s", content_len, content_buf); @@ -110,6 +100,7 @@ int main(int argc, char **argv) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab