static void output_comments( fields *info, FILE *outptr, int level ) { vplist notes; char *abs; int i; vplist_init( ¬es ); abs = fields_findv( info, level, FIELDS_CHRP, "ABSTRACT" ); fields_findv_each( info, level, FIELDS_CHRP, ¬es, "NOTES" ); if ( abs || notes.n ) fprintf( outptr, "<b:Comments>" ); if ( abs ) fprintf( outptr, "%s", abs ); for ( i=0; i<notes.n; ++i ) fprintf( outptr, "%s", (char*)vplist_get( ¬es, i ) ); if ( abs || notes.n ) fprintf( outptr, "</b:Comments>\n" ); vplist_free( ¬es ); }
/* Try to determine type of reference from * <TypeOfResource></TypeOfResource> */ static int get_type_resource( fields *f, param *p ) { match_type match_res[] = { { "software, multimedia", TYPE_PROGRAM }, { "cartographic", TYPE_MAP }, }; int nmatch_res = sizeof( match_res ) / sizeof( match_res[0] ); int type, i, j; char *value; vplist a; type = TYPE_UNKNOWN; vplist_init( &a ); fields_findv_each( f, LEVEL_ANY, FIELDS_CHRP, &a, "RESOURCE" ); for ( i=0; i<a.n; ++i ) { value = ( char * ) vplist_get( &a, i ); for ( j=0; j<nmatch_res; ++j ) { if ( !strcasecmp( value, match_res[j].name ) ) type = match_res[j].type; } if ( p->verbose ) { if ( p->progname ) fprintf( stderr, "%s: ", p->progname ); fprintf( stderr, "Type from tag 'RESOURCE' data '%s': ", value ); write_type( stderr, type ); fprintf( stderr, "\n" ); } } if ( p->verbose ) { if ( p->progname ) fprintf( stderr, "%s: ", p->progname ); fprintf( stderr, "Type from resource element: " ); write_type( stderr, type ); fprintf( stderr, "\n" ); } vplist_free( &a ); return type; }