diff options
Diffstat (limited to 'libgeome_basic_context.c')
-rw-r--r-- | libgeome_basic_context.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/libgeome_basic_context.c b/libgeome_basic_context.c new file mode 100644 index 0000000..878302a --- /dev/null +++ b/libgeome_basic_context.c @@ -0,0 +1,36 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +#if defined(__GNUC__) +# pragma GCC diagnostic ignored "-Wsuggest-attribute=format" +#endif + + +static void +print(struct libgeome_context *ctx, const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + fprintf(stderr, "%s: ", (const char *)ctx->user_data.cptr); + vfprintf(stderr, fmt, args); + va_end(args); +} + + +static void +dont_print(struct libgeome_context *ctx, const char *fmt, ...) +{ + (void) ctx; + (void) fmt; +} + + +void +libgeome_basic_context(struct libgeome_context *ctx_out, const char *procname) +{ + ctx_out->user_data.cptr = procname; + ctx_out->print_error = &print; + ctx_out->print_abort = &print; + ctx_out->print_debug = &dont_print; +} |