aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbeber <beber>2005-12-01 20:22:19 +0000
committerbeber <beber>2005-12-01 20:22:19 +0000
commit1d217fb1cf5b137fe0758015e90e4f38a5a0ba62 (patch)
treecf92fb109d6bc4cb81a66fa1d542efae34c1fc53 /src
parentmore debug infos (diff)
downloadespik-1d217fb1cf5b137fe0758015e90e4f38a5a0ba62.tar.xz
Add a macro for __attribute__
Check if valgrinf is here Indent More debug and do better use config.h del ^_ from header
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am2
-rw-r--r--src/espik.h6
-rw-r--r--src/espik_common_handler.h6
-rw-r--r--src/espik_config.c7
-rw-r--r--src/espik_config.h14
-rw-r--r--src/espik_debug.c31
-rw-r--r--src/espik_debug.h7
-rw-r--r--src/espik_error.h6
-rw-r--r--src/espik_global.h25
-rw-r--r--src/espik_irc.h6
-rw-r--r--src/espik_irc_return_value.h6
-rw-r--r--src/espik_net.h6
12 files changed, 67 insertions, 55 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 0748e82..29c0992 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -27,6 +27,4 @@ espik_SOURCES = \
espik_LDADD = \
@ecore_libs@
-#-Wl,--rpath -Wl,/home/beber/lib
-
bin_PROGRAMS = espik
diff --git a/src/espik.h b/src/espik.h
index 21a6029..3b7d007 100644
--- a/src/espik.h
+++ b/src/espik.h
@@ -1,5 +1,5 @@
-#ifndef _HAVE_ESPIK_H
-#define _HAVE_ESPIK_H
+#ifndef HAVE_ESPIK_H
+#define HAVE_ESPIK_H
typedef struct
{
@@ -23,4 +23,4 @@ typedef struct
int del_backslash (char*);
int main (int, char**);
-#endif /* _HAVE_ESPIK_H */
+#endif /* HAVE_ESPIK_H */
diff --git a/src/espik_common_handler.h b/src/espik_common_handler.h
index 905d98d..65972bb 100644
--- a/src/espik_common_handler.h
+++ b/src/espik_common_handler.h
@@ -1,5 +1,5 @@
-#ifndef _HAVE_ESPIK_COMMON_HANDLER_H
-#define _HAVE_ESPIK_COMMON_HANDLER_H
+#ifndef HAVE_ESPIK_COMMON_HANDLER_H
+#define HAVE_ESPIK_COMMON_HANDLER_H
#include "espik_global.h"
#include <Ecore_Con.h>
@@ -8,4 +8,4 @@
int server_data (void *__UNUSED__, int __UNUSED__, Ecore_Con_Event_Server_Data * __UNUSED__);
int kb_get (void *__UNUSED__, Ecore_Fd_Handler *);
-#endif /* _HAVE_ESPIK_COMMON_HANDLER_H */
+#endif /* HAVE_ESPIK_COMMON_HANDLER_H */
diff --git a/src/espik_config.c b/src/espik_config.c
index 82aba00..04dc2e3 100644
--- a/src/espik_config.c
+++ b/src/espik_config.c
@@ -9,6 +9,7 @@
#include "espik_config.h"
#include "espik_error.h"
+#include "espik_debug.h"
t_servinfo* espik_server_config_set (char* server, unsigned short port)
{
@@ -65,13 +66,15 @@ void espik_config_init ()
if ((ret = ecore_config_init (APPS_NAME)) != ECORE_CONFIG_ERR_SUCC)
{
fprintf (stderr, "espik_config_init: Init ecore_config failed (%d)\n", ret);
- exit (ret);
+ kill_me (2);
+/* exit (ret); */
}
if ((ret = ecore_config_load ()) != ECORE_CONFIG_ERR_SUCC)
{
fprintf (stderr, "espik_config_init: Load ecore_config failed (%d)\n", ret);
- exit (ret);
+ kill_me (2);
+/* exit (ret); */
}
}
diff --git a/src/espik_config.h b/src/espik_config.h
index e6f67c5..87549c3 100644
--- a/src/espik_config.h
+++ b/src/espik_config.h
@@ -1,15 +1,15 @@
-#ifndef _HAVE_ESPIK_CONFIG_H
-#define _HAVE_ESPIK_CONFIG_H
+#ifndef HAVE_ESPIK_CONFIG_H
+#define HAVE_ESPIK_CONFIG_H
#include "espik.h"
#include "espik_global.h"
t_servinfo *espik_server_config_set (char *, unsigned short);
t_userinfo *espik_user_sysinfo_get ();
-void espik_config_default_set ();
-void espik_config_init ();
-void espik_config_get (t_info * s_info);
-void espik_config_set (t_info config);
+void espik_config_default_set ();
+void espik_config_init ();
+void espik_config_get (t_info * s_info);
+void espik_config_set (t_info config);
#define ESPIK_CONFIG_VERSION 1
@@ -39,4 +39,4 @@ struct _espik_config
struct channel* cuurent_channel;
};
-#endif /* _HAVE_ESPIK_CONFIG_H */
+#endif /* HAVE_ESPIK_CONFIG_H */
diff --git a/src/espik_debug.c b/src/espik_debug.c
index 601ef7c..c6e8a26 100644
--- a/src/espik_debug.c
+++ b/src/espik_debug.c
@@ -1,23 +1,26 @@
#include "espik_debug.h"
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+
#ifdef __GLIBC__
# include <execinfo.h>
-#endif /* __GLIBC__ */
+#endif /* __GLIBC__ */
#if _ESPIK_DEBUG
-# include <stdio.h>
# include <signal.h>
-#endif /* _ESPIK_DEBUG */
+#endif /* _ESPIK_DEBUG */
inline void espik_debug_bt (int num)
{
#ifdef __GLIBC__ && _ESPIK_DEBUG
- void *array[128];
- size_t size;
- char **strings;
- size_t i;
+ void* array[128];
+ size_t size;
+ char** strings;
+ size_t i;
- if (!debug_bt) return;
+/* if (!debug_bt) return; */
fprintf(stderr, "\n***** Backtrace (Signal %d) *****\n", num);
size = backtrace(array, 128);
@@ -28,9 +31,9 @@ inline void espik_debug_bt (int num)
if (strings)
free(strings);
#else
-# ifdef __GLIBC__
+# ifndef __GLIBC__
fprintf(stderr, "Your system doesn't have glibc. Backtraces disabled. But program receive signal %d.\n", num);
-# endif /* __GLIBC__ */
+# endif /* ! __GLIBC__ */
#endif /* __GLIBC__ && _ESPIK_DEBUG */
}
@@ -41,7 +44,13 @@ void espik_debug_init()
sa.sa_handler = espik_debug_bt;
sigaction(SIGSEGV, &sa, (struct sigaction *)0);
- sigaction(SIGINT, &sa, (struct sigaction *)0);
+ sigaction(SIGINT, &sa, (struct sigaction *)0);
sigaction(SIGKILL, &sa, (struct sigaction *)0);
#endif
}
+
+void kill_me (short num)
+{
+ espik_debug_bt(num);
+ exit (num);
+}
diff --git a/src/espik_debug.h b/src/espik_debug.h
index 235c777..c91c3fa 100644
--- a/src/espik_debug.h
+++ b/src/espik_debug.h
@@ -1,7 +1,8 @@
-#ifndef _HAVE_ESPIK_DEBUG_H
-#define _HAVE_ESPIK_DEBUG_H
+#ifndef HAVE_ESPIK_DEBUG_H
+#define HAVE_ESPIK_DEBUG_H
inline void espik_bt (void);
void espik_debug_init();
+void kill_me (short num);
-# endif /* _HAVE_ESPIK_DEBUG_H */
+#endif /* HAVE_ESPIK_DEBUG_H */
diff --git a/src/espik_error.h b/src/espik_error.h
index d512f36..940f839 100644
--- a/src/espik_error.h
+++ b/src/espik_error.h
@@ -1,4 +1,4 @@
-#ifndef _HAVE_ESPIK_ERROR_H
-#define _HAVE_ESPIK_ERROR_H
+#ifndef HAVE_ESPIK_ERROR_H
+#define HAVE_ESPIK_ERROR_H
-#endif /* _HAVE_ESPIK_ERROR_H */
+#endif /* HAVE_ESPIK_ERROR_H */
diff --git a/src/espik_global.h b/src/espik_global.h
index f6fecaf..fa53639 100644
--- a/src/espik_global.h
+++ b/src/espik_global.h
@@ -1,19 +1,20 @@
-#ifndef _HAVE_ESPIK_GLOBAL_H
-#define _HAVE_ESPIK_GLOBAL_H
+#ifndef HAVE_ESPIK_GLOBAL_H
+#define HAVE_ESPIK_GLOBAL_H
-#define APPS_NAME "espik"
-#define ESPIK_VERSION "0.0.1"
+#include "../config.h"
-#define MAX_LEN 512
+#define APPS_NAME PACKAGE
+#define ESPIK_VERSION VERSION
+
+#define MAX_LEN 512
#define _ESPIK_DEBUG_ 1
-/*#if HAVE___ATTRIBUTE__ */
-# define __UNUSED__ __attribute__((unused))
-/*
+
+#if HAVE___ATTRIBUTE__
+# define __UNUSED__ __attribute__((unused))
#else
-# define __UNUSED__
-#endif
-*/
+# define __UNUSED__
+#endif /* HAVE___ATTRIBUTE__ */
-#endif /* _HAVE_ESPIK_GLOBAL_H */
+#endif /* HAVE_ESPIK_GLOBAL_H */
diff --git a/src/espik_irc.h b/src/espik_irc.h
index 7fa68e2..caed7cf 100644
--- a/src/espik_irc.h
+++ b/src/espik_irc.h
@@ -1,5 +1,5 @@
-#ifndef _HAVE_ESPIK_IRC_H
-#define _HAVE_ESPIK_IRC_H
+#ifndef HAVE_ESPIK_IRC_H
+#define HAVE_ESPIK_IRC_H
unsigned short sendmsg_len (char*);
char* irc_send (char*);
@@ -18,4 +18,4 @@ char** separate_commandline (char*);
//Ecore_Con_Server* irc_connect (char*, int);
//void irc_disconnect (Ecore_Con_Server*);
-#endif /* _HAVE_ESPIK_IRC_H */
+#endif /* HAVE_ESPIK_IRC_H */
diff --git a/src/espik_irc_return_value.h b/src/espik_irc_return_value.h
index 3511a33..f4295d8 100644
--- a/src/espik_irc_return_value.h
+++ b/src/espik_irc_return_value.h
@@ -1,5 +1,5 @@
-#ifndef _HAVE_ESPIK_IRC_RETURN_VALUE_H
-#define _HAVE_ESPIK_IRC_RETURN_VALUE_H
+#ifndef HAVE_ESPIK_IRC_RETURN_VALUE_H
+#define HAVE_ESPIK_IRC_RETURN_VALUE_H
#define RPL_WELCOME 001 /* Welcome to the IRC <nick>!<user>@<host> */
#define RPL_YOURHOST 002 /* Your host is <servername>, running version <ver>" */
@@ -14,4 +14,4 @@
#define ERR_NICKNAMEINUSE 433
#define ERR_NICKCOLLISION 436
-#endif /*_HAVE_ESPIK_IRC_RETURN_VALUE_H */
+#endif /*HAVE_ESPIK_IRC_RETURN_VALUE_H */
diff --git a/src/espik_net.h b/src/espik_net.h
index 9e9cbff..03d50c2 100644
--- a/src/espik_net.h
+++ b/src/espik_net.h
@@ -1,5 +1,5 @@
-#ifndef _HAVE_ESPIK_NET_H
-#define _HAVE_ESPIK_NET_H
+#ifndef HAVE_ESPIK_NET_H
+#define HAVE_ESPIK_NET_H
#include "espik.h"
@@ -7,4 +7,4 @@ void espik_raw_send (char*);
void espik_con_init (t_info);
void espik_con_shutdown ();
-#endif /* _HAVE_ESPIK_NET_H */
+#endif /* HAVE_ESPIK_NET_H */