From 12d7f9b45303fb458cb21a3e0e430af96c781d8b Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 24 Mar 2025 22:58:14 +0100 Subject: First commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libgeome_basic_context.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 libgeome_basic_context.c (limited to 'libgeome_basic_context.c') 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; +} -- cgit v1.2.3-70-g09d2