Bump year. Change Aps->ApS
[idzebra-moved-to-github.git] / util / res.c
index cbc51ec..6db1086 100644 (file)
@@ -1,6 +1,6 @@
-/* $Id: res.c,v 1.36 2004-06-15 08:05:54 adam Exp $
-   Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004
-   Index Data Aps
+/* $Id: res.c,v 1.39 2005-01-15 19:38:42 adam Exp $
+   Copyright (C) 1995-2005
+   Index Data ApS
 
 This file is part of the Zebra server.
 
@@ -20,7 +20,6 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 02111-1307, USA.
 */
 
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -146,17 +145,16 @@ static void reread (Res r)
     assert (r);
     r->init = 1;
 
-    val_buf = (char*) xmalloc (val_max);
-
     if (!r->name)
        return; 
 
     fr = fopen (r->name, "r");
     if (!fr)
     {
-        logf (LOG_WARN|LOG_ERRNO, "Cannot open `%s'", r->name);
+        yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot open `%s'", r->name);
        return ;
     }
+    val_buf = (char*) xmalloc (val_max);
     while (1)
     {
         line = fgets (fr_buf, sizeof(fr_buf)-1, fr);
@@ -209,7 +207,7 @@ static void reread (Res r)
                         val_size--;
                     val_buf[val_size] = '\0';
                    resp->value = xstrdup_env(val_buf);
-                    logf (LOG_DEBUG, "(name=%s,value=%s)",
+                    yaz_log (YLOG_DEBUG, "(name=%s,value=%s)",
                          resp->name, resp->value);
                     break;
                 }
@@ -256,7 +254,7 @@ Res res_open (const char *name, Res def_res, Res over_res)
         if (access (name, R_OK))
 #endif
         {
-            logf (LOG_WARN|LOG_ERRNO, "Cannot open `%s'", name);
+            yaz_log (YLOG_WARN|YLOG_ERRNO, "Cannot open `%s'", name);
            return 0;
         }
     }
@@ -342,7 +340,7 @@ const char *res_get_def (Res r, const char *name, const char *def)
 
     if (!(t = res_get (r, name)))
     {
-       logf (LOG_DEBUG, "CAUTION: Using default resource %s:%s", name, def);
+       yaz_log (YLOG_DEBUG, "CAUTION: Using default resource %s:%s", name, def);
        return def;
     }
     else
@@ -418,7 +416,7 @@ int res_write (Res r)
     fr = fopen (r->name, "w");
     if (!fr)
     {
-        logf (LOG_FATAL|LOG_ERRNO, "Cannot create `%s'", r->name);
+        yaz_log (YLOG_FATAL|YLOG_ERRNO, "Cannot create `%s'", r->name);
         exit (1);
     }