X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Freadconf.c;h=2c444f5a56b4062fd24028edded3d8c6e4c25019;hp=f9235265de8b7ea384f240acfecf4097bdc94405;hb=0d6f3ee9720647761ff74414a46828c0b9711ac0;hpb=fb6d99a0c7e07d9cc4a315c447deaf6564a85505 diff --git a/src/readconf.c b/src/readconf.c index f923526..2c444f5 100644 --- a/src/readconf.c +++ b/src/readconf.c @@ -1,8 +1,6 @@ -/* - * Copyright (C) 1995-2005, Index Data ApS - * All rights reserved. - * - * $Id: readconf.c,v 1.6 2005-06-25 15:46:04 adam Exp $ +/* This file is part of the YAZ toolkit. + * Copyright (C) Index Data + * See the file LICENSE for details. */ /** @@ -15,7 +13,6 @@ #endif #include -#include #include #include @@ -27,7 +24,7 @@ int readconf_line(FILE *f, int *lineno, char *line, int len, { char *p; int argc; - + while ((p = fgets(line, len, f))) { (*lineno)++; @@ -38,8 +35,8 @@ int readconf_line(FILE *f, int *lineno, char *line, int len, } if (!p) return 0; - - for (argc = 0; *p ; argc++) + + for (argc = 0; *p && argc < num ; argc++) { if (*p == '#') /* trailing comment */ break; @@ -66,7 +63,7 @@ int readconf(char *name, void *rprivate, char line[512], *m_argv[50]; int m_argc; int lineno = 0; - + if (!(f = fopen(name, "r"))) { yaz_log(YLOG_WARN|YLOG_ERRNO, "readconf: %s", name); @@ -75,7 +72,7 @@ int readconf(char *name, void *rprivate, for (;;) { int res; - + if (!(m_argc = readconf_line(f, &lineno, line, 512, m_argv, 50))) { fclose(f); @@ -92,6 +89,7 @@ int readconf(char *name, void *rprivate, /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab