diff --git a/libc3/buf.c b/libc3/buf.c
index a54bb0f..89ab588 100644
--- a/libc3/buf.c
+++ b/libc3/buf.c
@@ -35,6 +35,12 @@ void buf_delete (s_buf *buf)
free(buf);
}
+void buf_empty (s_buf *buf)
+{
+ buf->wpos = 0;
+ buf->rpos = 0;
+}
+
sw buf_f (s_buf *buf, const char *fmt, ...)
{
va_list ap;
diff --git a/libc3/buf.h b/libc3/buf.h
index 0867003..b9e8e02 100644
--- a/libc3/buf.h
+++ b/libc3/buf.h
@@ -41,6 +41,7 @@ s_buf * buf_new_alloc (uw bytes);
s_buf * buf_new_str (s_str *str);
/* Operators. */
+void buf_empty (s_buf *buf);
sw buf_f (s_buf *buf, const char *fmt, ...);
sw buf_flush (s_buf *buf);
sw buf_ignore (s_buf *buf, uw size);