1 /* $Id: cql2pqf.c,v 1.9 2007-01-03 08:42:16 adam Exp $
2 Copyright (C) 1995-2007, Index Data ApS
5 This file is part of the YAZ toolkit.
14 #include <yaz/options.h>
16 static void usage(void)
18 fprintf (stderr, "usage\n cql2pqf [-n <n>] <properties> [<query>]\n");
22 int main(int argc, char **argv)
26 int i, iterations = 1;
27 CQL_parser cp = cql_parser_create();
34 while ((ret = options("n:", argv, argc, &arg)) != -2)
45 iterations = atoi(arg);
53 ct = cql_transform_open_fname(fname);
56 fprintf (stderr, "failed to read properties %s\n", fname);
62 for (i = 0; i<iterations; i++)
63 r = cql_parser_string(cp, query);
66 r = cql_parser_stdio(cp, stdin);
69 fprintf (stderr, "Syntax error\n");
72 r = cql_transform_FILE(ct, cql_parser_result(cp), stdout);
77 cql_transform_error(ct, &addinfo);
78 printf ("Transform error %d %s\n", r, addinfo ? addinfo : "");
82 FILE *null = fopen("/dev/null", "w");
83 for (i = 1; i<iterations; i++)
84 cql_transform_FILE(ct, cql_parser_result(cp), null);
88 cql_transform_close(ct);
89 cql_parser_destroy(cp);
95 * indent-tabs-mode: nil
97 * vim: shiftwidth=4 tabstop=8 expandtab