X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fwrbuf.c;h=d8a709e0ed304da0ce93238d0a6a24e00d43cbd8;hb=afae1117609712743c1109597d080a53a8dac5d4;hp=f90764ace03ad0f7dc8eeba707efa458f917f9b7;hpb=d38ee71c31b49ad13164039140ed47d18e9432cb;p=yaz-moved-to-github.git diff --git a/src/wrbuf.c b/src/wrbuf.c index f90764a..d8a709e 100644 --- a/src/wrbuf.c +++ b/src/wrbuf.c @@ -2,7 +2,7 @@ * 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 $ */ /** @@ -240,6 +240,16 @@ void wrbuf_cut_right(WRBUF b, size_t no_to_remove) 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