X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=util%2Fcql2xcql.c;h=e2aa5c8a331ccda527075f53dfd4e429356e31ca;hp=138afad2e209b5e3587fa6220b1a03217a8d569e;hb=1f1e067ae72eff85b653b72f9450ee6b50dcc272;hpb=4c176312acdc3444c9afc820f76a393e64668e52 diff --git a/util/cql2xcql.c b/util/cql2xcql.c index 138afad..e2aa5c8 100644 --- a/util/cql2xcql.c +++ b/util/cql2xcql.c @@ -1,18 +1,24 @@ -/* $Id: cql2xcql.c,v 1.6 2005-01-15 19:47:15 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-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] [infile]\n", prog); + exit(1); +} + int main(int argc, char **argv) { CQL_parser cp; @@ -20,34 +26,73 @@ int main(int argc, char **argv) const char *fname = 0; int iterations = 1; int ret; + int convert_to_ccl = 0; char *arg; + char *prog = argv[0]; + int do_sortkeys = 0; - while ((ret = options("n:", argv, argc, &arg)) != -2) + while ((ret = options("cn:s", 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; + default: + usage(prog); + } } cp = cql_parser_create(); if (fname) { - int i; - for (i = 0; i