util/yaz-illclient.c
void parse_paramfile(char *arg, struct prog_args *args) {
    FILE *f=fopen(arg,"r");
#define BUFSIZE 4096
    char buf[BUFSIZE];
    int len;
    struct nameval *nv;
    if (!f) {
        yaz_log(YLOG_FATAL,"Could not open param file '%s' ", arg);
        printf("Could not open file '%s' \n",arg);
        exit(1);
    }
    yaz_log(YLOG_DEBUG,"Opened input file '%s' ",arg );
    while (fgets(buf,BUFSIZE,f)) {
        if (buf[0] != '#' ) {
            len=strlen(buf)-1;
            if (buf[len] == '\n')
                buf[len] = '\0' ;
            nv=parse_nameval(buf);
            append_nameval(args, nv);
        } /* not a comment */
    }
    (void) fclose(f);

    if (0) {
        nv=args->namevals;
        printf("nv chain: ================ \n");
        printf("(last:) %p: '%s' = '%s' (%p) \n",nv, nv->name, nv->val, nv->next );
        do {
            nv=nv->next;
            printf("%p: '%s' = '%s' (%p)\n",nv, nv->name, nv->val, nv->next );
        } while (nv != args->namevals );
        exit(1);
    }

}
/** \brief parse a parameter file */
\brief parse a parameter file
\ brief parse a parameter file
void parse_paramfile(char *arg, struct prog_args *args) {
    FILE *f=fopen(arg,"r");
#define BUFSIZE 4096
    char buf[BUFSIZE];
    int len;
    struct nameval *nv;
    if (!f) {
        yaz_log(YLOG_FATAL,"Could not open param file '%s' ", arg);
        printf("Could not open file '%s' \n",arg);
        exit(1);
    }
    yaz_log(YLOG_DEBUG,"Opened input file '%s' ",arg );
    while (fgets(buf,BUFSIZE,f)) {
        if (buf[0] != '#' ) {
            len=strlen(buf)-1;
            if (buf[len] == '\n')
                buf[len] = '\0' ;
            nv=parse_nameval(buf);
            append_nameval(args, nv);
        } 
    }
    (void) fclose(f);
    if (0) {
        nv=args->namevals;
        printf("nv chain: ================ \n");
        printf("(last:) %p: '%s' = '%s' (%p) \n",nv, nv->name, nv->val, nv->next );
        do {
            nv=nv->next;
            printf("%p: '%s' = '%s' (%p)\n",nv, nv->name, nv->val, nv->next );
        } while (nv != args->namevals );
        exit(1);
    }
}
void parse_paramfile ( char * arg , struct prog_args * args ) { FILE * f = fopen ( arg , " " ) ; #define BUFSIZE  4096 char buf [ BUFSIZE ] ; int len ; struct nameval * nv ; if ( ! f ) { yaz_log ( YLOG_FATAL , " " , arg ) ; printf ( " \n " , arg ) ; exit ( 1 ) ; } yaz_log ( YLOG_DEBUG , " " , arg ) ; while ( fgets ( buf , BUFSIZE , f ) ) { if ( buf [ 0 ] != ' ' ) { len = strlen ( buf ) - 1 ; if ( buf [ len ] == ' \n ' ) buf [ len ] = ' \0 ' ; nv = parse_nameval ( buf ) ; append_nameval ( args , nv ) ; } } ( void ) fclose ( f ) ; if ( 0 ) { nv = args -> namevals ; printf ( " \n " ) ; printf ( " \n " , nv , nv -> name , nv -> val , nv -> next ) ; do { nv = nv -> next ; printf ( " \n " , nv , nv -> name , nv -> val , nv -> next ) ; } while ( nv != args -> namevals ) ; exit ( 1 ) ; } }
\brief parse a parameter file
\ brief parse a parameter file
/* not a comment */