using yaz/log.h again
[idzebra-moved-to-github.git] / data1 / d1_espec.c
index fba103f..3707776 100644 (file)
@@ -1,5 +1,5 @@
-/* $Id: d1_espec.c,v 1.2 2002-10-22 13:19:50 adam Exp $
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002
+/* $Id: d1_espec.c,v 1.6 2004-12-13 20:51:28 adam Exp $
+   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
    Index Data Aps
 
 This file is part of the Zebra server.
@@ -24,10 +24,10 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include <assert.h>
 #include <string.h>
 
+#include <yaz/log.h>
 #include <yaz/odr.h>
 #include <yaz/proto.h>
-#include <yaz/log.h>
-#include <data1.h>
+#include <idzebra/data1.h>
 
 static Z_Variant *read_variant(int argc, char **argv, NMEM nmem,
                               const char *file, int lineno)
@@ -55,7 +55,7 @@ static Z_Variant *read_variant(int argc, char **argv, NMEM nmem,
 
        if (sscanf(argv[i], "(%d,%d,%511[^)])", &zclass, &type, value) < 3)
        {
-           yaz_log(LOG_WARN, "%s:%d: Syntax error in variant component '%s'",
+           yaz_log(YLOG_WARN, "%s:%d: Syntax error in variant component '%s'",
                    file, lineno, argv[i]);
            return 0;
        }
@@ -123,7 +123,7 @@ static Z_Occurrences *read_occurrences(char *occ, NMEM nmem,
     
        if (!d1_isdigit(*occ))
        {
-           yaz_log(LOG_WARN, "%s:%d: Bad occurrences-spec %s",
+           yaz_log(YLOG_WARN, "%s:%d: Bad occurrences-spec %s",
                    file, lineno, occ);
            return 0;
        }
@@ -200,6 +200,10 @@ static Z_ETagUnit *read_tagunit(char *buf, NMEM nmem,
        else
            t->occurrences = 0;
     }
+    else
+    {
+       return 0;
+    }
     return u;
 }
 
@@ -218,7 +222,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file)
     
     if (!(f = data1_path_fopen(dh, file, "r")))
     {
-       yaz_log(LOG_WARN|LOG_ERRNO, "%s", file);
+       yaz_log(YLOG_WARN|YLOG_ERRNO, "%s", file);
        return 0;
     }
     
@@ -237,7 +241,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file)
            
            if (!nnames)
            {
-               yaz_log(LOG_WARN, "%s:%d: Empty elementsetnames directive",
+               yaz_log(YLOG_WARN, "%s:%d: Empty elementsetnames directive",
                        file, lineno);
                continue;
            }
@@ -256,14 +260,14 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file)
        {
            if (argc != 2)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args for %s",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args for %s",
                        file, lineno, argv[0]);
                continue;
            }
            if (!(res->defaultVariantSetId =
                  odr_getoidbystr_nmem(nmem, argv[1])))
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad defaultvariantsetid",
+               yaz_log(YLOG_WARN, "%s:%d: Bad defaultvariantsetid",
                        file, lineno);
                continue;
            }
@@ -272,7 +276,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file)
        {
            if (argc != 2)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args for %s",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args for %s",
                        file, lineno, argv[0]);
                continue;
            }
@@ -284,7 +288,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file)
            if (!(res->defaultVariantRequest =
                  read_variant(argc-1, argv+1, nmem, file, lineno)))
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad defaultvariantrequest",
+               yaz_log(YLOG_WARN, "%s:%d: Bad defaultvariantrequest",
                        file, lineno);
                continue;
            }
@@ -311,7 +315,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file)
            }
            if (argc < 2)
            {
-               yaz_log(LOG_WARN, "%s:%d: Bad # of args for %s",
+               yaz_log(YLOG_WARN, "%s:%d: Bad # of args for %s",
                        file, lineno, argv[0]);
                continue;
            }
@@ -343,7 +347,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file)
                tagunit = read_tagunit(path, nmem, file, lineno);
                if (!tagunit)
                {
-                   yaz_log (LOG_WARN, "%s%d: Bad tag unit at %s",
+                   yaz_log (YLOG_WARN, "%s%d: Bad tag unit at %s",
                             file, lineno, path);
                    break;
                }
@@ -355,7 +359,7 @@ Z_Espec1 *data1_read_espec1 (data1_handle dh, const char *file)
                    read_variant(argc-3, argv+3, nmem, file, lineno);
        }
        else
-           yaz_log(LOG_WARN, "%s:%d: Unknown directive '%s'",
+           yaz_log(YLOG_WARN, "%s:%d: Unknown directive '%s'",
                    file, lineno, argv[0]);
     fclose (f);
     return res;