int risin_processf( fields *risin, char *p, char *filename, long nref ) { newstr tag, data; newstr_init( &tag ); newstr_init( &data ); while ( *p ) { if ( risin_istag( p ) ) { p = process_line( &tag, &data, p ); /* no anonymous fields allowed */ /* if ( tag.len && data.len )*/ if ( tag.len ) fields_add( risin, tag.data, data.data, 0 ); } else { p = process_line2( &tag, &data, p ); if ( data.len && risin->nfields>0 ) { newstr *od; od = &(risin->data[risin->nfields-1] ); newstr_addchar( od, ' ' ); newstr_strcat( od, data.data ); } } newstr_empty( &tag ); newstr_empty( &data ); } newstr_free( &tag ); newstr_free( &data ); return 1; }
static int risin_processf( fields *risin, char *p, char *filename, long nref, param *pm ) { newstr tag, data; int status, n; newstrs_init( &tag, &data, NULL ); while ( *p ) { if ( risin_istag( p ) ) p = process_line( &tag, &data, p ); /* no anonymous fields allowed */ if ( tag.len ) { status = fields_add( risin, tag.data, data.data, 0 ); if ( status!=FIELDS_OK ) return 0; } else { p = process_line2( &tag, &data, p ); n = fields_num( risin ); if ( data.len && n>0 ) { newstr *od; od = fields_value( risin, n-1, FIELDS_STRP ); newstr_addchar( od, ' ' ); newstr_strcat( od, data.data ); } } newstrs_empty( &tag, &data, NULL ); } newstrs_free( &tag, &data, NULL ); return 1; }