aboutsummaryrefslogtreecommitdiffstats
path: root/libgeome_basic_context.c
blob: 878302a8c1579079e08899761972b9176f2646a1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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;
}