From f6bacc5058d8049a44f25fcc7a931227ddcfb65e Mon Sep 17 00:00:00 2001 From: Markus Teich Date: Sun, 19 Jun 2016 23:21:01 +0200 Subject: some doxygen fixes --- util.c | 68 +++++++++++++++++++++++++++++++++++------------------------------- 1 file changed, 36 insertions(+), 32 deletions(-) (limited to 'util.c') diff --git a/util.c b/util.c index 2acd726..5eebd3c 100644 --- a/util.c +++ b/util.c @@ -16,7 +16,7 @@ /** * @file util.c - * @brief TODO + * @brief \todo */ #include #include @@ -25,63 +25,67 @@ #include "util.h" -static void xvprintf (const char *, va_list); /** - * eprintf + * xvprintf prints a formatstring with prefix "libbrandt: ". If the format + * string ends with a ':', the strerror() from errno.h output will be appended. + * The output is always terminated with a newline. * - * @param fmt TODO - * @param + * @param fmt The format string + * @param ap The inputs to the format string */ void -eprintf (const char *fmt, ...) +xvprintf (const char *fmt, va_list ap) { - va_list ap; + /**\todo: provide other logging target than stderr */ + fputs ("libbrandt: ", stderr); - va_start (ap, fmt); - xvprintf (fmt, ap); - va_end (ap); + vfprintf (stderr, fmt, ap); - abort (); + if (fmt[0] && fmt[strlen (fmt) - 1] == ':') + { + fputc (' ', stderr); + perror (NULL); + } + else + { + fputc ('\n', stderr); + } } + /** - * weprintf + * eprintf prints an error message and then calls abort() to terminate the + * process. * - * @param fmt TODO - * @param + * @param fmt The format string + * @param ... The inputs to the format string */ void -weprintf (const char *fmt, ...) +eprintf (const char *fmt, ...) { va_list ap; va_start (ap, fmt); xvprintf (fmt, ap); va_end (ap); + + abort (); } + /** - * xvprintf + * weprintf prints a warning message * - * @param fmt TODO - * @param ap TODO + * @param fmt The format string + * @param ... The inputs to the format string */ void -xvprintf (const char *fmt, va_list ap) +weprintf (const char *fmt, ...) { - /**TODO: provide other logging target than stderr */ - fputs ("libbrandt: ", stderr); - - vfprintf (stderr, fmt, ap); + va_list ap; - if (fmt[0] && fmt[strlen (fmt) - 1] == ':') - { - fputc (' ', stderr); - perror (NULL); - } - else - { - fputc ('\n', stderr); - } + va_start (ap, fmt); + xvprintf (fmt, ap); + va_end (ap); } -- cgit v1.2.3