yaz-client: otherinfo missing if facet is in use
[yaz-moved-to-github.git] / client / admin.c
index 30afef2..7812b65 100644 (file)
@@ -1,8 +1,6 @@
-/*
- * Copyright (C) 1995-2007, Index Data ApS
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2010 Index Data
  * See the file LICENSE for details.
- *
- * $Id: admin.c,v 1.23 2007-01-03 08:42:13 adam Exp $
  */
 
 #include <stdio.h>
@@ -27,7 +25,7 @@
 #include <yaz/proto.h>
 #include <yaz/marcdisp.h>
 #include <yaz/diagbib1.h>
-
+#include <yaz/oid_db.h>
 #include <yaz/pquery.h>
 
 #include "admin.h"
@@ -47,20 +45,15 @@ int sendAdminES(int type, char* param1)
     Z_APDU *apdu = zget_APDU(out, Z_APDU_extendedServicesRequest );
     Z_ExtendedServicesRequest *req = apdu->u.extendedServicesRequest;
     Z_External *r;
-    int oid[OID_SIZE];
+    Odr_oid *oid;
     Z_ESAdminOriginPartToKeep  *toKeep;
     Z_ESAdminOriginPartNotToKeep  *notToKeep;
-    oident update_oid;
     printf ("Admin request\n");
     fflush(stdout);
 
-    /* Set up the OID for the external */
-    update_oid.proto = PROTO_Z3950;
-    update_oid.oclass = CLASS_EXTSERV;
-    update_oid.value = VAL_ADMINSERVICE;
+    oid = odr_oiddup(out, yaz_oid_extserv_admin);
 
-    oid_ent_to_oid (&update_oid, oid);
-    req->packageType = odr_oiddup(out,oid);
+    req->packageType = oid;
     req->packageName = "1.Extendedserveq";
 
     /* Allocate the external */
@@ -243,8 +236,14 @@ int cmd_adm_import(const char *arg)
                 
                 oct->len = oct->size = status.st_size;
                 oct->buf = (unsigned char *) odr_malloc (out, oct->size);
-                fread (oct->buf, 1, oct->size, inf);
-                fclose (inf);
+                if (fread(oct->buf, 1, oct->size, inf) != (size_t) oct->size)
+                {
+                    printf("Incomplete read of file %s\n", fname);
+                }
+                if (fclose(inf))
+                {
+                    printf("Close failed for file %s\n", fname);
+                }
                 
                 segment->segmentRecords[segment->num_segmentRecords++] = rec;
 
@@ -306,6 +305,7 @@ int cmd_adm_startup(const char *arg)
 /*
  * Local variables:
  * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
  * indent-tabs-mode: nil
  * End:
  * vim: shiftwidth=4 tabstop=8 expandtab