aboutsummaryrefslogtreecommitdiff
path: root/tst/va_test.c
blob: fdba4be4358f451f64615cb64b5beceb7b6542f8 (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
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>

/*
#define espik_debug_print (...) \
{ \
	va_list __ap; \
	char* __output; \
	__output = malloc (sizeof(char)* (strlen (__FUNCTION__", "__FILE__", "__LINE__" : ") + strlen(...))); \
	sprintf (__output, "%s: %s", __FUNCTION__", "__FILE__", "__LINE__" : ", ...); \
	va_start (__ap, __output); \
	vfprintf (stdout, __output, ap); \
	va_end (__ap); \
	free (__output); \
}
*/

#define espik_debug_print (fmt, ...) \
{ \
	fprintf (stdout, "%s, %s, %i: ", __FUNCTION__, __FILE__, __LINE__); \
	vfprintf (stdout, fmt, ## __VA_ARGS__); \
}

int main()
{
	int a = 10;

	espik_debug_print ("a : %d\n", a);

	return (0);
}