X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=zlayer-yaz%2Fzaccess.c;h=8d07fa6342743852b6329bbe12fb59446c88d15d;hb=4938d0c2e8f4e1eec397c2bfbbc7e23fd150c369;hp=f9e93ad6a562a97f2bf780aea57f44c873b1bc11;hpb=91d8877d6db53047e46b24f39ba95e7a01691755;p=egate.git diff --git a/zlayer-yaz/zaccess.c b/zlayer-yaz/zaccess.c index f9e93ad..8d07fa6 100644 --- a/zlayer-yaz/zaccess.c +++ b/zlayer-yaz/zaccess.c @@ -47,7 +47,19 @@ * Z39.50 API for the Email gateway - YAZ version * * $Log: zaccess.c,v $ - * Revision 1.1 1995/07/03 08:21:31 adam + * Revision 1.5 1996/01/03 08:58:12 adam + * Updated to use new version of Yaz (some names changed to avoid C++ conflict). + * + * Revision 1.4 1995/07/28 10:51:34 adam + * Bug fix: multiple databases weren't specified correctly. + * + * Revision 1.3 1995/07/20 08:18:15 adam + * Bug fix: Multiple databases are separated by commas and NOT by space. + * + * Revision 1.2 1995/07/05 11:08:33 adam + * Bug fix in init request. + * + * Revision 1.1 1995/07/03 08:21:31 adam * Yaz layer moved to new sub directory. zaccess aligned with new * YAZ version (1.0b). * @@ -181,6 +193,13 @@ static int send_initreq(struct zass *p, char *auth) req->preferredMessageSize = &p->preferredmessagesize; req->maximumRecordSize = &p->maxrecordsize; + ODR_MASK_SET(req->options, Z_Options_search); + ODR_MASK_SET(req->options, Z_Options_present); + ODR_MASK_SET(req->options, Z_Options_namedResultSets); + + ODR_MASK_SET(req->protocolVersion, Z_ProtocolVersion_1); + ODR_MASK_SET(req->protocolVersion, Z_ProtocolVersion_2); + if (auth) { req->idAuthentication = &idauth; @@ -359,9 +378,9 @@ static Z_RPNStructure *rpn2rpn(ODR o, struct ccl_rpn_node *q) if (!(r->u.complex->s1 = rpn2rpn(o, q->u.p[0])) || !(r->u.complex->s2 = rpn2rpn(o, q->u.p[1]))) return 0; - r->u.complex->operator = odr_malloc(o, sizeof(Z_Operator)); - r->u.complex->operator->which = op[q->kind]; - r->u.complex->operator->u.and = ""; + r->u.complex->roperator = odr_malloc(o, sizeof(Z_Operator)); + r->u.complex->roperator->which = op[q->kind]; + r->u.complex->roperator->u.and = ""; return r; default: gw_log(GW_LOG_FATAL, ZASS_TYPE, "Bad operator in RPN"); @@ -402,7 +421,7 @@ const struct zass_searchent *zass_searchresult(ZASS a, int *complete) if (dr->which != Z_DiagRec_defaultFormat || !(id = oid_getentbyoid (dr->u.defaultFormat->diagnosticSetId)) || - id->class != CLASS_DIAGSET || + id->oclass != CLASS_DIAGSET || id->value != VAL_BIB1) gw_log(GW_LOG_WARN, ZASS_TYPE, "Missing or unknown diagset - ignoring error!"); @@ -464,18 +483,19 @@ const struct zass_searchent *zass_search(ZASS a, struct ccl_rpn_node *query, char *p = databases; int more; - while (*p && !isspace(*p)) + while (*p && !isspace(*p) && *p != ',') p++; - if (isspace(*p)) + if (*p) more = 1; else more = 0; - *p = '\0'; if (p - databases) { req->databaseNames[req->num_databaseNames] = odr_malloc(a->encode, (p - databases) + 1); - strcpy(req->databaseNames[req->num_databaseNames++], databases); + memcpy(req->databaseNames[req->num_databaseNames], databases, + p-databases); + req->databaseNames[req->num_databaseNames++][p-databases] = '\0'; } databases = p + more; } @@ -483,7 +503,7 @@ const struct zass_searchent *zass_search(ZASS a, struct ccl_rpn_node *query, q.which = Z_Query_type_1; q.u.type_1 = &rpnq; bib1.proto = PROTO_Z3950; - bib1.class = CLASS_ATTSET; + bib1.oclass = CLASS_ATTSET; bib1.value = VAL_BIB1; rpnq.attributeSetId = oid_getoidbyent(&bib1); @@ -557,7 +577,7 @@ void get_responserecords(zass_record ***p, Z_NamePlusRecordList *recs) (**p)->next = 0; if (!(recform = oid_getentbyoid(r->direct_reference)) || - recform->class != CLASS_RECSYN) + recform->oclass != CLASS_RECSYN) { gw_log(GW_LOG_WARN, ZASS_TYPE, "Unknown or bad record syntax"); (**p)->which = ZASS_REC_UNKNOWN;