- wrbuf_write(b, buf, strlen(buf)+1); /* '\0'-terminate as well */
- (b->pos)--; /* don't include '\0' in count */
- return 0;
+ 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));
+}
+
+void wrbuf_vp_puts(const char *buf, void *client_data)
+{
+ WRBUF b = (WRBUF) client_data;
+ wrbuf_puts(b, buf);