X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=test%2Fapi%2Ftestclient.c;h=3bd89e819c47c86ca08298f946c2870c7b3892ee;hb=250de4ed23a44f5eb3552db317eef0d0fbe3265c;hp=e1a17ab3d7e6dbd0e5bc8a75dc3acb55b73021c3;hpb=403ae06f9dbf8180008ccc8128f642203d41ae50;p=idzebra-moved-to-github.git diff --git a/test/api/testclient.c b/test/api/testclient.c index e1a17ab..3bd89e8 100644 --- a/test/api/testclient.c +++ b/test/api/testclient.c @@ -1,9 +1,25 @@ -/* - * $Id: testclient.c,v 1.1 2003-05-21 14:39:22 adam Exp $ - * - * Z39.50 client specifically for Zebra testing. - */ +/* This file is part of the Zebra server. + Copyright (C) 2004-2013 Index Data + +Zebra is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Zebra is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +*/ +#if HAVE_CONFIG_H +#include +#endif #include #include #ifdef WIN32 @@ -27,7 +43,6 @@ int main(int argc, char **argv) char *target = 0; char *arg; int delay_sec = 0; - int expected_hits=-1; int ret; int retrieve_number = 0; int retrieve_offset = 0; @@ -69,7 +84,7 @@ int main(int argc, char **argv) } } - if (!target || !target) + if (!target || !query) { printf ("%s: missing target/query\n", prog); printf ("usage:\n%s [options] target query \n", prog); @@ -79,10 +94,11 @@ int main(int argc, char **argv) printf (" -o off offset for records - counting from 0.\n"); printf (" -f format set record syntax. Default: none\n"); printf (" -d sec delay a number of seconds before exit.\n"); + printf (" -c count expect count hits, fail if not.\n"); exit (3); } z = ZOOM_connection_new (target, 0); - + if ((error = ZOOM_connection_error(z, &errmsg, &addinfo))) { printf ("Error: %s (%d) %s\n", errmsg, error, addinfo); @@ -98,11 +114,11 @@ int main(int argc, char **argv) } else { - printf ("Result count: %d\n", ZOOM_resultset_size(r)); + printf ("Result count: %ld\n", (long) ZOOM_resultset_size(r)); if (check_count != -1 && check_count != ZOOM_resultset_size(r)) { - printf("Wrong number of hits, expected %d, got %d\n", - expected_hits, ZOOM_resultset_size(r) ); + printf("Wrong number of hits, expected %d, got %ld\n", + check_count, (long) ZOOM_resultset_size(r) ); exit(3); } } @@ -115,7 +131,7 @@ int main(int argc, char **argv) ZOOM_record_get( ZOOM_resultset_record(r, pos + retrieve_offset), "render", &len); - + if (rec) fwrite (rec, 1, len, stdout); } @@ -125,3 +141,12 @@ int main(int argc, char **argv) ZOOM_connection_destroy (z); exit (exit_code); } +/* + * Local variables: + * c-basic-offset: 4 + * c-file-style: "Stroustrup" + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +