src/readconf.c
int readconf(char *name, void *rprivate,
             int (*fun)(char *name, void *rprivate, int argc, char *argv[]))
{
    FILE *f;
    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);
        return -1;
    }
    for (;;)
    {
        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;
        }
    }
}
/*
 * Read lines of a configuration file.
 */
Read lines of a configuration file.
Read lines of a configuration file .
int readconf(char *name, void *rprivate,
             int (*fun)(char *name, void *rprivate, int argc, char *argv[]))
{
    FILE *f;
    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);
        return -1;
    }
    for (;;)
    {
        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;
        }
    }
}
int readconf ( char * name , void * rprivate , int ( * fun ) ( char * name , void * rprivate , int argc , char * argv [ ] ) ) { FILE * f ; char line [ 512 ] , * m_argv [ 50 ] ; int m_argc ; int lineno = 0 ; if ( ! ( f = fopen ( name , " " ) ) ) { yaz_log ( YLOG_WARN | YLOG_ERRNO , " " , name ) ; return -1 ; } for ( ; ; ) { 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 ; } } }
Read lines of a configuration file.
Read lines of a configuration file .