2 * Copyright (C) 1995-2006, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: elementset.c,v 1.1 2006-11-14 08:48:26 adam Exp $
9 * \brief File Path utilities
16 #include <yaz/proto.h>
18 const char *yaz_get_esn(Z_RecordComposition *comp)
20 if (comp && comp->which == Z_RecordComp_complex)
22 if (comp->u.complex->generic
23 && comp->u.complex->generic->elementSpec
24 && (comp->u.complex->generic->elementSpec->which ==
25 Z_ElementSpec_elementSetName))
26 return comp->u.complex->generic->elementSpec->u.elementSetName;
28 else if (comp && comp->which == Z_RecordComp_simple &&
29 comp->u.simple->which == Z_ElementSetNames_generic)
30 return comp->u.simple->u.generic;
34 void yaz_set_esn(Z_RecordComposition **comp_p, const char *esn, NMEM nmem)
36 Z_RecordComposition *comp = nmem_malloc(nmem, sizeof(*comp));
38 comp->which = Z_RecordComp_simple;
39 comp->u.simple = 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 * indent-tabs-mode: nil
52 * vim: shiftwidth=4 tabstop=8 expandtab