strncpy(charset_buf, record_charset, sizeof(charset_buf)-1);
charset_buf[sizeof(charset_buf)-1] = '\0';
strncpy(charset_buf, record_charset, sizeof(charset_buf)-1);
charset_buf[sizeof(charset_buf)-1] = '\0';
yaz_marc_xml(mt, marc_type);
if (yaz_marc_decode_wrbuf(mt, buf, sz, wrbuf) > 0)
{
yaz_marc_xml(mt, marc_type);
if (yaz_marc_decode_wrbuf(mt, buf, sz, wrbuf) > 0)
{
yaz_opac_decode_wrbuf2(mt, opac_rec, wrbuf, cd2);
else
yaz_opac_decode_wrbuf(mt, opac_rec, wrbuf);
yaz_opac_decode_wrbuf2(mt, opac_rec, wrbuf, cd2);
else
yaz_opac_decode_wrbuf(mt, opac_rec, wrbuf);
static const char *get_record_format(WRBUF wrbuf, int *len,
Z_NamePlusRecord *npr,
int marctype, const char *charset,
static const char *get_record_format(WRBUF wrbuf, int *len,
Z_NamePlusRecord *npr,
int marctype, const char *charset,
{
const char *res = return_record_wrbuf(wrbuf, len, npr, marctype, charset);
#if YAZ_HAVE_XML2
{
const char *res = return_record_wrbuf(wrbuf, len, npr, marctype, charset);
#if YAZ_HAVE_XML2
if (npr->which == Z_NamePlusRecord_databaseRecord)
{
Z_External *r = (Z_External *) npr->u.databaseRecord;
if (npr->which == Z_NamePlusRecord_databaseRecord)
{
Z_External *r = (Z_External *) npr->u.databaseRecord;
ret = (const char *) npr->u.databaseRecord;
}
else if (!strcmp(type, "opac"))
ret = (const char *) npr->u.databaseRecord;
}
else if (!strcmp(type, "opac"))
{
char *type_spec = nmem_malloc(nmem,
strlen(type) + strlen(charset) + 11);
{
char *type_spec = nmem_malloc(nmem,
strlen(type) + strlen(charset) + 11);