static void xmlattrib_add( xml_attrib *a, char *attrib, char *value ) { if ( attrib ) list_addc( &(a->attrib), attrib ); else list_addc( &(a->attrib), "" ); if ( value ) list_addc( &(a->value), value ); else list_addc( &(a->value), "" ); }
/* process_string() * * Handle lines like: * * '@STRING{TL = {Tetrahedron Lett.}}' * * p should point to just after '@STRING' * * In BibTeX, if a string is defined several times, the last one is kept. * */ static int process_string( char *p ) { int n, status = BIBL_OK; newstr s1, s2, *t; newstrs_init( &s1, &s2, NULL ); while ( *p && *p!='{' && *p!='(' ) p++; if ( *p=='{' || *p=='(' ) p++; p = process_bibtexline( skip_ws( p ), &s1, &s2, 0, NULL ); if ( p==NULL ) { status = BIBL_ERR_MEMERR; goto out; } if ( s2.data ) { newstr_findreplace( &s2, "\\ ", " " ); } if ( s1.data ) { n = list_find( &find, s1.data ); if ( n==-1 ) { t = list_add( &find, &s1 ); if ( t==NULL ) { status = BIBL_ERR_MEMERR; goto out; } if ( s2.data ) t = list_add( &replace, &s2 ); else t = list_addc( &replace, "" ); if ( t==NULL ) { status = BIBL_ERR_MEMERR; goto out; } } else { if ( s2.data ) t = list_set( &replace, n, &s2 ); else t = list_setc( &replace, n, "" ); if ( t==NULL ) { status = BIBL_ERR_MEMERR; goto out; } } } out: newstrs_free( &s1, &s2, NULL ); return status; }