+int wrbuf_puts_replace_char(WRBUF b, const char *buf,
+ const char from, const char to)
+{
+ while(*buf){
+ if (*buf == from)
+ wrbuf_putc(b, to);
+ else
+ wrbuf_putc(b, *buf);
+ buf++;
+ }
+ wrbuf_putc(b, 0);
+ (b->pos)--; /* don't include '\0' in count */
+ return 0;
+}
+
+void wrbuf_chop_right(WRBUF b)
+{
+ while (b->pos && b->buf[b->pos-1] == ' ')
+ {
+ (b->pos)--;
+ b->buf[b->pos] = '\0';
+ }
+}
+