diff options
author | beber <beber> | 2005-12-02 10:56:29 +0000 |
---|---|---|
committer | beber <beber> | 2005-12-02 10:56:29 +0000 |
commit | e81fbef07d723955738ab5a6ddb349a72a18f6ff (patch) | |
tree | 790ea49f400819a6fe26d78b245d772c6aceb165 /src | |
parent | #e.fr (diff) | |
download | espik-e81fbef07d723955738ab5a6ddb349a72a18f6ff.tar.xz |
Some work on debug
Diffstat (limited to 'src')
-rw-r--r-- | src/espik.c | 2 | ||||
-rw-r--r-- | src/espik_config.c | 4 | ||||
-rw-r--r-- | src/espik_debug.c | 20 | ||||
-rw-r--r-- | src/espik_debug.h | 2 | ||||
-rw-r--r-- | src/espik_global.h | 4 | ||||
-rw-r--r-- | src/espik_irc.c | 4 | ||||
-rw-r--r-- | src/espik_net.c | 15 |
7 files changed, 29 insertions, 22 deletions
diff --git a/src/espik.c b/src/espik.c index c55a632..5b97ddf 100644 --- a/src/espik.c +++ b/src/espik.c @@ -130,7 +130,7 @@ int main (int argc, char **argv) /* ecore_main_loop_quit (); */ #if _ESPIK_DEBUG_ - printf (" end\n"); + printf ("end\n"); #endif ecore_config_shutdown (); diff --git a/src/espik_config.c b/src/espik_config.c index 04dc2e3..7e74e16 100644 --- a/src/espik_config.c +++ b/src/espik_config.c @@ -11,6 +11,8 @@ #include "espik_error.h" #include "espik_debug.h" +static int ret; /* For debug */ + t_servinfo* espik_server_config_set (char* server, unsigned short port) { t_servinfo* s_info; @@ -61,8 +63,6 @@ void espik_config_default_set () void espik_config_init () { - int ret; - if ((ret = ecore_config_init (APPS_NAME)) != ECORE_CONFIG_ERR_SUCC) { fprintf (stderr, "espik_config_init: Init ecore_config failed (%d)\n", ret); diff --git a/src/espik_debug.c b/src/espik_debug.c index c6e8a26..0ea9c24 100644 --- a/src/espik_debug.c +++ b/src/espik_debug.c @@ -8,13 +8,15 @@ # include <execinfo.h> #endif /* __GLIBC__ */ -#if _ESPIK_DEBUG +#if _ESPIK_DEBUG_ # include <signal.h> -#endif /* _ESPIK_DEBUG */ +#endif /* _ESPIK_DEBUG_ */ inline void espik_debug_bt (int num) { -#ifdef __GLIBC__ && _ESPIK_DEBUG +#ifdef __GLIBC__ +# if _ESPIK_DEBUG_ + void* array[128]; size_t size; char** strings; @@ -30,16 +32,18 @@ inline void espik_debug_bt (int num) if (strings) free(strings); -#else -# ifndef __GLIBC__ + +# endif /* _ESPIK_DEBUG_ */ +#endif /* __GLIBC__ */ + +#ifndef __GLIBC__ fprintf(stderr, "Your system doesn't have glibc. Backtraces disabled. But program receive signal %d.\n", num); -# endif /* ! __GLIBC__ */ -#endif /* __GLIBC__ && _ESPIK_DEBUG */ +#endif /* __GLIBC__ */ } void espik_debug_init() { -#if _ESPIK_DEBUG +#if _ESPIK_DEBUG_ struct sigaction sa; sa.sa_handler = espik_debug_bt; diff --git a/src/espik_debug.h b/src/espik_debug.h index c91c3fa..5baacf8 100644 --- a/src/espik_debug.h +++ b/src/espik_debug.h @@ -1,6 +1,8 @@ #ifndef HAVE_ESPIK_DEBUG_H #define HAVE_ESPIK_DEBUG_H +#include "espik_global.h" + inline void espik_bt (void); void espik_debug_init(); void kill_me (short num); diff --git a/src/espik_global.h b/src/espik_global.h index fa53639..e800418 100644 --- a/src/espik_global.h +++ b/src/espik_global.h @@ -3,10 +3,10 @@ #include "../config.h" -#define APPS_NAME PACKAGE +#define APPS_NAME PACKAGE #define ESPIK_VERSION VERSION -#define MAX_LEN 512 +#define MAX_LEN 512 #define _ESPIK_DEBUG_ 1 diff --git a/src/espik_irc.c b/src/espik_irc.c index c119055..479b014 100644 --- a/src/espik_irc.c +++ b/src/espik_irc.c @@ -222,7 +222,7 @@ char* irc_send (char* msg) cmd_and_message = separate_commandline (msg + 1); #if _ESPIK_DEBUG_ - printf ("irc_send: <separate_commandline\n"); +/* printf ("irc_send: <separate_commandline\n"); */ #endif /*string_upper (cmd_and_message[0]);*/ @@ -232,7 +232,7 @@ char* irc_send (char* msg) if ((strcasecmp (cmd_and_message[0], cmd->cmd_name)) == 0) { out = cmd->format (current_chan, cmd_and_message[1]); - /* WHy do job after found the good to do ? */ + /* Why do job after found the good to do ? */ break; } } diff --git a/src/espik_net.c b/src/espik_net.c index ee271c1..058f153 100644 --- a/src/espik_net.c +++ b/src/espik_net.c @@ -15,6 +15,8 @@ typedef int (*Handler_Func) (void* data, int ev_type, void* ev); +static int ret; /* For debug */ + Ecore_Con_Server* con_sock; void espik_con_init (t_info serv_info) @@ -24,7 +26,7 @@ void espik_con_init (t_info serv_info) nb_launch = ecore_con_init (); #if _ESPIK_DEBUG_ - printf ("espik_con_init: nb_launch = %d\n", nb_launch); +/* printf ("espik_con_init: nb_launch = %d\n", nb_launch); */ #endif con_sock = ecore_con_server_connect (ECORE_CON_REMOTE_SYSTEM, @@ -38,7 +40,7 @@ void espik_con_init (t_info serv_info) if (! (ecore_event_handler_add (ECORE_CON_EVENT_SERVER_DATA, (Handler_Func) server_data, NULL))) { - fprintf (stderr, "ecore_event_handler_add failed at espik_con_init\n"); + fprintf (stderr, "ecore_event_handler_add failed at %s\n", __FUNCTION__); exit (-1); } } @@ -46,14 +48,14 @@ void espik_con_init (t_info serv_info) void espik_con_shutdown () { #if _ESPIK_DEBUG_ - printf ("> espik_con_shutdown\n"); +/* printf ("> espik_con_shutdown\n"); */ #endif ecore_con_server_del (con_sock); ecore_con_shutdown (); #if _ESPIK_DEBUG_ - printf ("< espik_con_shutdown\n"); +/* printf ("< espik_con_shutdown\n"); */ #endif /* ecore_main_loop_quit (); */ } @@ -62,7 +64,6 @@ void espik_raw_send (char *msg) { int len; char* out; - int ret; /* FIXME: DEL THAT ! */ len = strlen (msg) + 3; @@ -71,7 +72,7 @@ void espik_raw_send (char *msg) snprintf (out, len, "%s\r\n", msg); #if _ESPIK_DEBUG_ - printf ("espik_raw_send:\nmsg: %s\nout: %s\n", msg, out); +/* printf ("espik_raw_send:\nmsg: %s\nout: %s\n", msg, out); */ #endif /* printf ("out[len-3]: 0x%X\n", out[len - 3]); @@ -82,7 +83,7 @@ void espik_raw_send (char *msg) ret = ecore_con_server_send (con_sock, out, strlen (out)); #if _ESPIK_DEBUG_ - printf ("ecore_con_server_send: %d\n", ret); +/* printf ("ecore_con_server_send: %d\n", ret); */ #endif free (out); |