X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fcql2pqf.c;h=070e54273aa3fcf85776ddabe9b7df04e77c6951;hb=7ef1b50f481cda83d012cc3d69d83f9313836f1f;hp=a0166d72a153acd537d33b47a17f4d2c55fbf2dd;hpb=b64382a1e420049b882b87fb05fe058aa6592d1c;p=yaz-moved-to-github.git diff --git a/util/cql2pqf.c b/util/cql2pqf.c index a0166d7..070e542 100644 --- a/util/cql2pqf.c +++ b/util/cql2pqf.c @@ -1,37 +1,33 @@ -/* $Id: cql2pqf.c,v 1.8 2006-09-27 11:39:04 adam Exp $ - Copyright (C) 1995-2005, Index Data ApS - Index Data Aps - -This file is part of the YAZ toolkit. - -See the file LICENSE. -*/ +/* This file is part of the YAZ toolkit. + * Copyright (C) 1995-2008 Index Data + * See the file LICENSE for details. + */ #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] []\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 ret; char *arg; - while ((ret = options("n:", argv, argc, &arg)) != -2) + while ((ret = options("n:r", argv, argc, &arg)) != -2) { switch (ret) { @@ -41,6 +37,8 @@ int main(int argc, char **argv) else query = arg; break; + case 'r': + reverse = 1; case 'n': iterations = atoi(arg); break; @@ -53,40 +51,77 @@ int main(int argc, char **argv) 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