示例#1
0
文件: marcdump.c 项目: nla/yaz
static void show_version(void)
{
    char vstr[20], sha1_str[41];

    yaz_version(vstr, sha1_str);
    printf("YAZ version: %s %s\n", YAZ_VERSION, YAZ_VERSION_SHA1);
    if (strcmp(sha1_str, YAZ_VERSION_SHA1))
        printf("YAZ DLL/SO: %s %s\n", vstr, sha1_str);
    exit(0);
}
示例#2
0
static void cmd_info(struct http_channel *c)
{
    char yaz_version_str[20];
    char yaz_sha1_str[42];

    response_open_no_status(c, "info");
    wrbuf_puts(c->wrbuf, "\n <version>\n");
    wrbuf_puts(c->wrbuf, "  <pazpar2");
#ifdef PAZPAR2_VERSION_SHA1
    wrbuf_printf(c->wrbuf, " sha1=\"%s\"", PAZPAR2_VERSION_SHA1);
#endif
    wrbuf_puts(c->wrbuf, ">");
    wrbuf_xmlputs(c->wrbuf, VERSION);
    wrbuf_puts(c->wrbuf, "</pazpar2>\n");

    yaz_version(yaz_version_str, yaz_sha1_str);
    wrbuf_puts(c->wrbuf, "  <yaz compiled=\"");
    wrbuf_xmlputs(c->wrbuf, YAZ_VERSION);
    wrbuf_puts(c->wrbuf, "\" sha1=\"");
    wrbuf_xmlputs(c->wrbuf, yaz_sha1_str);
    wrbuf_puts(c->wrbuf, "\">");
    wrbuf_xmlputs(c->wrbuf, yaz_version_str);
    wrbuf_puts(c->wrbuf, "</yaz>\n");

    wrbuf_puts(c->wrbuf, " </version>\n");
#if HAVE_UNISTD_H
    {
        char hostname_str[64];
        if (gethostname(hostname_str, sizeof(hostname_str)) == 0)
        {
            wrbuf_puts(c->wrbuf, " <host>");
            wrbuf_xmlputs(c->wrbuf, hostname_str);
            wrbuf_puts(c->wrbuf, "</host>\n");
        }
    }
#endif
    info_services(c->server, c->wrbuf);

    response_close(c, "info");
}