1 /* $Id: cql2pqf.c,v 1.5 2004-04-29 21:15:14 adam Exp $
2 Copyright (C) 2002-2004
5 This file is part of the YAZ toolkit.
14 #include <yaz/options.h>
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);