1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2008 Index Data
3 * See the file LICENSE for details.
10 #include <yaz/options.h>
12 static void usage(void)
14 fprintf (stderr, "usage\n cql2pqf [-n <n>] <properties> [<query>]\n");
18 int main(int argc, char **argv)
22 int i, iterations = 1;
23 CQL_parser cp = cql_parser_create();
30 while ((ret = options("n:", argv, argc, &arg)) != -2)
41 iterations = atoi(arg);
49 ct = cql_transform_open_fname(fname);
52 fprintf (stderr, "failed to read properties %s\n", fname);
58 for (i = 0; i<iterations; i++)
59 r = cql_parser_string(cp, query);
62 r = cql_parser_stdio(cp, stdin);
65 fprintf (stderr, "Syntax error\n");
68 r = cql_transform_FILE(ct, cql_parser_result(cp), stdout);
73 cql_transform_error(ct, &addinfo);
74 printf ("Transform error %d %s\n", r, addinfo ? addinfo : "");
78 FILE *null = fopen("/dev/null", "w");
79 for (i = 1; i<iterations; i++)
80 cql_transform_FILE(ct, cql_parser_result(cp), null);
84 cql_transform_close(ct);
85 cql_parser_destroy(cp);
91 * indent-tabs-mode: nil
93 * vim: shiftwidth=4 tabstop=8 expandtab