-/* $Id: cql2xcql.c,v 1.1 2003-10-27 12:21:39 adam Exp $
- Copyright (C) 2002-2003
- 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 <config.h>
+#endif
#include <stdio.h>
+#include <stdlib.h>
#include <yaz/cql.h>
+#include <yaz/options.h>
int main(int argc, char **argv)
{
- int r;
- CQL_parser cp = cql_parser_create();
- if (argc == 2)
- r = cql_parser_string(cp, argv[1]);
+ CQL_parser cp;
+ int r = 0;
+ const char *fname = 0;
+ int iterations = 1;
+ int ret;
+ char *arg;
+
+ while ((ret = options("n:", argv, argc, &arg)) != -2)
+ {
+ switch (ret)
+ {
+ case 0:
+ fname = arg;
+ break;
+ case 'n':
+ iterations = atoi(arg);
+ break;
+ }
+ }
+
+ cp = cql_parser_create();
+ if (fname)
+ {
+ int i;
+ for (i = 0; i<iterations; i++)
+ r = cql_parser_string(cp, fname);
+ }
else
r = cql_parser_stdio(cp, stdin);
if (r)
cql_parser_destroy(cp);
return 0;
}
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+