diff options
author | Mattias Andrée <m@maandree.se> | 2025-03-24 22:58:14 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-03-24 22:58:14 +0100 |
commit | 12d7f9b45303fb458cb21a3e0e430af96c781d8b (patch) | |
tree | 2b9c674f474d8ab4d6b35c657d4c005b4089192d /libgeome_basic_context.c | |
download | libgeome-12d7f9b45303fb458cb21a3e0e430af96c781d8b.tar.gz libgeome-12d7f9b45303fb458cb21a3e0e430af96c781d8b.tar.bz2 libgeome-12d7f9b45303fb458cb21a3e0e430af96c781d8b.tar.xz |
First commit
Signed-off-by: Mattias Andrée <m@maandree.se>
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; +} |