diff options
author | beber <beber> | 2005-12-06 16:36:43 +0000 |
---|---|---|
committer | beber <beber> | 2005-12-06 16:36:43 +0000 |
commit | 38c7f6aadae6d629879def90810b61de886e16b6 (patch) | |
tree | 1b364c13f4901b7d379cc4a1bfdcd26da73c8086 /tst/va_test.c | |
parent | va are evil ! (diff) | |
download | espik-38c7f6aadae6d629879def90810b61de886e16b6.tar.xz |
more work on va
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); } |