From: Mark Wooding Date: Tue, 24 Jan 2012 02:00:38 +0000 (+0000) Subject: admin.c (a_format): New function formats token sequences to strings. X-Git-Tag: 1.0.0pre11~1^2~6 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/commitdiff_plain/f241e36cca984bac62d30783bca3b36808070312?ds=sidebyside admin.c (a_format): New function formats token sequences to strings. This will be useful for building fragments of messages to be assembled by higher-level functions. --- diff --git a/server/admin.c b/server/admin.c index 7fa3f0f8..e8920547 100644 --- a/server/admin.c +++ b/server/admin.c @@ -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 diff --git a/server/tripe.h b/server/tripe.h index 8a0be518..2ffe978f 100644 --- a/server/tripe.h +++ b/server/tripe.h @@ -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