2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.1 1995-11-01 13:55:06 quinn
10 * Revision 1.2 1995/10/30 13:54:27 quinn
13 * Revision 1.1 1995/10/10 16:28:18 quinn
24 int readconf_line(FILE *f, char *line, int len, char *argv[], int num)
29 while ((p = fgets(line, len, f)))
31 while (*p && isspace(*p))
39 for (argc = 0; *p ; argc++)
41 if (*p == '#') /* trailing comment */
44 while (*p && !isspace(*p))
49 while (*p && isspace(*p))
57 * Read lines of a configuration file.
59 int readconf(char *name, void *private,
60 int (*fun)(char *name, void *private, int argc, char *argv[]))
63 char line[512], *m_argv[50];
66 if (!(f = fopen(name, "r")))
68 logf(LOG_WARN|LOG_ERRNO, "readconf: %s", name);
75 if (!(m_argc = readconf_line(f, line, 512, m_argv, 50)))
81 if ((res = (*fun)(name, private, m_argc, m_argv)))