+/* --- @{,d}buf_fill@ --- *
+ *
+ * Arguments: @buf *b@ or @dbuf *db@ = pointer to a buffer block
+ * @int ch@ = fill character
+ * @size_t sz@ = size to fill
+ *
+ * Returns: Zero if it worked, nonzero if there wasn't enough space.
+ *
+ * Use: Write @sz@ bytes with value @ch@ to the buffer, as if with
+ * @memset@.
+ */
+
+int buf_fill(buf *b, int ch, size_t sz)
+{
+ void *p;
+
+ p = buf_get(b, sz); if (!p) return (-1);
+ if (sz) memset(p, ch, sz);
+ return (0);
+}
+int (dbuf_fill)(dbuf *db, int ch, size_t sz)
+ { return (dbuf_fill(db, ch, sz)); }
+