1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2008 Index Data
3 * See the file LICENSE for details.
8 #include <yaz/xmalloc.h>
11 int main(int argc, char **argv)
15 ZOOM_query q = ZOOM_query_create();
17 const char *errmsg, *addinfo;
18 int ccl_error_code, ccl_error_pos;
19 const char *ccl_error_string;
23 fprintf (stderr, "usage:\n%s target cclquery\n", *argv);
24 fprintf (stderr, " eg. bagel.indexdata.dk/gils \"ti=utah\"\n");
28 if (ZOOM_query_ccl2rpn(q, argv[2],
29 "term t=l,r s=al\n" "ti u=4 s=pw\n",
30 &ccl_error_code, &ccl_error_string, &ccl_error_pos))
32 printf("CCL Error %d: %s\n", ccl_error_code, ccl_error_string);
33 if (ccl_error_pos >= 0)
34 printf("%s\n%*s^\n", argv[2], ccl_error_pos, "");
35 ZOOM_query_destroy(q);
39 z = ZOOM_connection_new (argv[1], 0);
41 if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
43 fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
47 r = ZOOM_connection_search (z, q);
48 ZOOM_query_destroy(q);
49 if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
50 fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
52 printf ("Result count: %ld\n", (long) ZOOM_resultset_size(r));
53 ZOOM_resultset_destroy (r);
54 ZOOM_connection_destroy (z);
61 * indent-tabs-mode: nil
63 * vim: shiftwidth=4 tabstop=8 expandtab