Ejemplo n.º 1
0
static struct gfs_server * gfs_server_new(void)
{
    struct gfs_server *n = (struct gfs_server *)
        nmem_malloc(gfs_nmem, sizeof(*n));
    memcpy(&n->cb, &control_block, sizeof(control_block));
    n->next = 0;
    n->host = 0;
    n->listen_ref = 0;
    n->cql_transform = 0;
    n->ccl_transform = 0;
    n->server_node_ptr = 0;
    n->directory = 0;
    n->docpath = 0;
    n->stylesheet = 0;
    n->retrieval = yaz_retrieval_create();
    return n;
}
Ejemplo n.º 2
0
yaz_retrieval_t conv_configure(const char *xmlstring, WRBUF w)
{
    xmlDocPtr doc = xmlParseMemory(xmlstring, strlen(xmlstring));
    if (!doc)
    {
        wrbuf_printf(w, "xmlParseMemory");
        return 0;
    }
    else
    {
        xmlNodePtr ptr = xmlDocGetRootElement(doc);
        yaz_retrieval_t p = yaz_retrieval_create();

        if (p)
        {
            const char *srcdir = getenv("srcdir");
            if (srcdir)
                yaz_retrieval_set_path(p, srcdir);
        }
        if (!ptr)
        {
            wrbuf_printf(w, "xmlDocGetRootElement");
            yaz_retrieval_destroy(p);
            p = 0;
        }
        else if (!p)
        {
            wrbuf_printf(w, "yaz_retrieval_create");
        }
        else
        {
            int r = yaz_retrieval_configure(p, ptr);

            if (r)
            {
                wrbuf_puts(w, yaz_retrieval_get_error(p));
                yaz_retrieval_destroy(p);
                p = 0;
            }
        }
        xmlFreeDoc(doc);
        return p;
    }
}