cql2pqf: allow PQF queries from stdin
authorAdam Dickmeiss <adam@indexdata.dk>
Tue, 24 Sep 2013 15:55:20 +0000 (17:55 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Tue, 24 Sep 2013 15:55:20 +0000 (17:55 +0200)
util/cql2pqf.c

index 13c62b0..1ea16e6 100644 (file)
@@ -73,9 +73,14 @@ int main(int argc, char **argv)
 
     if (reverse)
     {
+        char buf[1024];
+
         if (!query)
-            usage();
-        else
+        {
+            if (fgets(buf, sizeof buf, stdin))
+                query = buf;
+        }
+        if (query)
         {
             ODR odr = odr_createmem(ODR_ENCODE);
             YAZ_PQF_Parser pp = yaz_pqf_create();