Update copyright year + FSF address
[idzebra-moved-to-github.git] / dict / scantest.c
index 273aab4..e90a6cb 100644 (file)
@@ -1,6 +1,6 @@
-/* $Id: scantest.c,v 1.2 2004-12-08 12:23:08 adam Exp $
-   Copyright (C) 2003,2004
-   Index Data Aps
+/* $Id: scantest.c,v 1.6 2006-08-14 10:40:09 adam Exp $
+   Copyright (C) 1995-2006
+   Index Data ApS
 
 This file is part of the Zebra server.
 
@@ -15,14 +15,15 @@ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 for more details.
 
 You should have received a copy of the GNU General Public License
-along with Zebra; see the file LICENSE.zebra.  If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
 */
 
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+#include <yaz/log.h>
 
 #include <yaz/options.h>
 #include <idzebra/dict.h>
@@ -41,11 +42,15 @@ static int handler(char *name, const char *info, int pos, void *client)
        idx = hi->a - pos + hi->b;
     else
        idx = -pos - 1;
-    hi->ar[idx] = malloc(strlen(name)+1);
-    strcpy(hi->ar[idx], name);
+
 #if 0
     printf ("pos=%d idx=%d name=%s\n", pos, idx, name);
 #endif
+    if (idx < 0)
+       return 0;
+
+    hi->ar[idx] = malloc(strlen(name)+1);
+    strcpy(hi->ar[idx], name);
     return 0;
 }
 
@@ -112,7 +117,7 @@ int main(int argc, char **argv)
     char *arg;
 
     strcpy(scan_term, "1004");
-    while ((ret = options("b:a:t:n:", argv, argc, &arg)) != -2)
+    while ((ret = options("b:a:t:n:v:", argv, argc, &arg)) != -2)
     {
        switch(ret)
        {
@@ -130,6 +135,8 @@ int main(int argc, char **argv)
        case 'n':
            number = atoi(arg);
            break;
+       case 'v':
+           yaz_log_init_level(yaz_log_mask_str(arg));
        }
     }
 
@@ -158,7 +165,7 @@ int main(int argc, char **argv)
                "4497",
                "4498",
                "4499",
-           "45"};
+               "45"};
            strcpy(scan_term, "4499");
            errors += tst(dict, 2, 2, scan_term, cs, 0);
        }
@@ -179,3 +186,11 @@ int main(int argc, char **argv)
        exit(1);
     exit(0);
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+