+--- 4.2.7 2011/08/03
+
+ZOOM C includes HTTP response buffer as additional info if it fails
+to decode the SRU response.
+
+Make wrbuf_json_puts available.
+
--- 4.2.6 2011/07/28
zoom: throw diagnostic for invalid value for option "sru". Before a
#if YAZ_HAVE_XML2
if (protocol == PROTO_HTTP)
- return send_SRW_update(action_no, recid_buf, rec_buf, rec_len);
+ return send_SRW_update(action_no, recid, rec_buf, rec_len);
#endif
- return send_Z3950_update(version, action_no, recid_buf, rec_buf, rec_len);
+ return send_Z3950_update(version, action_no, recid, rec_buf, rec_len);
}
#if YAZ_HAVE_XML2
dnl This file is part of the YAZ toolkit.
dnl Copyright (C) 1995-2011 Index Data
AC_PREREQ([2.60])
-AC_INIT([yaz],[4.2.6],[yaz-help@indexdata.dk])
+AC_INIT([yaz],[4.2.7],[yaz-help@indexdata.dk])
AC_CONFIG_HEADERS(include/config.h)
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_AUX_DIR([config])
+yaz (4.2.7-1indexdata) unstable; urgency=low
+
+ * Upstream.
+
+ -- Adam Dickmeiss <adam@indexdata.dk> Wed, 03 Aug 2011 13:35:38 +0200
+
yaz (4.2.6-1indexdata) unstable; urgency=low
* Upstream.
dh_fixperms
# dh_perl
# dh_python
- dh_makeshlibs -V 'libyaz4 (>= 4.2.6)'
+ dh_makeshlibs -V 'libyaz4 (>= 4.2.7)'
dh_installdeb
dh_shlibdeps -l debian/libyaz4/usr/lib
dh_gencontrol
noinst_HEADERS = icu_I18N.h
-pkginclude_HEADERS= backend.h ccl.h ccl_xml.h cql.h rpn2cql.h rpn2solr.h \
+pkginclude_HEADERS= backend.h base64.h \
+ ccl.h ccl_xml.h cql.h rpn2cql.h rpn2solr.h \
solr.h comstack.h \
diagbib1.h diagsrw.h diagsru_update.h sortspec.h log.h logrpn.h marcdisp.h \
nmem.h nmem_xml.h odr.h errno.h facet.h \
--- /dev/null
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2011 Index Data.
+ * All rights reserved.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of Index Data nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * \file base64.h
+ * \brief Header for Base64 utilities
+ */
+
+#ifndef YAZ_BASE64_H
+#define YAZ_BASE64_H
+
+#include <yaz/yconfig.h>
+
+YAZ_BEGIN_CDECL
+
+/** \brief encodes Base64 string
+ \param in input string
+ \param out resulting Base64 string
+
+ The out buffer should at least be of size:
+
+ (strlen(in)*8) / 6 + 12
+*/
+YAZ_EXPORT
+void yaz_base64encode(const char *in, char *out);
+
+/** \brief decodes Base64 string
+ \param in input Base64 encoded string
+ \param out result string
+ \retval 0 OK
+ \retval -1 invalid character
+
+ The out buffer should at least be of size:
+
+ strlen(in)
+*/
+YAZ_EXPORT
+int yaz_base64decode(const char *in, char *out);
+
+YAZ_END_CDECL
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
YAZ_EXPORT
void json_write_wrbuf(struct json_node *node, WRBUF result);
+/** \brief writes JSON text to WRBUF with escaping
+ \param b result
+ \param str input string to be encoded
+*/
+YAZ_EXPORT
+void wrbuf_json_puts(WRBUF b, const char *str);
+
YAZ_END_CDECL
#endif
YAZ_EXPORT void nmem_strsplit_blank(NMEM nmem, const char *dstr,
char ***darray, int *num);
+
+/** \brief allocates sub strings out of string using certain delimitors
+ \param nmem NMEM handle
+ \param delim delimitor chars (splits on each char in there)
+ \param dstr string to be split
+ \param darray result string array for each sub string
+ \param num number of result strings
+ \param collapse 1=collapse multiple delims to one; 0=no collapse
+ \param escape_char != 0, an escape char (could be \)
+*/
+YAZ_EXPORT void nmem_strsplit_escape(NMEM nmem, const char *delim,
+ const char *dstr,
+ char ***darray, int *num, int collapse,
+ int escape_char);
+
/** \brief allocates and sets integer for NMEM
\param nmem NMEM handle
\param v integer value
*/
YAZ_EXPORT void wrbuf_rewind(WRBUF b);
-/** \brief append constant size buffer to WRBU
+/** \brief append constant size buffer to WRBUF
\param b WRBUF
\param buf buffer
\param size size of buffer
*/
YAZ_EXPORT void wrbuf_write(WRBUF b, const char *buf, size_t size);
+/** \brief inserts buffer into WRBUF at some position
+ \param b WRBUF
+ \param pos position (0=beginning)
+ \param buf buffer
+ \param size size of buffer
+ */
+YAZ_EXPORT void wrbuf_insert(WRBUF b, size_t pos, const char *buf, size_t size);
+
/** \brief appends C-string to WRBUF
\param b WRBUF
\param buf C-string (0-terminated)
z-charneg.c \
ill-core.c item-req.c oclc-ill-req-ext.c
-libyaz_la_SOURCES=version.c options.c log.c \
+libyaz_la_SOURCES=base64.c version.c options.c log.c \
$(GEN_FILES) \
marcdisp.c marc_read_xml.c marc_read_iso2709.c marc_read_line.c \
wrbuf.c oid_db.c errno.c \
--- /dev/null
+/* This file is part of the YAZ toolkit.
+ * Copyright (C) 1995-2011 Index Data
+ * See the file LICENSE for details.
+ */
+/**
+ * \file base64.c
+ * \brief Base64 encode/decode utilities
+ */
+#if HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <yaz/base64.h>
+
+void yaz_base64encode(const char *in, char *out)
+{
+ static char encoding[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+ unsigned char buf[3];
+ long n;
+
+ while (*in != 0)
+ {
+ const char *pad = 0;
+ buf[0] = in[0];
+ buf[1] = in[1];
+ if (in[1] == 0)
+ {
+ buf[2] = 0;
+ pad = "==";
+ }
+ else
+ {
+ buf[2] = in[2];
+ if (in[2] == 0)
+ pad = "=";
+ }
+
+ /* Treat three eight-bit numbers as on 24-bit number */
+ n = (buf[0] << 16) + (buf[1] << 8) + buf[2];
+
+ /* Write the six-bit chunks out as four encoded characters */
+ *out++ = encoding[(n >> 18) & 63];
+ *out++ = encoding[(n >> 12) & 63];
+ if (in[1] != 0)
+ *out++ = encoding[(n >> 6) & 63];
+ if (in[1] != 0 && in[2] != 0)
+ *out++ = encoding[n & 63];
+
+ if (pad != 0) {
+ while (*pad != 0)
+ *out++ = *pad++;
+ break;
+ }
+ in += 3;
+ }
+ *out++ = 0;
+}
+
+int yaz_base64decode(const char *in, char *out)
+{
+ const char *map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz0123456789+/";
+ int len = strlen(in);
+
+ while (len >= 4)
+ {
+ char i0, i1, i2, i3;
+ char *p;
+
+ if (!(p = strchr(map, in[0])))
+ return -1;
+ i0 = p - map;
+ len--;
+ if (!(p = strchr(map, in[1])))
+ return -1;
+ i1 = p - map;
+ len--;
+ *(out++) = i0 << 2 | i1 >> 4;
+ if (in[2] == '=')
+ break;
+ if (!(p = strchr(map, in[2])))
+ return -1;
+ i2 = p - map;
+ len--;
+ *(out++) = i1 << 4 | i2 >> 2;
+ if (in[3] == '=')
+ break;
+ if (!(p = strchr(map, in[3])))
+ return -1;
+ i3 = p - map;
+ len--;
+ *(out++) = i2 << 6 | i3;
+
+ in += 4;
+ }
+
+ *out = '\0';
+ return 0;
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * c-file-style: "Stroustrup"
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
#include <yaz/yaz-iconv.h>
#include <yaz/matchstr.h>
#include <yaz/zgdu.h>
+#include <yaz/base64.h>
#ifdef WIN32
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
-
-/*
- * This function's counterpart, yaz_base64decode(), is in srwutil.c.
- * I feel bad that they're not together, but each function is only
- * needed in one place, and those places are not together. Maybe one
- * day we'll move them into a new httputil.c, and declare them in a
- * corresponding httputil.h
- */
-static void yaz_base64encode(const char *in, char *out)
-{
- static char encoding[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- unsigned char buf[3];
- long n;
-
- while (*in != 0) {
- char *pad = 0;
- buf[0] = in[0];
- buf[1] = in[1];
- if (in[1] == 0) {
- buf[2] = 0;
- pad = "==";
- } else {
- buf[2] = in[2];
- if (in[2] == 0)
- pad = "=";
- }
-
- /* Treat three eight-bit numbers as on 24-bit number */
- n = (buf[0] << 16) + (buf[1] << 8) + buf[2];
-
- /* Write the six-bit chunks out as four encoded characters */
- *out++ = encoding[(n >> 18) & 63];
- *out++ = encoding[(n >> 12) & 63];
- if (in[1] != 0)
- *out++ = encoding[(n >> 6) & 63];
- if (in[1] != 0 && in[2] != 0)
- *out++ = encoding[n & 63];
-
- if (pad != 0) {
- while (*pad != 0)
- *out++ = *pad++;
- break;
- }
- in += 3;
- }
-
- *out++ = 0;
-}
-
-
static int decode_headers_content(ODR o, int off, Z_HTTP_Header **headers,
char **content_buf, int *content_len)
{
void nmem_strsplitx(NMEM nmem, const char *delim, const char *dstr,
char ***darray, int *num, int collapse)
{
- const char *cp = dstr;
- *num = 0;
+ nmem_strsplit_escape(nmem, delim, dstr, darray, num, collapse, 0);
+}
+void nmem_strsplit_escape(NMEM nmem, const char *delim, const char *dstr,
+ char ***darray, int *num, int collapse,
+ int escape_char)
+{
+ *darray = 0;
+ /* two passes over the input string.. */
while (1)
{
- if (collapse)
- {
- if (!*cp)
- break;
- while (*cp && strchr(delim, *cp))
- cp++;
- if (!*cp)
- break;
- while (*cp && !strchr(delim, *cp))
- cp++;
- (*num)++;
- }
- else
- {
- (*num)++;
- while (*cp && !strchr(delim, *cp))
- cp++;
- if (!*cp)
- break;
- cp++;
- }
- }
- if (!*num)
- *darray = 0;
- else
- {
size_t i = 0;
- *darray = (char **) nmem_malloc(nmem, *num * sizeof(**darray));
- cp = dstr;
+ const char *cp = dstr;
while (1)
{
const char *cp0;
{
if (!*cp)
break;
- while (*cp && strchr(delim, *cp))
+ while (*cp && strchr(delim, *cp) && *cp != escape_char)
cp++;
if (!*cp)
break;
cp0 = cp;
while (*cp && !strchr(delim, *cp))
+ {
+ if (*cp == escape_char)
+ cp++;
cp++;
- (*darray)[i++] = nmem_strdupn(nmem, cp0, cp - cp0);
+ }
+ if (*darray)
+ (*darray)[i] = nmem_strdupn(nmem, cp0, cp - cp0);
+ i++;
}
else
{
cp0 = cp;
while (*cp && !strchr(delim, *cp))
+ {
+ if (*cp == escape_char)
+ cp++;
cp++;
- (*darray)[i++] = nmem_strdupn(nmem, cp0, cp - cp0);
+ }
+ if (*darray)
+ (*darray)[i] = nmem_strdupn(nmem, cp0, cp - cp0);
+ i++;
if (!*cp)
break;
cp++;
}
}
+ *num = i;
+ if (!*num)
+ break; /* no items, so stop, *darray=0 already */
+ else if (*darray)
+ break; /* second pass, stop */
+ *darray = (char **) nmem_malloc(nmem, *num * sizeof(**darray));
}
}
{0, 0, 0}
};
char ctype[80];
- int ret;
p = z_get_HTTP_Response(o, 200);
hres = p->u.HTTP_Response;
if (stylesheet && *stylesheet == '\0')
stylesheet = 0;
- ret = z_soap_codec_enc_xsl(assoc->encode, &soap_package,
- &hres->content_buf, &hres->content_len,
- soap_handlers, charset, stylesheet);
+ z_soap_codec_enc_xsl(assoc->encode, &soap_package,
+ &hres->content_buf, &hres->content_len,
+ soap_handlers, charset, stylesheet);
hres->code = http_code;
strcpy(ctype, "text/xml");
Odr_int *next;
Odr_int *num;
int errcode = 0;
- const char *errstring = 0;
yaz_log(log_requestdetail, "Got PresentRequest.");
resp->records = diagrec(assoc, bprr->errcode, bprr->errstring);
*resp->presentStatus = Z_PresentStatus_failure;
errcode = bprr->errcode;
- errstring = bprr->errstring;
}
}
apdu = (Z_APDU *)odr_malloc(assoc->encode, sizeof(*apdu));
struct gfs_server {
statserv_options_block cb;
char *host;
+ char *id;
int listen_ref;
cql_transform_t cql_transform;
CCL_bibset ccl_transform;
#include <assert.h>
#include <yaz/srw.h>
#include <yaz/matchstr.h>
+#include <yaz/base64.h>
#include <yaz/yaz-iconv.h>
#include "sru-p.h"
}
#endif
-static int yaz_base64decode(const char *in, char *out)
-{
- const char *map = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- "abcdefghijklmnopqrstuvwxyz0123456789+/";
- int olen = 0;
- int len = strlen(in);
-
- while (len >= 4)
- {
- char i0, i1, i2, i3;
- char *p;
-
- if (!(p = strchr(map, in[0])))
- return 0;
- i0 = p - map;
- len--;
- if (!(p = strchr(map, in[1])))
- return 0;
- i1 = p - map;
- len--;
- *(out++) = i0 << 2 | i1 >> 4;
- olen++;
- if (in[2] == '=')
- break;
- if (!(p = strchr(map, in[2])))
- return 0;
- i2 = p - map;
- len--;
- *(out++) = i1 << 4 | i2 >> 2;
- olen++;
- if (in[3] == '=')
- break;
- if (!(p = strchr(map, in[3])))
- return 0;
- i3 = p - map;
- len--;
- *(out++) = i2 << 6 | i3;
- olen++;
-
- in += 4;
- }
-
- *out = '\0';
- return olen;
-}
-
int yaz_srw_check_content_type(Z_HTTP_Response *hres)
{
const char *content_type = z_HTTP_header_lookup(hres->headers,
if (basic)
{
- int len, olen;
+ int len;
char out[256];
char ubuf[256] = "", pbuf[256] = "", *p;
if (strncmp(basic, "Basic ", 6))
len = strlen(basic);
if (!len || len > 256)
return;
- olen = yaz_base64decode(basic, out);
+ yaz_base64decode(basic, out);
/* Format of out should be username:password at this point */
strcpy(ubuf, out);
if ((p = strchr(ubuf, ':')))
char *startRecord = 0;
char *maximumTerms = 0;
char *responsePosition = 0;
- char *extraRequestData = 0;
Z_SRW_extra_arg *extra_args = 0;
#endif
char **uri_name;
else if (!strcmp(n, "responsePosition"))
responsePosition = v;
else if (!strcmp(n, "extraRequestData"))
- extraRequestData = v;
+ ; /* ignoring extraRequestData */
else if (n[0] == 'x' && n[1] == '-')
{
Z_SRW_extra_arg **l = &extra_args;
#endif
#if YAZ_HAVE_XML2
-static struct gfs_server * gfs_server_new(void)
+static struct gfs_server * gfs_server_new(const char *id)
{
struct gfs_server *n = (struct gfs_server *)
nmem_malloc(gfs_nmem, sizeof(*n));
n->directory = 0;
n->docpath = 0;
n->stylesheet = 0;
+ n->id = nmem_strdup_null(gfs_nmem, id);
n->retrieval = yaz_retrieval_create();
return n;
}
else
yaz_log(YLOG_WARN, "Unknown attribute '%s' for server",
attr->name);
- gfs = *gfsp = gfs_server_new();
+ gfs = *gfsp = gfs_server_new(id);
gfs->server_node_ptr = ptr_server;
if (listenref)
{
int allow_severity = LOG_INFO; /* not YLOG !! */
int deny_severity = LOG_WARNING;
-#ifdef LOG_DEBUG
-#undef LOG_DEBUG
-#endif
-#ifdef LOG_WARN
-#undef LOG_WARN
-#endif
-
#endif
int check_ip_tcpd(void *cd, const char *addr, int len, int type)
#if HAVE_TCPD_H
struct request_info request_info;
int i;
-#endif
char *host_name = 0, *host_addr = 0;
struct hostent *host;
AF_INET)))
host_name = (char*) host->h_name;
host_addr = inet_ntoa(addr_in->sin_addr);
-#if HAVE_TCPD_H
if (host_addr)
request_init(&request_info, RQ_DAEMON, daemon_name,
RQ_CLIENT_NAME, host_name,
host_name ? host_name : host_addr);
return 1;
}
- yaz_log (YLOG_DEBUG, "access granted from %s",
- host_name ? host_name : host_addr);
+ yaz_log(YLOG_DEBUG, "access granted from %s",
+ host_name ? host_name : host_addr);
#endif
}
}
b->pos += size;
}
+void wrbuf_insert(WRBUF b, size_t pos, const char *buf, size_t size)
+{
+ if (size <= 0 || pos > b->pos)
+ return;
+ if (b->pos + size >= b->size)
+ wrbuf_grow(b, size);
+ memmove(b->buf + pos + size, b->buf + pos, b->pos - pos);
+ memcpy(b->buf + pos, buf, size);
+ b->pos += size;
+}
+
void wrbuf_puts(WRBUF b, const char *buf)
{
wrbuf_write(b, buf, strlen(buf));
{
zoom_ret cret = zoom_complete;
int ret = -1;
- const char *addinfo = 0;
+ char *addinfo = 0;
const char *connection_head = z_HTTP_header_lookup(hres->headers,
"Connection");
const char *location;
}
else
{
- ret = ZOOM_handle_sru(c, hres, &cret);
+ ret = ZOOM_handle_sru(c, hres, &cret, &addinfo);
if (ret == 0)
{
if (c->no_redirects) /* end of redirect. change hosts again */
if (hres->code != 200)
ZOOM_set_HTTP_error(c, hres->code, 0, 0);
else
+ {
+ yaz_log(YLOG_LOG, "set error... addinfo=%s", addinfo ?
+ addinfo : "NULL");
ZOOM_set_error(c, ZOOM_ERROR_DECODE, addinfo);
+ }
ZOOM_connection_close(c);
}
if (cret == zoom_complete)
zoom_ret ZOOM_connection_srw_send_scan(ZOOM_connection c);
int ZOOM_handle_sru(ZOOM_connection c, Z_HTTP_Response *hres,
- zoom_ret *cret);
+ zoom_ret *cret, char **addinfo);
void ZOOM_set_HTTP_error(ZOOM_connection c, int error,
const char *addinfo, const char *addinfo2);
#endif
int ZOOM_handle_sru(ZOOM_connection c, Z_HTTP_Response *hres,
- zoom_ret *cret)
+ zoom_ret *cret, char **addinfo)
{
#if YAZ_HAVE_XML2
int ret = 0;
- const char *addinfo = 0;
/* not redirect (normal response) */
if (!yaz_srw_check_content_type(hres))
{
- addinfo = "content-type";
+ *addinfo = "content-type";
ret = -1;
}
else if (c->sru_mode == zoom_sru_solr)
soap_package->u.fault->fault_string);
}
else
+ {
+ size_t max_chars = 1000;
+ size_t sz = hres->content_len;
+ if (sz > max_chars - 1)
+ sz = max_chars;
+ *addinfo = odr_malloc(c->odr_in, sz + 4);
+ memcpy(*addinfo, hres->content_buf, sz);
+ if (sz == max_chars)
+ strcpy(*addinfo + sz, "...");
+ else
+ strcpy(*addinfo + sz, "");
ret = -1;
+ }
}
return ret;
#else
struct icu_buf_utf16 *src = icu_buf_utf16_create(0);
struct icu_buf_utf16 *dst = icu_buf_utf16_create(0);
struct icu_buf_utf8 *dst8 = icu_buf_utf8_create(0);
-
+ int rc = 0;
UErrorCode status;
const char *result;
+
icu_utf16_from_utf8_cstr(src, to_stem, &status);
yaz_stemmer_stem(stemmer, dst, src, &status);
- /* Assume fail */
- int rc = 0;
if (status == U_ZERO_ERROR) {
icu_utf16_to_utf8(dst8, dst, &status);
result = icu_buf_utf8_to_cstr(dst8);
YAZ_CHECK(num > 0 && !strcmp(array[0], "a"));
YAZ_CHECK(num > 1 && !strcmp(array[1], "b"));
YAZ_CHECK(num > 2 && !strcmp(array[2], "cd"));
+
nmem_strsplitx(nmem, ",", ",a,b,,cd", &array, &num, 0);
+ YAZ_CHECK(num == 5);
+ YAZ_CHECK(num > 0 && !strcmp(array[0], ""));
+ YAZ_CHECK(num > 1 && !strcmp(array[1], "a"));
+ YAZ_CHECK(num > 2 && !strcmp(array[2], "b"));
+ YAZ_CHECK(num > 3 && !strcmp(array[3], ""));
+ YAZ_CHECK(num > 4 && !strcmp(array[4], "cd"));
+ nmem_strsplit_escape(nmem, ",", ",a,b,,cd", &array, &num, 0, '\\');
YAZ_CHECK(num == 5);
YAZ_CHECK(num > 0 && !strcmp(array[0], ""));
YAZ_CHECK(num > 1 && !strcmp(array[1], "a"));
YAZ_CHECK(num > 3 && !strcmp(array[3], ""));
YAZ_CHECK(num > 4 && !strcmp(array[4], "cd"));
+ nmem_strsplit_escape(nmem, ",", ",a,b\\,,cd", &array, &num, 0, '\\');
+ YAZ_CHECK(num == 4);
+ YAZ_CHECK(num > 0 && !strcmp(array[0], ""));
+ YAZ_CHECK(num > 1 && !strcmp(array[1], "a"));
+ YAZ_CHECK(num > 2 && !strcmp(array[2], "b\\,"));
+ YAZ_CHECK(num > 3 && !strcmp(array[3], "cd"));
+
+ nmem_strsplit_escape(nmem, ",", "\\,a,b\\,,cd", &array, &num, 0, '\\');
+ YAZ_CHECK(num == 3);
+ YAZ_CHECK(num > 0 && !strcmp(array[0], "\\,a"));
+ YAZ_CHECK(num > 1 && !strcmp(array[1], "b\\,"));
+ YAZ_CHECK(num > 2 && !strcmp(array[2], "cd"));
+
+ nmem_strsplit_escape(nmem, ",", "\\,a,b\\,\\,cd", &array, &num, 0, '\\');
+ YAZ_CHECK(num == 2);
+ YAZ_CHECK(num > 0 && !strcmp(array[0], "\\,a"));
+ YAZ_CHECK(num > 1 && !strcmp(array[1], "b\\,\\,cd"));
+
nmem_destroy(nmem);
}
}
wrbuf_rewind(wr);
}
+
+ wrbuf_rewind(wr);
+ wrbuf_puts(wr, "1234");
+ wrbuf_insert(wr, 0, "abc", 3);
+ YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "abc1234"));
+
+ wrbuf_rewind(wr);
+ wrbuf_puts(wr, "1234");
+ wrbuf_insert(wr, 1, "abc", 3);
+ YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1abc234"));
+
+ wrbuf_rewind(wr);
+ wrbuf_puts(wr, "1234");
+ wrbuf_insert(wr, 4, "abc", 3);
+ YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1234abc"));
+
+ wrbuf_rewind(wr);
+ wrbuf_puts(wr, "1234");
+ wrbuf_insert(wr, 5, "abc", 3);
+ YAZ_CHECK(!strcmp(wrbuf_cstr(wr), "1234"));
+
wrbuf_destroy(wr);
}
char buf[163840];
char *content_buf = buf;
int content_len;
- int ret;
size_t no;
Z_SOAP *soap_package = 0;
ODR decode, encode;
decode = odr_createmem(ODR_DECODE);
encode = odr_createmem(ODR_ENCODE);
content_len = no;
- ret = z_soap_codec(decode, &soap_package,
- &content_buf, &content_len, h);
+ z_soap_codec(decode, &soap_package,
+ &content_buf, &content_len, h);
if (!soap_package)
{
fprintf(stderr, "Decoding seriously failed\n");
}
}
- ret = z_soap_codec(encode, &soap_package,
- &content_buf, &content_len, h);
+ z_soap_codec(encode, &soap_package, &content_buf, &content_len, h);
if (content_buf && content_len)
{
printf("%.*s", content_len, content_buf);
$(OBJDIR)\test_mutex.obj
MISC_OBJS= \
+ $(OBJDIR)\base64.obj \
$(OBJDIR)\version.obj \
$(OBJDIR)\oid_std.obj \
$(OBJDIR)\eventl.obj \
Name: yaz
Summary: Z39.50 Programs
-Version: 4.2.6
+Version: 4.2.7
Release: 1indexdata
# determine system
const char **args)
{
int i;
- size_t start = 0, count = 1;
- const char *type = "render";
- WRBUF render_str = 0;
-
- if (0)
- {
- WRBUF tmp;
-
- if ((tmp = next_token_new_wrbuf(args)))
- {
- start = atoi(wrbuf_cstr(tmp));
- wrbuf_destroy(tmp);
- }
-
- if ((tmp = next_token_new_wrbuf(args)))
- {
- count = atoi(wrbuf_cstr(tmp));
- wrbuf_destroy(tmp);
- }
- render_str = next_token_new_wrbuf(args);
- }
- if (render_str)
- type = wrbuf_cstr(render_str);
process_events(c);
}
}
}
- if (render_str)
- wrbuf_destroy(render_str);
-
}
static void cmd_ext(ZOOM_connection *c, ZOOM_resultset *r,