using yaz/log.h again
[idzebra-moved-to-github.git] / data1 / d1_espec.c
index 18ce961..3707776 100644 (file)
@@ -1,19 +1,33 @@
-/*
- * Copyright (c) 1995-2002, Index Data.
- * See the file LICENSE for details.
- * Sebastian Hammer, Adam Dickmeiss
- *
- * $Id: d1_espec.c,v 1.1 2002-10-22 12:53:33 adam Exp $
- */
+/* $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.
+
+Zebra is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 2, or (at your option) any later
+version.
+
+Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
+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.
+*/
 
 #include <stdlib.h>
 #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)
@@ -41,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;
        }
@@ -109,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;
        }
@@ -186,6 +200,10 @@ static Z_ETagUnit *read_tagunit(char *buf, NMEM nmem,
        else
            t->occurrences = 0;
     }
+    else
+    {
+       return 0;
+    }
     return u;
 }
 
@@ -204,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;
     }
     
@@ -223,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;
            }
@@ -242,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;
            }
@@ -258,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;
            }
@@ -270,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;
            }
@@ -297,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;
            }
@@ -329,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;
                }
@@ -341,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;