1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2013 Index Data
3 * See the file LICENSE for details.
7 * \brief Z39.50 element set utilities
14 #include <yaz/proto.h>
16 const char *yaz_get_esn(Z_RecordComposition *comp)
18 if (comp && comp->which == Z_RecordComp_complex)
20 if (comp->u.complex->generic
21 && comp->u.complex->generic->elementSpec
22 && (comp->u.complex->generic->elementSpec->which ==
23 Z_ElementSpec_elementSetName))
24 return comp->u.complex->generic->elementSpec->u.elementSetName;
26 else if (comp && comp->which == Z_RecordComp_simple &&
27 comp->u.simple->which == Z_ElementSetNames_generic)
28 return comp->u.simple->u.generic;
32 void yaz_set_esn(Z_RecordComposition **comp_p, const char *esn, NMEM nmem)
34 Z_RecordComposition *comp = (Z_RecordComposition *)
35 nmem_malloc(nmem, sizeof(*comp));
37 comp->which = Z_RecordComp_simple;
38 comp->u.simple = (Z_ElementSetNames *)
39 nmem_malloc(nmem, sizeof(*comp->u.simple));
40 comp->u.simple->which = Z_ElementSetNames_generic;
41 comp->u.simple->u.generic = nmem_strdup(nmem, esn);
50 * c-file-style: "Stroustrup"
51 * indent-tabs-mode: nil
53 * vim: shiftwidth=4 tabstop=8 expandtab