File: zoomtst1.c

package info (click to toggle)
yaz 4.2.30-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 15,120 kB
  • ctags: 13,367
  • sloc: xml: 119,746; ansic: 66,073; sh: 11,795; tcl: 2,125; makefile: 1,308; yacc: 371
file content (49 lines) | stat: -rw-r--r-- 1,231 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/* This file is part of the YAZ toolkit.
 * Copyright (C) 1995-2012 Index Data
 * See the file LICENSE for details.
 */

#include <stdlib.h>
#include <stdio.h>
#include <yaz/xmalloc.h>
#include <yaz/zoom.h>

int main(int argc, char **argv)
{
    ZOOM_connection z;
    ZOOM_resultset r;
    int error;
    const char *errmsg, *addinfo;

    if (argc != 3)
    {
        fprintf (stderr, "usage:\n%s target query\n", *argv);
        fprintf (stderr, " eg.  bagel.indexdata.dk/gils computer\n");
        exit (1);
    }
    z = ZOOM_connection_new (argv[1], 0);
    
    if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
    {
        fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
        exit (2);
    }

    r = ZOOM_connection_search_pqf (z, argv[2]);
    if ((error = ZOOM_connection_error(z, &errmsg, &addinfo)))
        fprintf (stderr, "Error: %s (%d) %s\n", errmsg, error, addinfo);
    else
        printf ("Result count: %ld\n", (long) ZOOM_resultset_size(r));
    ZOOM_resultset_destroy (r);
    ZOOM_connection_destroy (z);
    exit (0);
}
/*
 * Local variables:
 * c-basic-offset: 4
 * c-file-style: "Stroustrup"
 * indent-tabs-mode: nil
 * End:
 * vim: shiftwidth=4 tabstop=8 expandtab
 */