X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=util%2Fcql2xcql.c;h=bad3f3e7d704b930fea794419842b0641fa47f0b;hp=d23a4154916d585e164f6b07bed744edd3ebd8f7;hb=5ae2f74ba9b27bb7e926d5908471ac79371f7823;hpb=08c3a57c9782652a28ca9a2a9966e3f75e943415 diff --git a/util/cql2xcql.c b/util/cql2xcql.c index d23a415..bad3f3e 100644 --- a/util/cql2xcql.c +++ b/util/cql2xcql.c @@ -1,51 +1,103 @@ -/* $Id: cql2xcql.c,v 1.3 2004-03-11 09:34:42 adam Exp $ - Copyright (C) 2002-2004 - 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-2013 Index Data + * See the file LICENSE for details. + */ +#if HAVE_CONFIG_H +#include +#endif #include +#include #include +#include +#include + +static void usage(const char *prog) +{ + fprintf(stderr, "%s: [-c] [-n iterations] [-s] [-S] [infile]\n", prog); + exit(1); +} int main(int argc, char **argv) { CQL_parser cp; - int r; + int r = 0; const char *fname = 0; int iterations = 1; int ret; + int convert_to_ccl = 0; char *arg; + char *prog = argv[0]; + int do_sortkeys = 0; + int do_strict = 0; - while ((ret = options("n:", argv, argc, &arg)) != -2) + while ((ret = options("cn:sS", argv, argc, &arg)) != YAZ_OPTIONS_EOF) { switch (ret) { case 0: - fname = arg; + fname = arg; + break; + case 'c': + convert_to_ccl = 1; + break; + case 'n': + iterations = atoi(arg); break; - case 'n': - iterations = atoi(arg); - break; - } + case 's': + do_sortkeys = 1; + break; + case 'S': + do_strict = 1; + break; + default: + usage(prog); + } } cp = cql_parser_create(); + cql_parser_strict(cp, do_strict); if (fname) { - int i; - for (i = 0; i