Client uses prefix query notation.
authorAdam Dickmeiss <adam@indexdata.dk>
Mon, 22 May 1995 15:30:13 +0000 (15:30 +0000)
committerAdam Dickmeiss <adam@indexdata.dk>
Mon, 22 May 1995 15:30:13 +0000 (15:30 +0000)
client/Makefile
client/client.c

index dcbb131..db508fd 100644 (file)
@@ -1,17 +1,17 @@
 # Copyright (C) 1994, Index Data I/S 
 # All rights reserved.
 # Sebastian Hammer, Adam Dickmeiss
-# $Id: Makefile,v 1.2 1995-05-22 14:00:02 quinn Exp $
+# $Id: Makefile,v 1.3 1995-05-22 15:30:13 adam Exp $
 
 LIBDIR=../lib
 
 #LIBMOSI=../../xtimosi/src/libmosi.a $(LIBDIR)/librfc.a
 
 SHELL=/bin/sh
-INCLUDE=-I../include -I. -I../../xtimosi/src -I../../alex/include
+INCLUDE=-I../include -I. -I../../xtimosi/src
 LIBINCLUDE=-L$(LIBDIR)
 #CFLAGS=-Wall -pedantic -g
-DEFS=$(INCLUDE) -DRPN_QUERY
+DEFS=$(INCLUDE) -DRPN_QUERY -DPREFIX_QUERY
 #LIB=$(LIBDIR)/libserver.a 
 LIBS=$(LIBDIR)/libasn.a $(LIBDIR)/libodr.a \
   $(LIBDIR)/libcomstack.a ../lib/ccl.a $(LIBMOSI) $(LIBDIR)/libutil.a
@@ -22,7 +22,7 @@ PROGO=client.o
 
 all: $(PROG)
 
-$(PROG): $(LIB) $(PROGO) 
+$(PROG): $(LIB) $(PROGO)
        $(CC) $(CFLAGS) $(LIBINCLUDE) -o $(PROG) $(PROGO) $(LIBS)
 
 alll:
index 353a6ed..adf57cd 100644 (file)
@@ -4,7 +4,10 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: client.c,v $
- * Revision 1.3  1995-05-22 15:06:53  quinn
+ * Revision 1.4  1995-05-22 15:30:13  adam
+ * Client uses prefix query notation.
+ *
+ * Revision 1.3  1995/05/22  15:06:53  quinn
  * *** empty log message ***
  *
  * Revision 1.2  1995/05/22  14:56:40  quinn
 #include <oid.h>
 
 #include <marcdisp.h>
+
+#ifdef RPN_QUERY
+#ifdef PREFIX_QUERY
+#include <pquery.h>
+#else
 #include <yaz-ccl.h>
+#endif
+#endif
+
 #include "../version.h"
 
 #define C_PROMPT "Z> "
@@ -51,7 +62,11 @@ static int largeSetLowerBound = 1;
 static int mediumSetPresentNumber = 0;
 static int setno = 1;                   /* current set offset */
 static int protocol = PROTO_Z3950;      /* current app protocol */
+#ifdef RPN_QUERY
+#ifndef PREFIX_QUERY
 static CCL_bibset bibset;               /* CCL bibset handle */
+#endif
+#endif
 
 static void send_apdu(Z_APDU *a)
 {
@@ -289,16 +304,22 @@ static int send_searchRequest(char *arg)
     Z_SearchRequest *req = apdu->u.searchRequest;
     char *databaseNames = database;
     Z_Query query;
+#ifdef RPN_QUERY
+#ifndef PREFIX_QUERY
+    struct ccl_rpn_node *rpn;
     int error, pos;
+#endif
+#endif
     char setstring[100];
+#ifdef RPN_QUERY
     Z_RPNQuery *RPNquery;
     oident bib1;
-    struct ccl_rpn_node *rpn;
-#ifndef RPN_QUERY
+#else
     Odr_oct ccl_query;
 #endif
 
 #ifdef RPN_QUERY
+#ifndef PREFIX_QUERY
     rpn = ccl_find_str(bibset, arg, &error, &pos);
     if (error)
     {
@@ -306,6 +327,7 @@ static int send_searchRequest(char *arg)
        return 0;
     }
 #endif
+#endif
 
     if (!strcmp(arg, "@big")) /* strictly for troublemaking */
     {
@@ -334,7 +356,17 @@ static int send_searchRequest(char *arg)
 
 #ifdef RPN_QUERY
     query.which = Z_Query_type_1;
+
+#ifndef PREFIX_QUERY
     assert((RPNquery = ccl_rpn_query(rpn)));
+#else
+    RPNquery = p_query_rpn (out, arg);
+    if (!RPNquery)
+    {
+        printf("Prefix query error\n");
+        return 0;
+    }
+#endif
     bib1.proto = protocol;
     bib1.class = CLASS_ATTSET;
     bib1.value = VAL_BIB1;
@@ -497,6 +529,8 @@ static void initialize(void)
     }
     setvbuf(stdout, 0, _IONBF, 0);
 
+#ifdef RPN_QUERY
+#ifndef PREFIX_QUERY
     bibset = ccl_qual_mk (); 
     inf = fopen ("default.bib", "r");
     if (inf)
@@ -504,6 +538,8 @@ static void initialize(void)
        ccl_qual_file (bibset, inf);
        fclose (inf);
     }
+#endif
+#endif
 }
 
 static int client(void)