summaryrefslogtreecommitdiff
path: root/src/sbuf.c
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-12-21 11:58:56 +0000
committersabetts <sabetts>2001-12-21 11:58:56 +0000
commitb411861a7c307f2f2e520f7c9d51958fc003f0df (patch)
treee73d98b5877d39754260ed163242935ffba76951 /src/sbuf.c
parent8337770d09d8041ba4c6b676d1fbb5bc7fd6c6a2 (diff)
downloadratpoison-b411861a7c307f2f2e520f7c9d51958fc003f0df.zip
* src/sbuf.h (sbuf_printf_concat): new prototype
(sbuf_printf): likewise * src/sbuf.c (sbuf_printf_concat): new function (sbuf_printf): likewise * src/ratpoison.h: include stdarg.h (xvsprintf): new prototype (xsprintf): likewise * src/main.c (xvsprintf): new function (xsprintf): likewise * src/bar.c: remove include of stdarg.h (marked_message_printf): call xvsprintf.
Diffstat (limited to 'src/sbuf.c')
-rw-r--r--src/sbuf.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/sbuf.c b/src/sbuf.c
index bd77d7c..f6313b2 100644
--- a/src/sbuf.c
+++ b/src/sbuf.c
@@ -89,3 +89,33 @@ sbuf_get (struct sbuf *b)
{
return b->data;
}
+
+char *
+sbuf_printf (struct sbuf *b, char *fmt, ...)
+{
+ va_list ap;
+
+ free (b->data);
+
+ va_start (ap, fmt);
+ b->data = xvsprintf (fmt, ap);
+ va_end (ap);
+
+ return b->data;
+}
+
+char *
+sbuf_printf_concat (struct sbuf *b, char *fmt, ...)
+{
+ char *buffer;
+ va_list ap;
+
+ va_start (ap, fmt);
+ buffer = xvsprintf (fmt, ap);
+ va_end (ap);
+
+ sbuf_concat (b, buffer);
+ free (buffer);
+
+ return b->data;
+}