* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*
- * $Id: wrbuf.h,v 1.8 2003-01-06 08:20:27 adam Exp $
+ * $Id: wrbuf.h,v 1.9 2003-07-14 12:58:18 adam Exp $
*
*/
YAZ_EXPORT int wrbuf_grow(WRBUF b, int minsize);
YAZ_EXPORT int wrbuf_write(WRBUF b, const char *buf, int size);
YAZ_EXPORT int wrbuf_puts(WRBUF b, const char *buf);
+YAZ_EXPORT int wrbuf_xmlputs(WRBUF b, const char *cp);
YAZ_EXPORT void wrbuf_printf(WRBUF b, const char *fmt, ...);
#define wrbuf_len(b) ((b)->pos)
/*
* Copyright (c) 1995-2003, Index Data.
* See the file LICENSE for details.
- * Sebastian Hammer, Adam Dickmeiss
*
- * $Id: wrbuf.c,v 1.12 2003-01-06 08:20:28 adam Exp $
+ * $Id: wrbuf.c,v 1.13 2003-07-14 12:58:18 adam Exp $
*/
/*
return 0;
}
+int wrbuf_xmlputs(WRBUF b, const char *cp)
+{
+ while (*cp)
+ {
+ switch(*cp)
+ {
+ case '<':
+ wrbuf_puts(b, "<");
+ break;
+ case '>':
+ wrbuf_puts(b, ">");
+ break;
+ case '&':
+ wrbuf_puts(b, "&");
+ break;
+ case '"':
+ wrbuf_puts(b, """);
+ break;
+ case '\'':
+ wrbuf_puts(b, "'");
+ break;
+ default:
+ wrbuf_putc(b, *cp);
+ }
+ cp++;
+ }
+ wrbuf_putc(b, 0);
+ (b->pos)--;
+ return 0;
+}
+
void wrbuf_printf(WRBUF b, const char *fmt, ...)
{
va_list ap;