-/*Revision 1.16 2002-11-26 17:09:18 mike
+/*Revision 1.20 2003-09-09 20:12:38 mike
+/*Return diagnostics on Init failure
+/*
+/*Revision 1.19 2003/09/09 11:40:10 mike
+/*(Finally!) support implementation-ID
+/*
+/*Revision 1.18 2003/01/03 09:05:41 sondberg
+/*Applied Dave's GRS-1 patch - actually this was already done in revision 1.17.
+/*
+/*Revision 1.16 2002/11/26 17:09:18 mike
- char line[512], *buf, *ptr, *original;
- char value[512];
+ char line[GRS_BUF_SIZE+1], *buf, *ptr, *original;
+ char value[GRS_BUF_SIZE+1];
- strncpy(line, str, ptr - str);
- line[ptr - str] = 0;
+ len = ptr - str;
+ if (len > GRS_BUF_SIZE) {
+ yaz_log(LOG_WARN, "GRS string too long - truncating (%d > %d)", len, GRS_BUF_SIZE);
+ len = GRS_BUF_SIZE;
+ }
+ strncpy(line, str, len);
+ line[len] = 0;
if (sscanf(buf, "(%d,%[^)])", &type, value) != 2)
{
yaz_log(LOG_WARN, "Bad data in '%s'", buf);
if (sscanf(buf, "(%d,%[^)])", &type, value) != 2)
{
yaz_log(LOG_WARN, "Bad data in '%s'", buf);
}
if (!type && *value == '0')
return r;
if (!(buf = strchr(buf, ')')))
}
if (!type && *value == '0')
return r;
if (!(buf = strchr(buf, ')')))
- if (!*buf)
- return 0;
- if (!r)
- {
- r = (Z_GenericRecord *)odr_malloc(o, sizeof(*r));
- r->elements = (Z_TaggedElement **)
- odr_malloc(o, sizeof(Z_TaggedElement*) * GRS_MAX_FIELDS);
- r->num_elements = 0;
- }
- if (r->num_elements > GRS_MAX_FIELDS)
+ if (r->num_elements >= GRS_MAX_FIELDS)
hv_store(href, "IMP_NAME", 8, newSVpv("", 0), 0);
hv_store(href, "IMP_VER", 7, newSVpv("", 0), 0);
hv_store(href, "ERR_CODE", 8, newSViv(0), 0);
hv_store(href, "IMP_NAME", 8, newSVpv("", 0), 0);
hv_store(href, "IMP_VER", 7, newSVpv("", 0), 0);
hv_store(href, "ERR_CODE", 8, newSViv(0), 0);
hv_store(href, "PEER_NAME", 9, newSVpv(q->peer_name, 0), 0);
hv_store(href, "HANDLE", 6, newSVsv(&sv_undef), 0);
hv_store(href, "PID", 3, newSViv(getpid()), 0);
hv_store(href, "PEER_NAME", 9, newSVpv(q->peer_name, 0), 0);
hv_store(href, "HANDLE", 6, newSVsv(&sv_undef), 0);
hv_store(href, "PID", 3, newSViv(getpid()), 0);
temp = hv_fetch(href, "ERR_CODE", 8, 1);
status = newSVsv(*temp);
temp = hv_fetch(href, "ERR_CODE", 8, 1);
status = newSVsv(*temp);
temp = hv_fetch(href, "HANDLE", 6, 1);
handle= newSVsv(*temp);
temp = hv_fetch(href, "HANDLE", 6, 1);
handle= newSVsv(*temp);
+ ptr = SvPV(err_str, len);
+ r->errstring = (char *)odr_malloc(q->stream, len + 1);
+ strcpy(r->errstring, ptr);
+ sv_free(err_str);
ptr = SvPV(id, len);
q->implementation_id = (char *)xmalloc(len + 1);
strcpy(q->implementation_id, ptr);
ptr = SvPV(id, len);
q->implementation_id = (char *)xmalloc(len + 1);
strcpy(q->implementation_id, ptr);
ptr = SvPV(name, len);
q->implementation_name = (char *)xmalloc(len + 1);
strcpy(q->implementation_name, ptr);
ptr = SvPV(name, len);
q->implementation_name = (char *)xmalloc(len + 1);
strcpy(q->implementation_name, ptr);