/* * Append a character to an vsb. */ int VSB_putc(struct vsb *s, int c) { VSB_put_byte(s, c); if (s->s_error != 0) return (-1); return (0); }
/* * Append a string to an vsb. */ int VSB_cat(struct vsb *s, const char *str) { assert_VSB_integrity(s); assert_VSB_state(s, 0); if (s->s_error != 0) return (-1); while (*str != '\0') { VSB_put_byte(s, *str++); if (s->s_error != 0) return (-1); } return (0); }
/* * Append a byte string to an vsb. */ int VSB_bcat(struct vsb *s, const void *buf, size_t len) { const char *str = buf; const char *end = str + len; assert_VSB_integrity(s); assert_VSB_state(s, 0); if (s->s_error != 0) return (-1); for (; str < end; str++) { VSB_put_byte(s, *str); if (s->s_error != 0) return (-1); } return (0); }