chiark / gitweb /
admin.c (a_format): New function formats token sequences to strings.
authorMark Wooding <mdw@distorted.org.uk>
Tue, 24 Jan 2012 02:00:38 +0000 (02:00 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 7 May 2012 14:35:10 +0000 (15:35 +0100)
This will be useful for building fragments of messages to be assembled
by higher-level functions.

server/admin.c
server/tripe.h

index 7fa3f0f85b8cbba34c1a0c0b545b7f975c112ec3..e892054773a14a6acce73f951a762ec7428bc604 100644 (file)
@@ -313,6 +313,26 @@ void a_vformat(dstr *d, const char *fmt, va_list ap)
   dstr_destroy(&dd);
 }
 
+/* --- @a_format@ --- *
+ *
+ * Arguments:  @dstr *d@ = where to leave the formatted message
+ *             @const char *fmt@ = pointer to format string
+ *
+ * Returns:    ---
+ *
+ * Use:                Writes a tokenized message into a string, for later
+ *             presentation.
+ */
+
+void a_format(dstr *d, const char *fmt, ...)
+{
+  va_list ap;
+
+  va_start(ap, fmt);
+  a_vformat(d, fmt, ap);
+  va_end(ap);
+}
+
 /* --- @a_write@, @a_vwrite@ --- *
  *
  * Arguments:  @admin *a@ = admin connection to write to
index 8a0be5188f8026b3eeca9dcc064983125ddf9ae7..2ffe978f3f1a9bf87983e2034679c294dd1a3987 100644 (file)
@@ -861,6 +861,19 @@ extern int c_check(buf */*b*/);
 
 extern void a_vformat(dstr */*d*/, const char */*fmt*/, va_list /*ap*/);
 
+/* --- @a_format@ --- *
+ *
+ * Arguments:  @dstr *d@ = where to leave the formatted message
+ *             @const char *fmt@ = pointer to format string
+ *
+ * Returns:    ---
+ *
+ * Use:                Writes a tokenized message into a string, for later
+ *             presentation.
+ */
+
+extern void a_format(dstr */*d*/, const char */*fmt*/, ...);
+
 /* --- @a_warn@ --- *
  *
  * Arguments:  @const char *fmt@ = pointer to format string