X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fseshigh.c;h=9d7db7e8cb789e79ec36f1ce2efbe48e93665fa3;hp=05cc4649ae525f6dd40d2c260e220115ce81015a;hb=1bb6c593dea33c483d06114ab5fee75c06bc90e1;hpb=c6e47cbbff56f39f6d81b079ebaeac41d793d4d9 diff --git a/src/seshigh.c b/src/seshigh.c index 05cc464..9d7db7e 100644 --- a/src/seshigh.c +++ b/src/seshigh.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2003, Index Data * See the file LICENSE for details. * - * $Id: seshigh.c,v 1.1 2003-10-27 12:21:35 adam Exp $ + * $Id: seshigh.c,v 1.4 2003-12-04 11:48:06 adam Exp $ */ /* @@ -1443,7 +1443,7 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) Z_APDU *apdu = zget_APDU(assoc->encode, Z_APDU_initResponse); Z_InitResponse *resp = apdu->u.initResponse; bend_initresult *binitres; - + char *version; char options[140]; yaz_log(LOG_LOG, "Got initRequest"); @@ -1581,39 +1581,21 @@ static Z_APDU *process_initRequest(association *assoc, request *reqb) resp->preferredMessageSize = &assoc->preferredMessageSize; resp->maximumRecordSize = &assoc->maximumRecordSize; - resp->implementationName = "GFS/YAZ"; + resp->implementationId = odr_prepend(assoc->encode, + assoc->init->implementation_id, + resp->implementationId); - if (assoc->init->implementation_id) - { - char *nv = (char *) - odr_malloc (assoc->encode, - strlen(assoc->init->implementation_id) + 10 + - strlen(resp->implementationId)); - sprintf (nv, "%s / %s", - resp->implementationId, assoc->init->implementation_id); - resp->implementationId = nv; - } - if (assoc->init->implementation_name) - { - char *nv = (char *) - odr_malloc (assoc->encode, - strlen(assoc->init->implementation_name) + 10 + - strlen(resp->implementationName)); - sprintf (nv, "%s / %s", - resp->implementationName, assoc->init->implementation_name); - resp->implementationName = nv; - } - if (assoc->init->implementation_version) - { - char *nv = (char *) - odr_malloc (assoc->encode, - strlen(assoc->init->implementation_version) + 10 + - strlen(resp->implementationVersion)); - sprintf (nv, "YAZ %s / %s", - resp->implementationVersion, - assoc->init->implementation_version); - resp->implementationVersion = nv; - } + resp->implementationName = odr_prepend(assoc->encode, + assoc->init->implementation_name, + odr_prepend(assoc->encode, "GFS", resp->implementationName)); + + version = odr_strdup(assoc->encode, "$Revision: 1.4 $"); + if (strlen(version) > 10) /* check for unexpanded CVS strings */ + version[strlen(version)-2] = '\0'; + resp->implementationVersion = odr_prepend(assoc->encode, + assoc->init->implementation_version, + odr_prepend(assoc->encode, &version[11], + resp->implementationVersion)); if (binitres->errcode) { @@ -1944,6 +1926,7 @@ static Z_APDU *process_searchRequest(association *assoc, request *reqb, bsrr->basenames = req->databaseNames; bsrr->query = req->query; bsrr->stream = assoc->encode; + nmem_transfer(bsrr->stream->mem, reqb->request_mem); bsrr->decode = assoc->decode; bsrr->print = assoc->print; bsrr->errcode = 0;