aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbeber <beber>2005-12-06 16:36:43 +0000
committerbeber <beber>2005-12-06 16:36:43 +0000
commit38c7f6aadae6d629879def90810b61de886e16b6 (patch)
tree1b364c13f4901b7d379cc4a1bfdcd26da73c8086
parentva are evil ! (diff)
downloadespik-38c7f6aadae6d629879def90810b61de886e16b6.tar.xz
more work on va
-rw-r--r--tst/va_test.c35
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);
}