For update, record ID "none" makes update omit record ID.
[yaz-moved-to-github.git] / client / client.c
index 64e92cc..bb0f250 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2006, Index Data ApS
  * See the file LICENSE for details.
  *
- * $Id: client.c,v 1.316 2006-09-27 11:38:59 adam Exp $
+ * $Id: client.c,v 1.319 2006-11-14 08:37:16 adam Exp $
  */
 /** \file client.c
  *  \brief yaz-client program
@@ -686,7 +686,7 @@ int session_connect(const char *arg)
         conn = cs_create_host(arg, 1, &add);
     if (!conn)
     {
-        printf ("Couldn't create comstack\n");
+        printf ("Could not resolve address %s\n", arg);
         return 0;
     }
 #if YAZ_HAVE_XML2
@@ -711,12 +711,6 @@ int session_connect(const char *arg)
     if (cs_connect(conn, add) < 0)
     {
         printf ("error = %s\n", cs_strerror(conn));
-        if (conn->cerrno == CSYSERR)
-        {
-            char msg[256];
-            yaz_strerror(msg, sizeof(msg));
-            printf ("%s\n", msg);
-        }
         cs_close(conn);
         conn = 0;
         return 0;
@@ -2226,7 +2220,7 @@ static int cmd_update_common(const char *arg, int version)
         notToKeep->elements[0] = (Z_IU0SuppliedRecords_elem *)
             odr_malloc(out, sizeof(**notToKeep->elements));
         notToKeep->elements[0]->which = Z_IUSuppliedRecords_elem_opaque;
-        if (*recid)
+        if (*recid && strcmp(recid, "none"))
         {
             notToKeep->elements[0]->u.opaque = (Odr_oct *)
                 odr_malloc (out, sizeof(Odr_oct));
@@ -2294,6 +2288,7 @@ static int cmd_xmles(const char *arg)
         return 1;
     else
     {
+        char *asn_buf = 0;
         int noread = 0;
         char oid_str[51];
         int oid_value_xmles = VAL_XMLES;
@@ -2322,10 +2317,13 @@ static int cmd_xmles(const char *arg)
             printf("Bad OID: %s\n", oid_str);
             return 0;
         }
-        
-        if (parse_cmd_doc(&arg, out, (char **) &ext->u.single_ASN1_type->buf,
+
+        if (parse_cmd_doc(&arg, out, &asn_buf,
                           &ext->u.single_ASN1_type->len, 0) == 0)
             return 0;
+
+        ext->u.single_ASN1_type->buf = (unsigned char *) asn_buf;
+
         req->packageType = yaz_oidval_to_z3950oid(out, CLASS_EXTSERV,
                                                   oid_value_xmles);