minor fix
[idzebra-moved-to-github.git] / index / zebrash.c
index f88ce45..b95737a 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: zebrash.c,v 1.17 2003-07-04 14:00:22 heikki Exp $
+/* $Id: zebrash.c,v 1.19 2003-07-04 14:27:19 heikki Exp $
    Copyright (C) 2002,2003
    Index Data Aps
 
@@ -133,6 +133,16 @@ int cmd_echo( char *args[], WRBUF outbuff)
  
 int cmd_quit( char *args[], WRBUF outbuff)
 {
+    if (zs)
+    {
+        onecommand("zebra_close",outbuff,"");
+        zs=0;
+    }
+    if (zh)
+    {
+        onecommand("zebra_stop",outbuff,"");
+        zh=0;
+    }
     wrbuf_puts(outbuff, "bye");
     return -99; /* special stop signal */
 }
@@ -422,7 +432,6 @@ static int cmd_show( char *args[], WRBUF outbuff)
 
     rc = zebra_records_retrieve (zh, odr, setname,
             pcomp, format, nrecs,recs);
-    printf("rc=%d\n",rc);
     if (0==rc)
     {
         for (i=0;i<nrecs;i++)
@@ -438,6 +447,7 @@ static int cmd_show( char *args[], WRBUF outbuff)
         }
         nextrecno=start+nrecs+1;
     }
+    odr_destroy(odr);
     return rc;
 }
 /**************************************)
@@ -736,6 +746,7 @@ void shell()
            Zerrors(outbuff);
            printf("%s\n", wrbuf_buf(outbuff));
     } /* while */
+    wrbuf_free(outbuff,1);
 } /* shell() */