limits (heavens forbid).
+Added snprintf/vsnprintf wrappers for systems that don't have
+limits (heavens forbid).
+
Fixed bug in ZOOM-C's event and task handling. If a ZOOM task was
created before all previous tasks were completed and removed from the
task queue, the new task could be removed by a mistake.
-## $Id: Makefile.am,v 1.38 2007-01-08 10:48:07 adam Exp $
+## $Id: Makefile.am,v 1.39 2007-02-23 10:15:01 adam Exp $
pkginclude_HEADERS= backend.h ccl.h ccl_xml.h cql.h comstack.h \
diagbib1.h diagsrw.h diagsru_update.h sortspec.h log.h logrpn.h marcdisp.h \
readconf.h record_conv.h retrieval.h statserv.h \
tcpip.h test.h timing.h unix.h tpath.h wrbuf.h xmalloc.h \
yaz-ccl.h yaz-iconv.h yaz-util.h yaz-version.h yconfig.h proto.h \
- xmlquery.h libxml2_error.h xmltypes.h \
+ xmlquery.h libxml2_error.h xmltypes.h snprintf.h \
\
ill.h ill-core.h item-req.h z-accdes1.h z-accform1.h \
z-acckrb1.h z-core.h z-date.h z-diag1.h z-espec1.h z-estask.h z-exp.h \
--- /dev/null
+/*
+ * Copyright (c) 1995-2007, 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.
+ */
+/* $Id: snprintf.h,v 1.1 2007-02-23 10:15:01 adam Exp $ */
+
+/**
+ * \file snprintf.h
+ * \brief Header for config file reading utilities
+ */
+
+#ifndef YAZ_SNPRINTF_H
+#define YAZ_SNPRINTF_H
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <yaz/yconfig.h>
+
+YAZ_BEGIN_CDECL
+
+YAZ_EXPORT void yaz_snprintf(char *buf, size_t size, const char *fmt, ...);
+YAZ_EXPORT void yaz_vsnprintf(char *buf, size_t size, const char *fmt,
+ va_list ap);
+
+YAZ_END_CDECL
+
+#endif
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
## This file is part of the YAZ toolkit.
## Copyright (C) 1995-2007, Index Data, All rights reserved.
-## $Id: Makefile.am,v 1.51 2007-01-11 10:55:57 adam Exp $
+## $Id: Makefile.am,v 1.52 2007-02-23 10:15:01 adam Exp $
YAZ_VERSION_INFO=2:1:0
eventl.h service.c service.h session.h test.c timing.c \
xmlquery.c http.c \
mime.c mime.h \
- record_conv.c retrieval.c elementset.c
+ record_conv.c retrieval.c elementset.c snprintf.c
libyaz_la_LDFLAGS=-version-info $(YAZ_VERSION_INFO)
* Copyright (C) 2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: libxml2_error.c,v 1.3 2007-01-03 08:42:15 adam Exp $
+ * $Id: libxml2_error.c,v 1.4 2007-02-23 10:15:01 adam Exp $
*/
/**
* \file libxml2_error.c
#include <stdlib.h>
#include <stdarg.h>
#include <yaz/log.h>
+#include <yaz/snprintf.h>
#include <yaz/libxml2_error.h>
#if YAZ_HAVE_XML2
va_list ap;
va_start(ap, fmt);
-#ifdef WIN32
- vsprintf(buf, fmt, ap);
-#else
- vsnprintf(buf, sizeof(buf), fmt, ap);
-#endif
+ yaz_vsnprintf(buf, sizeof(buf)-1, fmt, ap);
yaz_log(libxml2_error_level, "%s: %s", (char*) ctx, buf);
va_end (ap);
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: log.c,v 1.47 2007-02-20 09:39:17 adam Exp $
+ * $Id: log.c,v 1.48 2007-02-23 10:15:01 adam Exp $
*/
/**
#include <time.h>
#include <yaz/nmem.h>
#include <yaz/log.h>
+#include <yaz/snprintf.h>
#include <yaz/xmalloc.h>
static NMEM_MUTEX log_mutex = 0;
if (!(level & l_level))
return;
va_start(ap, fmt);
-#ifdef WIN32
- _vsnprintf(buf, sizeof(buf)-1, fmt, ap);
-#else
-/* !WIN32 */
-#if HAVE_VSNPRINTF
- vsnprintf(buf, sizeof(buf), fmt, ap);
-#else
- vsprintf(buf, fmt, ap);
-#endif
-#endif
-/* WIN32 */
+
+ yaz_vsnprintf(buf, sizeof(buf)-1, fmt, ap);
if (o_level & YLOG_ERRNO)
{
strcat(buf, " [");
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: marcdisp.c,v 1.46 2007-02-17 10:53:05 adam Exp $
+ * $Id: marcdisp.c,v 1.47 2007-02-23 10:15:01 adam Exp $
*/
/**
#include <yaz/wrbuf.h>
#include <yaz/yaz-util.h>
#include <yaz/nmem_xml.h>
+#include <yaz/snprintf.h>
#if YAZ_HAVE_XML2
#include <libxml/parser.h>
{
va_list ap;
char buf[200];
- va_start(ap, fmt);
-#ifdef WIN32
- _vsnprintf(buf, sizeof(buf)-1, fmt, ap);
-#else
-/* !WIN32 */
-#if HAVE_VSNPRINTF
- vsnprintf(buf, sizeof(buf), fmt, ap);
-#else
- vsprintf(buf, fmt, ap);
-#endif
-#endif
-/* WIN32 */
+ va_start(ap, fmt);
+ yaz_vsnprintf(buf, sizeof(buf)-1, fmt, ap);
yaz_marc_add_comment(mt, buf);
va_end (ap);
}
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: odr.c,v 1.14 2007-01-03 08:42:15 adam Exp $
+ * $Id: odr.c,v 1.15 2007-02-23 10:15:01 adam Exp $
*
*/
#include <yaz/xmalloc.h>
#include <yaz/log.h>
+#include <yaz/snprintf.h>
#include "odr-priv.h"
static int log_level=0;
char buf[4096];
va_start(ap, fmt);
-#ifdef WIN32
- _vsnprintf(buf, sizeof(buf)-1, fmt, ap);
-#else
-#if HAVE_VSNPRINTF
- vsnprintf(buf, sizeof(buf), fmt, ap);
-#else
- vsprintf(buf, fmt, ap);
-#endif
-#endif
+ yaz_vsnprintf(buf, sizeof(buf), fmt, ap);
o->op->stream_write(o, o->print, ODR_VISIBLESTRING, buf, strlen(buf));
va_end(ap);
}
--- /dev/null
+/*
+ * Copyright (C) 2007, Index Data ApS
+ * See the file LICENSE for details.
+ *
+ * $Id: snprintf.c,v 1.1 2007-02-23 10:15:01 adam Exp $
+ */
+/**
+ * \file snprintf.c
+ * \brief snprintf wrapper
+ */
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <yaz/snprintf.h>
+
+void yaz_vsnprintf(char *buf, size_t size, const char *fmt, va_list ap)
+{
+#if HAVE_VSNPRINF
+ vsnprintf(buf, size, fmt, ap);
+#else
+#ifdef WIN32
+ _vsnprintf(buf, size, fmt, ap);
+#else
+ vsprintf(buf, fmt, ap);
+#endif
+#endif
+}
+
+void yaz_snprintf(char *buf, size_t size, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ yaz_vsnprintf(buf, size, fmt, ap);
+ va_end(ap);
+}
+
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: wrbuf.c,v 1.15 2007-01-06 16:05:24 adam Exp $
+ * $Id: wrbuf.c,v 1.16 2007-02-23 10:15:01 adam Exp $
*/
/**
#include <stdarg.h>
#include <yaz/wrbuf.h>
+#include <yaz/snprintf.h>
#include <yaz/yaz-iconv.h>
WRBUF wrbuf_alloc(void)
char buf[4096];
va_start(ap, fmt);
-#ifdef WIN32
- _vsnprintf(buf, sizeof(buf)-1, fmt, ap);
-#else
-/* !WIN32 */
-#if HAVE_VSNPRINTF
- vsnprintf(buf, sizeof(buf)-1, fmt, ap);
-#else
- vsprintf(buf, fmt, ap);
-#endif
-#endif
+ yaz_vsnprintf(buf, sizeof(buf)-1, fmt, ap);
wrbuf_puts (b, buf);
va_end(ap);
# Copyright (C) 1995-2007, Index Data ApS
# All rights reserved.
-# $Id: makefile,v 1.128 2007-01-24 11:50:19 adam Exp $
+# $Id: makefile,v 1.129 2007-02-23 10:15:02 adam Exp $
#
# Programmed by
# Heikki Levanto & Adam Dickmeiss
$(OBJDIR)\xmalloc.obj \
$(OBJDIR)\matchstr.obj \
$(OBJDIR)\siconv.obj \
+ $(OBJDIR)\snprintf.obj \
$(OBJDIR)\marc8.obj \
$(OBJDIR)\marc8r.obj \
$(OBJDIR)\record_conv.obj \