diff options
Diffstat (limited to 'src/espik_debug.c')
-rw-r--r-- | src/espik_debug.c | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/espik_debug.c b/src/espik_debug.c index 0ea9c24..d072890 100644 --- a/src/espik_debug.c +++ b/src/espik_debug.c @@ -1,8 +1,9 @@ -#include "espik_debug.h" - #include <unistd.h> #include <stdio.h> #include <stdlib.h> +#include <sys/varargs.h> + +#include "espik_debug.h" #ifdef __GLIBC__ # include <execinfo.h> @@ -12,6 +13,39 @@ # include <signal.h> #endif /* _ESPIK_DEBUG_ */ +static int indent_level = 0; + +void espik_debug_print (char *fct, ...) +{ +#if _ESPIK_DEBUG_ + va_list ap; + char c, *s; + int d; + + va_start (ap, fct); + while (*fct) + { + fprintf (stderr, ">fct : %c\n", *(fct+1)); + switch (*fct++) + { + case 's': s = va_arg (ap, char*); + fprintf (stderr, "%s", s); + break; + case 'd': d = va_arg (ap, int); + fprintf (stderr, "%d", d); + break; + case 'c': c = va_arg (ap, char); + fprintf (stderr, "%c", c); + break; + default : fprintf (stderr, "Unknown type : %c\n", *fct); + } + fprintf (stderr, "<fct : %c\n", *fct); + } + + va_end (ap); +#endif +} + inline void espik_debug_bt (int num) { #ifdef __GLIBC__ |