* (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: wrbuf.h,v 1.26 2007-03-20 21:37:31 adam Exp $ */
+/* $Id: wrbuf.h,v 1.27 2007-09-17 19:14:26 adam Exp $ */
/**
* \file wrbuf.h
(((b)->pos >= (b)->size ? wrbuf_grow(b, 1) : 0), \
(b)->buf[(b)->pos++] = (c), 0)
+/** \brief put readable string in WRBUF from raw input */
+YAZ_EXPORT void wrbuf_verbose_str(WRBUF b, const char *str, size_t len);
+
YAZ_END_CDECL
#endif
* Copyright (C) 1995-2007, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: wrbuf.c,v 1.19 2007-03-20 21:37:32 adam Exp $
+ * $Id: wrbuf.c,v 1.20 2007-09-17 19:14:26 adam Exp $
*/
/**
b->pos = b->pos - no_to_remove;
}
+void wrbuf_verbose_str(WRBUF b, const char *str, size_t len)
+{
+ size_t i;
+ for (i = 0; i < len; i++)
+ if (str[i] < ' ' || str[i] > 126)
+ wrbuf_printf(b, "\\x%02X", str[i] & 0xff);
+ else
+ wrbuf_putc(b, str[i]);
+}
+
/*
* Local variables:
* c-basic-offset: 4