/*~f char* w_cstr_formatv (const char *format, va_list arguments) * * Create a C (``\0``-terminated) string with a given `format`, consuming * additional `arguments` as needed by the `format`. * * The returned strings must be freed by the caller. * * See :ref:`formatted-output` for the available formatting options. */ char* w_cstr_formatv (const char *format, va_list args) { w_assert (format); w_io_buf_t buffer_stream; w_io_buf_init (&buffer_stream, NULL, false); W_IO_NORESULT (w_io_formatv (&buffer_stream.parent, format, args)); return w_io_buf_str (&buffer_stream); }
/*~f w_io_result_t w_io_format (w_io_t *stream, const char *format, ...) * * Writes data with a given `format` to an output `stream`. * The amount of consumed arguments depends on the `format` string. * * See :ref:`formatted-output` for more information. */ w_io_result_t w_io_format (w_io_t *io, const char *fmt, ...) { w_assert (io); w_assert (fmt); va_list args; va_start (args, fmt); w_io_result_t r = w_io_formatv (io, fmt, args); va_end (args); return r; }
static inline void _write_status (const char *fmt, ...) { w_assert (status_io); va_list arg; va_start (arg, fmt); w_io_result_t r = w_io_formatv (status_io, fmt, arg); va_end (arg); if (w_io_failed (r)) W_WARN ("I/O error writing to status file: $E\n"); }