diff options
Diffstat (limited to '')
-rw-r--r-- | tst/va_test.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/tst/va_test.c b/tst/va_test.c index f556604..a7664c1 100644 --- a/tst/va_test.c +++ b/tst/va_test.c @@ -1,29 +1,29 @@ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> +#include <string.h> -void espik_debug_print (char* fct, char *fmt, ...) +#define ES_PRINT (...) (espik_debug_print (__FILE__, __LINE__, __FUNCTION__, )) + +inline void espik_debug_print (char *fmt, ...) { va_list ap; - char c, *s; +/* char c, *s; int d, e; - +*/ char* output; - char* va_out; - - va_out = - - output = malloc (sizeof(char)*( - strlen (fct)) - + + output = malloc(sizeof(char)* + ( strlen(__FUNCTION__) + + strlen(fmt) ) ); -// va_start (ap, fct); - - va_copy (ap, fmt); - - vfprintf (stderr, fmt, + snprintf (output, "%s: %s", __FUNCTION__, fmt); + + va_start (ap, output); + vfprintf (stderr, output, ap); + fprintf (stderr, "\n"); + // printf("fct : %s\n", *(fct+1)); /* while (*fct) { @@ -53,10 +53,11 @@ void espik_debug_print (char* fct, char *fmt, ...) int main() { int a = 10; - char b = 'c'; +/* char b = 'c'; char c[] = "totomadit"; + */ - espik_debug_print (__FUNCTION__, "a : %d\n", a); + espik_debug_print ("a : %d\n", a); return (0); } |