diff options
author | beber <beber> | 2005-12-01 20:22:19 +0000 |
---|---|---|
committer | beber <beber> | 2005-12-01 20:22:19 +0000 |
commit | 1d217fb1cf5b137fe0758015e90e4f38a5a0ba62 (patch) | |
tree | cf92fb109d6bc4cb81a66fa1d542efae34c1fc53 | |
parent | more debug infos (diff) | |
download | espik-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 '')
-rw-r--r-- | ChangeLog | 27 | ||||
-rw-r--r-- | autogen.sh | 14 | ||||
-rw-r--r-- | config.h.in | 31 | ||||
-rw-r--r-- | configure.in | 26 | ||||
-rw-r--r-- | m4/ac_attribute.m4 | 14 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/espik.h | 6 | ||||
-rw-r--r-- | src/espik_common_handler.h | 6 | ||||
-rw-r--r-- | src/espik_config.c | 7 | ||||
-rw-r--r-- | src/espik_config.h | 14 | ||||
-rw-r--r-- | src/espik_debug.c | 31 | ||||
-rw-r--r-- | src/espik_debug.h | 7 | ||||
-rw-r--r-- | src/espik_error.h | 6 | ||||
-rw-r--r-- | src/espik_global.h | 25 | ||||
-rw-r--r-- | src/espik_irc.h | 6 | ||||
-rw-r--r-- | src/espik_irc_return_value.h | 6 | ||||
-rw-r--r-- | src/espik_net.h | 6 |
17 files changed, 179 insertions, 55 deletions
@@ -1,3 +1,30 @@ +dev from guybrush.melee : 01/12/05 21:22:19 +Add a macro for __attribute__ +Check if valgrinf is here +Indent +More debug and do better +use config.h +del ^_ from header + +File changes : +A m4 +A m4/ac_attribute.m4 +M configure.in +M src/espik_config.c +M src/espik_global.h +M src/espik_config.h +M src/espik_irc_return_value.h +M src/espik_irc.h +M src/espik.h +M src/espik_debug.c +M src/espik_common_handler.h +M src/espik_net.h +M src/espik_debug.h +M src/Makefile.am +M src/espik_error.h +M config.h.in +M autogen.sh + beber from rampa : 21/10/05 12:44:54 Update compil flags diff --git a/autogen.sh b/autogen.sh new file mode 100644 index 0000000..12bfba8 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +rm -rf autom4te.cache +rm -f aclocal.m4 + +echo "Running aclocal..."; aclocal $ACLOCAL_FLAGS -I m4 \ +&& echo "Running autoheader..."; autoheader \ +&& echo "Running autoconf..."; autoconf \ +&& echo "Running libtoolize..."; ( libtoolize --automake || glibtoolize --automake ) \ +&& echo "Running automake..."; automake --add-missing --copy --gnu + +if [ -z "$NOCONFIGURE" -a $? -eq 0 ]; then + ./configure "$@" +fi diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..66e5ed3 --- /dev/null +++ b/config.h.in @@ -0,0 +1,31 @@ +/* config.h.in. Generated from configure.in by autoheader. */ + +/* Valgrind support */ +#undef HAVE_VALGRIND + +/* Define to 1 if your compiler has __attribute__ */ +#undef HAVE___ATTRIBUTE__ + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION diff --git a/configure.in b/configure.in index a95c0de..83f8ce5 100644 --- a/configure.in +++ b/configure.in @@ -11,6 +11,7 @@ AM_CONFIG_HEADER(config.h) AC_PROG_CC AM_PROG_CC_STDC AC_HEADER_STDC +AC_C___ATTRIBUTE__ AC_ARG_WITH(ecore-config, [ --with-ecore-config=ECORE_CONFIG use ecore-config specified ], @@ -26,6 +27,31 @@ ecore_libs=`$ECORE_CONFIG --libs` AC_SUBST(ecore_cflags) AC_SUBST(ecore_libs) +# Setting have_valgrind to "no" seems pointless, but we just need to +# put something in as the 4th parameter, so configure doesn't abort +# when valgrind.pc isn't found. +have_valgrind="no" +PKG_CHECK_MODULES(VALGRIND, valgrind >= 2.4.0, have_valgrind=yes, have_valgrind=no) +AC_ARG_ENABLE(valgrind, + [ --enable-valgrind enable valgrind support], [ + if test x"$enableval" = x"yes" ; then + AC_MSG_RESULT(yes) + have_valgrind="yes" + else + AC_MSG_RESULT(no) + have_valgrind="no" + VALGRIND_CFLAGS="" + VALGRIND_LIBS="" + fi + ], [ + have_valgrind=$have_valgrind + ] +) + +if test x$have_valgrind = "xyes"; then + AC_DEFINE(HAVE_VALGRIND, 1, [Valgrind support]) +fi + AC_OUTPUT([ Makefile src/Makefile]) diff --git a/m4/ac_attribute.m4 b/m4/ac_attribute.m4 new file mode 100644 index 0000000..46c1a42 --- /dev/null +++ b/m4/ac_attribute.m4 @@ -0,0 +1,14 @@ + +AC_DEFUN([AC_C___ATTRIBUTE__], +[ + AC_MSG_CHECKING(for __attribute__) + AC_CACHE_VAL(ac_cv___attribute__, [ + AC_TRY_COMPILE([#include <stdlib.h>], + [int func(int x); int foo(int x __attribute__ ((unused))) { exit(1); }], + ac_cv___attribute__=yes, ac_cv___attribute__=no)]) + if test "$ac_cv___attribute__" = "yes"; then + AC_DEFINE(HAVE___ATTRIBUTE__, 1, [Define to 1 if your compiler has __attribute__]) + fi + AC_MSG_RESULT($ac_cv___attribute__) +]) + 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 */ |