X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=util%2Freadconf.c;h=6973d1f754711ef5258cc7f85f3a97f71083d09f;hb=142235dcf39ff59a20918e53abcf62f59fa9f2a4;hp=a890e08187c4256e007c6acd16666662b33bb854;hpb=2004bbd9b3bbce5eb8ecc49520255b3d0bf578b9;p=yaz-moved-to-github.git diff --git a/util/readconf.c b/util/readconf.c index a890e08..6973d1f 100644 --- a/util/readconf.c +++ b/util/readconf.c @@ -1,10 +1,22 @@ /* - * Copyright (C) 1994, Index Data I/S + * Copyright (C) 1994-1997, Index Data I/S * All rights reserved. * Sebastian Hammer, Adam Dickmeiss * * $Log: readconf.c,v $ - * Revision 1.1 1995-11-01 13:55:06 quinn + * Revision 1.5 1997-09-04 07:53:02 adam + * Added include readconf.h. + * + * Revision 1.4 1997/05/14 06:54:07 adam + * C++ support. + * + * Revision 1.3 1996/05/29 15:48:48 quinn + * Added \n to the isspace rule. + * + * Revision 1.2 1996/05/29 10:05:01 quinn + * Changed space criteria to support 8-bit characters + * + * Revision 1.1 1995/11/01 13:55:06 quinn * Minor adjustments * * Revision 1.2 1995/10/30 13:54:27 quinn @@ -20,6 +32,9 @@ #include #include +#include + +#define l_isspace(c) ((c) == '\t' || (c) == ' ' || (c) == '\n') int readconf_line(FILE *f, char *line, int len, char *argv[], int num) { @@ -41,12 +56,12 @@ int readconf_line(FILE *f, char *line, int len, char *argv[], int num) if (*p == '#') /* trailing comment */ break; argv[argc] = p; - while (*p && !isspace(*p)) + while (*p && !l_isspace(*p)) p++; if (*p) { *(p++) = '\0'; - while (*p && isspace(*p)) + while (*p && l_isspace(*p)) p++; } } @@ -56,8 +71,8 @@ int readconf_line(FILE *f, char *line, int len, char *argv[], int num) /* * Read lines of a configuration file. */ -int readconf(char *name, void *private, - int (*fun)(char *name, void *private, int argc, char *argv[])) +int readconf(char *name, void *rprivate, + int (*fun)(char *name, void *rprivate, int argc, char *argv[])) { FILE *f; char line[512], *m_argv[50]; @@ -78,7 +93,7 @@ int readconf(char *name, void *private, return 0; } - if ((res = (*fun)(name, private, m_argc, m_argv))) + if ((res = (*fun)(name, rprivate, m_argc, m_argv))) { fclose(f); return res;