diff --git a/configure.ac b/configure.ac index 44d9eb0..ad837ed 100644 --- a/configure.ac +++ b/configure.ac @@ -1,67 +1,19 @@ AC_PREREQ([2.69]) -AC_INIT([Bip Sexy IRC Proxy], [0.9.0-rc3-git], - [http://bip.milkypond.org/projects/bip/activity], [bip], - [http://bip.milkypond.org/]) -AM_INIT_AUTOMAKE([subdir-objects]) +AC_INIT([Bip IRC Proxy],[0.9.0-rc3-git],[http://bip.milkypond.org/projects/bip/activity],[bip],[http://bip.milkypond.org/]) +AM_INIT_AUTOMAKE([foreign -Wall -Werror]) AM_MAINTAINER_MODE -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES]) -AC_CONFIG_SRCDIR([src/bip.h]) + AC_CONFIG_HEADERS([src/config.h]) # Checks for programs AC_PROG_CC +AM_PROG_AR AC_PROG_RANLIB -AM_PROG_CC_C_O AC_PROG_INSTALL AM_PROG_LEX AC_PROG_YACC -# AC_PROG_YACC falls back to YACC = "yacc" if bison or byacc are not found, -# but it does not mean it is present -AS_IF([test x"$YACC" = "xyacc"], [ - AC_CHECK_PROG([YACC_EXISTS], [yacc], [yes], [no]) - AS_IF([test x"$YACC_EXISTS" != xyes], [ - YACC=${am_missing_run}yacc - ]) -]) - -# Checks for header files. -AC_FUNC_ALLOCA -AC_CHECK_HEADERS([arpa/inet.h fcntl.h inttypes.h libintl.h limits.h malloc.h \ - netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h \ - sys/socket.h sys/time.h termios.h unistd.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_INLINE -AC_TYPE_INT16_T -AC_TYPE_INT32_T -AC_TYPE_INT8_T -AC_TYPE_PID_T -AC_TYPE_SIZE_T -AC_TYPE_SSIZE_T -AC_TYPE_UINT16_T -AC_TYPE_UINT32_T -AC_TYPE_UINT8_T - -AX_C___ATTRIBUTE__ -AH_BOTTOM([ -/* Unused attributes such as function parameters (GCC extension) */ -#ifdef HAVE___ATTRIBUTE__ -# define UNUSED(ATTRIBUTE) ATTRIBUTE __attribute__((unused)) -#else -# define UNUSED(ATTRIBUTE) ATTRIBUTE -#endif]) - -# Checks for library functions. -AC_FUNC_FORK -AC_FUNC_MALLOC -AC_FUNC_MKTIME -AC_FUNC_REALLOC -AC_CHECK_FUNCS(clock_gettime ftruncate gethostname gettimeofday localtime_r memmove) -AC_CHECK_FUNCS(memset mkdir select socket strcasecmp strchr strcspn strdup strerror) -AC_CHECK_FUNCS(strrchr strstr) # Deal with parameters - AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Enable debug build])) AC_ARG_WITH([openssl], AS_HELP_STRING([--without-openssl], [Disable SSL using OpenSSL])) diff --git a/src/Makefile.am b/src/Makefile.am index 5d7f516..04b6ee7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,5 +20,3 @@ bip_LDADD = libbip.a bipmkpw_SOURCES = bipmkpw.c md5.c util.c AM_YFLAGS= -d BUILT_SOURCES = conf.c conf.h lex.c - -AM_CFLAGS=-Wall -Wextra -Werror diff --git a/src/irc.c b/src/irc.c index f46f4dd..7a1cbbf 100644 --- a/src/irc.c +++ b/src/irc.c @@ -51,8 +51,8 @@ static void ls_set_nick(struct link_server *ircs, char *nick); static void server_set_chanmodes(struct link_server *l, const char *chanmodes); static void server_set_prefix(struct link_server *l, const char *prefix); static void server_init_modes(struct link_server *s); -static int get_index(const char* str, char car); -static int fls(int v); +static int bip_get_index(const char* str, char car); +static int bip_fls(int v); #ifdef HAVE_OIDENTD #define OIDENTD_FILENAME ".oidentd.conf" @@ -137,7 +137,7 @@ list_t *channel_name_list(struct link_server *server, struct channel *c) // prepend symbol corresponding to the usermode int msb; - if ((msb = fls(ovmask))) { + if ((msb = bip_fls(ovmask))) { str[len] = server->prefixes[msb - 1]; str[++len] = 0; } @@ -314,8 +314,9 @@ static int irc_352(struct link_server *server, struct line *line) return OK_COPY_WHO; } -static int irc_315(struct link_server *server, UNUSED(struct line *l)) +static int irc_315(struct link_server *server, struct line *l) { + (void)l; struct link *link = LINK(server); if (link->who_client) { if (link->who_client->who_count == 0) { @@ -1400,7 +1401,7 @@ static int irc_353(struct link_server *server, struct line *line) long int ovmask = 0; /* some ircds (e.g. unreal) may display several flags for the same nick */ - while ((index = get_index(server->prefixes, *names))) { + while ((index = bip_get_index(server->prefixes, *names))) { ovmask |= 1 << index; names++; } @@ -1446,8 +1447,9 @@ static int irc_367(struct link_server *server, struct line *l) } /* same as irc_315 */ -static int irc_368(struct link_server *server, UNUSED(struct line *l)) +static int irc_368(struct link_server *server, struct line *l) { + (void)l; struct link *link = LINK(server); if (link->who_client) { if (link->who_client->who_count == 0) { @@ -1683,7 +1685,7 @@ static int irc_mode_channel(struct link_server *s, struct channel *channel, channel->key = NULL; } } - } else if ((index = get_index(s->usermodes, *mode))) { + } else if ((index = bip_get_index(s->usermodes, *mode))) { nick = irc_line_elem(line, cur_arg + 3); if (!hash_includes(&channel->ovmasks, nick)) @@ -2713,7 +2715,7 @@ static void server_set_prefix(struct link_server *s, const char *modes) } // Return the position (*1 based*) of car in str, else -1 -static int get_index(const char* str, char car) +static int bip_get_index(const char* str, char car) { char *cur; if ((cur = strchr(str, car))) @@ -2722,7 +2724,7 @@ static int get_index(const char* str, char car) return 0; } -static int fls(int v) +static int bip_fls(int v) { unsigned int r = 0; while (v >>= 1) diff --git a/src/log.c b/src/log.c index 457337a..de53430 100644 --- a/src/log.c +++ b/src/log.c @@ -11,14 +11,13 @@ * See the file "COPYING" for the exact licensing terms. */ -#define _XOPEN_SOURCE 500 - #include "config.h" #include "log.h" #include "irc.h" #include "util.h" #include #include +#include extern int errno; extern int log_level; @@ -713,7 +712,7 @@ void log_reset_all(log_t *logdata) if (ischannel(*hash_it_key(&hi))) log_reset(store); else - list_add_last(&drop, strdup(hash_it_key(&hi))); + list_add_last(&drop, bip_strdup(hash_it_key(&hi))); } char *name;