-/*
- * Copyright (C) 1994-2004, Index Data
- * All rights reserved.
- *
- * $Id: readconf.c,v 1.2 2004-10-15 00:19:00 adam Exp $
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2011 Index Data
+ * See the file LICENSE for details.
#define l_isspace(c) ((c) == '\t' || (c) == ' ' || (c) == '\n' || (c) == '\r')
int readconf_line(FILE *f, int *lineno, char *line, int len,
#define l_isspace(c) ((c) == '\t' || (c) == ' ' || (c) == '\n' || (c) == '\r')
int readconf_line(FILE *f, int *lineno, char *line, int len,
- 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++;
+ }
* Read lines of a configuration file.
*/
int readconf(char *name, void *rprivate,
* 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[]))
- 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;
+ }