Expanded tabs in all source files. Added vim/emacs local variables
[yaz-moved-to-github.git] / src / readconf.c
index 06ee114..f923526 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 1995-2005, Index Data ApS
  * All rights reserved.
  *
- * $Id: readconf.c,v 1.5 2005-01-15 19:47:14 adam Exp $
+ * $Id: readconf.c,v 1.6 2005-06-25 15:46:04 adam Exp $
  */
 
 /**
 #define l_isspace(c) ((c) == '\t' || (c) == ' ' || (c) == '\n' || (c) == '\r')
 
 int readconf_line(FILE *f, int *lineno, char *line, int len,
-                 char *argv[], int num)
+                  char *argv[], int num)
 {
     char *p;
     int argc;
     
     while ((p = fgets(line, len, f)))
     {
-       (*lineno)++;
-       while (*p && l_isspace(*p))
-           p++;
-       if (*p && *p != '#')
-           break;
+        (*lineno)++;
+        while (*p && l_isspace(*p))
+            p++;
+        if (*p && *p != '#')
+            break;
     }
     if (!p)
-       return 0;
+        return 0;
     
     for (argc = 0; *p ; argc++)
     {
-       if (*p == '#')  /* trailing comment */
-           break;
-       argv[argc] = p;
-       while (*p && !l_isspace(*p))
-           p++;
-       if (*p)
-       {
-           *(p++) = '\0';
-           while (*p && l_isspace(*p))
-               p++;
-       }
+        if (*p == '#')  /* trailing comment */
+            break;
+        argv[argc] = p;
+        while (*p && !l_isspace(*p))
+            p++;
+        if (*p)
+        {
+            *(p++) = '\0';
+            while (*p && l_isspace(*p))
+                p++;
+        }
     }
     return argc;
 }
@@ -60,7 +60,7 @@ int readconf_line(FILE *f, int *lineno, char *line, int len,
  * Read lines of a configuration file.
  */
 int readconf(char *name, void *rprivate,
-            int (*fun)(char *name, void *rprivate, int argc, char *argv[]))
+             int (*fun)(char *name, void *rprivate, int argc, char *argv[]))
 {
     FILE *f;
     char line[512], *m_argv[50];
@@ -69,23 +69,31 @@ int readconf(char *name, void *rprivate,
     
     if (!(f = fopen(name, "r")))
     {
-       yaz_log(YLOG_WARN|YLOG_ERRNO, "readconf: %s", name);
-       return -1;
+        yaz_log(YLOG_WARN|YLOG_ERRNO, "readconf: %s", name);
+        return -1;
     }
     for (;;)
     {
-       int res;
-       
-       if (!(m_argc = readconf_line(f, &lineno, line, 512, m_argv, 50)))
-       {
-           fclose(f);
-           return 0;
-       }
+        int res;
+        
+        if (!(m_argc = readconf_line(f, &lineno, line, 512, m_argv, 50)))
+        {
+            fclose(f);
+            return 0;
+        }
 
-       if ((res = (*fun)(name, rprivate, m_argc, m_argv)))
-       {
-           fclose(f);
-           return res;
-       }
+        if ((res = (*fun)(name, rprivate, m_argc, m_argv)))
+        {
+            fclose(f);
+            return res;
+        }
     }
 }
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+