X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=util%2Fsrwtst.c;h=2a1802fde20219955a2baa62ca0c7e45fa1ca4b8;hp=f293620e6d42f4d85ba11fd95f1051708074eef8;hb=43a9d38d20c1b1bcd1a03b2445a501d27526bd35;hpb=dc4414aeda179bc8ebe3fc46ac53e4a24d265d16 diff --git a/util/srwtst.c b/util/srwtst.c index f293620..2a1802f 100644 --- a/util/srwtst.c +++ b/util/srwtst.c @@ -1,9 +1,10 @@ -/* - * Copyright (C) 1995-2007, Index Data ApS +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2011 Index Data * See the file LICENSE for details. - * - * $Id: srwtst.c,v 1.7 2007-04-17 20:26:18 adam Exp $ */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -49,7 +50,7 @@ int main(int argc, char **argv) if (soap_package->which == Z_SOAP_generic && soap_package->u.generic->no == 0) { - Z_SRW_PDU *sr = soap_package->u.generic->p; + 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; @@ -76,8 +77,11 @@ int main(int argc, char **argv) { fprintf (stderr, "%d\n", i); if (res->records[i].recordData_buf) - fwrite(res->records[i].recordData_buf, 1, - res->records[i].recordData_len, stderr); + { + fprintf(stderr, "%.*s", + res->records[i].recordData_len, + res->records[i].recordData_buf); + } } } } @@ -87,7 +91,9 @@ int main(int argc, char **argv) ret = z_soap_codec(encode, &soap_package, &content_buf, &content_len, h); if (content_buf && content_len) - fwrite (content_buf, content_len, 1, stdout); + { + printf("%.*s", content_len, content_buf); + } else { fprintf(stderr, "No output!\n"); @@ -107,6 +113,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