static void output_easyall( FILE *fp, fields *f, char *tag, char *adstag, int level ) { vplist a; int i; vplist_init( &a ); fields_findv_each( f, level, FIELDS_CHRP, &a, tag ); for ( i=0; i<a.n; ++i ) fprintf( fp, "%s %s\n", adstag, (char *) vplist_get( &a, i ) ); vplist_free( &a ); }
static void output_keywords( FILE *fp, fields *f ) { vplist vpl; int i; vplist_init( &vpl ); fields_findv_each( f, LEVEL_ANY, FIELDS_CHRP, &vpl, "KEYWORD" ); for ( i=0; i<vpl.n; ++i ) fprintf( fp, "KW - %s\n", ( char * ) vplist_get( &vpl, i ) ); vplist_free( &vpl ); }
static void output_keys( FILE *fp, fields *f, char *tag, char *adstag, int level ) { vplist a; int i; vplist_init( &a ); fields_findv_each( f, level, FIELDS_CHRP, &a, tag ); for ( i=0; i<a.n; ++i ) { if ( i==0 ) fprintf( fp, "%s ", adstag ); else fprintf( fp, ", " ); fprintf( fp, "%s", (char *) vplist_get( &a, i ) ); } if ( a.n ) fprintf( fp, "\n" ); vplist_free( &a ); }
static void output_people( FILE *fp, fields *f, char *tag, char *ristag, int level ) { newstr oneperson; vplist people; int i; newstr_init( &oneperson ); vplist_init( &people ); fields_findv_each( f, level, FIELDS_CHRP, &people, tag ); for ( i=0; i<people.n; ++i ) { name_build_withcomma( &oneperson, ( char * ) vplist_get( &people, i ) ); fprintf( fp, "%s - %s\n", ristag, oneperson.data ); } vplist_free( &people ); newstr_free( &oneperson ); }
static void output_file( FILE *fp, fields *f, char *tag, char *ristag, int level ) { vplist a; char *fl; int i; vplist_init( &a ); fields_findv_each( f, level, FIELDS_CHRP, &a, tag ); for ( i=0; i<a.n; ++i ) { fprintf( fp, "%s - ", ristag ); fl = ( char * ) vplist_get( &a, i ); if ( !is_uri_scheme( fl ) ) fprintf( fp, "file:" ); fprintf( fp, "%s\n", fl ); } vplist_free( &a ); }
static void output_people( FILE *fp, fields *f, char *tag, char *isitag, int level ) { vplist people; int i; vplist_init( &people ); fields_findv_each( f, level, FIELDS_CHRP, &people, tag ); if ( people.n ) { fprintf( fp, "%s ", isitag ); for ( i=0; i<people.n; ++i ) { if ( i!=0 ) fprintf( fp, " " ); output_person( fp, (char *)vplist_get( &people, i ) ); fprintf( fp, "\n" ); } } vplist_free( &people ); }
static void output_keywords( FILE *fp, fields *f ) { vplist kw; int i; vplist_init( &kw ); fields_findv_each( f, LEVEL_ANY, FIELDS_CHRP, &kw, "KEYWORD" ); if ( kw.n ) { fprintf( fp, "DE " ); for ( i=0; i<kw.n; ++i ) { if ( i>0 ) fprintf( fp, "; " ); fprintf( fp, "%s", (char *)vplist_get( &kw, i ) ); } fprintf( fp, "\n" ); } vplist_free( &kw ); }
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; }