X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Fcql2xcql.c;h=5c70d7a2233294e8c4f874b1db14a6ba56c0c1f9;hb=301bd3892284e83875d90bd7a65f48366c81213d;hp=b5adb40d1db36498860a7abfefea2e36572ad41f;hpb=c58035e31f65574542f72955007b1935c3669186;p=yaz-moved-to-github.git diff --git a/util/cql2xcql.c b/util/cql2xcql.c index b5adb40..5c70d7a 100644 --- a/util/cql2xcql.c +++ b/util/cql2xcql.c @@ -1,11 +1,10 @@ -/* $Id: cql2xcql.c,v 1.5 2004-04-29 21:15:14 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-2011 Index Data + * See the file LICENSE for details. + */ +#if HAVE_CONFIG_H +#include +#endif #include #include @@ -13,6 +12,12 @@ See the file LICENSE. #include #include +static void usage(const char *prog) +{ + fprintf(stderr, "%s: [-c] [-n iterations] [infile]\n", prog); + exit(1); +} + int main(int argc, char **argv) { CQL_parser cp; @@ -20,34 +25,58 @@ 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]; - while ((ret = options("n:", argv, argc, &arg)) != -2) + while ((ret = options("cn:", argv, argc, &arg)) != -2) { 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; + default: + usage(prog); + } } cp = cql_parser_create(); if (fname) { - int i; - for (i = 0; i