New COMSTACK: UNIX socket
[yaz-moved-to-github.git] / client / client.c
index 84120e6..1da6fe9 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (c) 1995-2002, Index Data
  * See the file LICENSE for details.
  *
- * $Id: client.c,v 1.155 2002-06-02 21:29:30 adam Exp $
+ * $Id: client.c,v 1.157 2002-06-04 11:36:10 adam Exp $
  */
 
 #include <stdio.h>
 #include <yaz/pquery.h>
 #include <yaz/sortspec.h>
 
-#if YAZ_MODULE_ill
 #include <yaz/ill.h>
-#endif
 
-#if YAZ_MODULE_ccl
 #include <yaz/yaz-ccl.h>
-#endif
 
 #if HAVE_READLINE_READLINE_H
 #include <readline/readline.h>
@@ -88,9 +84,7 @@ typedef enum {
 
 static QueryType queryType = QueryType_Prefix;
 
-#if YAZ_MODULE_ccl
 static CCL_bibset bibset;               /* CCL bibset handle */
-#endif
 
 #if HAVE_READLINE_COMPLETION_OVER
 
@@ -370,16 +364,24 @@ int cmd_open(char *arg)
             session_mem = NULL;
         }
     }
-    t = tcpip_type;
-    base[0] = '\0';
-    if (sscanf (arg, "%100[^/]/%100s", type_and_host, base) < 1)
-        return 0;
-    
-    if(yazProxy) 
-        conn = cs_create_host(yazProxy, 1, &add);
-    else 
-        conn = cs_create_host(type_and_host, 1, &add);
-    
+       if (strncmp (arg, "unix:", 5) == 0)
+       {
+        base[0] = '\0';
+        conn = cs_create_host(arg, 1, &add);
+       }
+       else
+       {
+               t = tcpip_type;
+               base[0] = '\0';
+               if (sscanf (arg, "%100[^/]/%100s", type_and_host, base) < 1)
+                       return 0;
+               
+               if(yazProxy) 
+                       conn = cs_create_host(yazProxy, 1, &add);
+               else 
+                       conn = cs_create_host(type_and_host, 1, &add);
+               
+    }
     if (!conn)
     {
         printf ("Couldn't create comstack\n");
@@ -790,15 +792,12 @@ static int send_searchRequest(char *arg)
     Z_SearchRequest *req = apdu->u.searchRequest;
     Z_Query query;
     int oid[OID_SIZE];
-#if YAZ_MODULE_ccl
     struct ccl_rpn_node *rpn = NULL;
     int error, pos;
-#endif
     char setstring[100];
     Z_RPNQuery *RPNquery;
     Odr_oct ccl_query;
 
-#if YAZ_MODULE_ccl
     if (queryType == QueryType_CCL2RPN)
     {
         rpn = ccl_find_str(bibset, arg, &error, &pos);
@@ -808,7 +807,6 @@ static int send_searchRequest(char *arg)
             return 0;
         }
     }
-#endif
     req->referenceId = set_refid (out);
     if (!strcmp(arg, "@big")) /* strictly for troublemaking */
     {
@@ -866,7 +864,6 @@ static int send_searchRequest(char *arg)
         ccl_query.buf = (unsigned char*) arg;
         ccl_query.len = strlen(arg);
         break;
-#if YAZ_MODULE_ccl
     case QueryType_CCL2RPN:
         query.which = Z_Query_type_1;
         RPNquery = ccl_rpn_query(out, rpn);
@@ -878,7 +875,6 @@ static int send_searchRequest(char *arg)
         query.u.type_1 = RPNquery;
         ccl_rpn_delete (rpn);
         break;
-#endif
     default:
         printf ("Unsupported query type\n");
         return 0;
@@ -1191,8 +1187,6 @@ void process_ESResponse(Z_ExtendedServicesResponse *res)
     }
 }
 
-#if YAZ_MODULE_ill
-
 const char *get_ill_element (void *clientData, const char *element)
 {
     return 0;
@@ -1254,9 +1248,7 @@ static Z_External *create_external_itemRequest()
     }
     return r;
 }
-#endif
 
-#ifdef YAZ_MODULE_ill
 static Z_External *create_external_ILL_APDU(int which)
 {
     struct ill_get_ctl ctl;
@@ -1312,7 +1304,6 @@ static Z_External *create_external_ILL_APDU(int which)
     }
     return r;
 }
-#endif
 
 
 static Z_External *create_ItemOrderExternal(const char *type, int itemno)