X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=util%2Fcql2pqf.c;h=eec4767ea9e6e4f41b799e27071142179ca4eaac;hp=ac2a4577091f2a928c082114873d469ffe6172e3;hb=b696a59e5609651787b64b953b581a3ceb263f14;hpb=ee6ab2ee3a9ee1a8c65d7272ec7fba1d886f5af0 diff --git a/util/cql2pqf.c b/util/cql2pqf.c index ac2a457..eec4767 100644 --- a/util/cql2pqf.c +++ b/util/cql2pqf.c @@ -1,33 +1,39 @@ /* This file is part of the YAZ toolkit. - * Copyright (C) 1995-2008 Index Data + * Copyright (C) Index Data * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include #include -#include +#include +#include #include static void usage(void) { - fprintf (stderr, "usage\n cql2pqf [-n ] []\n"); - exit (1); + fprintf(stderr, "usage\n cql2pqf [-n ] [-r] [-S] " + "[]\n"); + exit(1); } int main(int argc, char **argv) { cql_transform_t ct; - int r = 0; int i, iterations = 1; - CQL_parser cp = cql_parser_create(); char *query = 0; char *fname = 0; + int reverse = 0; + int verbose = 0; + int do_strict = 0; int ret; char *arg; - while ((ret = options("n:", argv, argc, &arg)) != -2) + while ((ret = options("n:rSv", argv, argc, &arg)) != -2) { switch (ret) { @@ -40,54 +46,112 @@ int main(int argc, char **argv) case 'n': iterations = atoi(arg); break; + case 'r': + reverse = 1; + break; + case 'S': + do_strict = 1; + break; + case 'v': + verbose = 1; + break; default: usage(); } } if (!fname) usage(); - ct = cql_transform_open_fname(fname); + if (!strcmp(fname, "-")) + ct = cql_transform_create(); + else + ct = cql_transform_open_fname(fname); if (!ct) { - fprintf (stderr, "failed to read properties %s\n", fname); - exit (1); + fprintf(stderr, "failed to read properties %s\n", fname); + exit(1); } - if (query) + if (reverse) { - for (i = 0; i