*
* x3 is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
#define ArrayLength(x) (sizeof(x)/sizeof(x[0]))
#define safestrncpy(dest, src, len) do { char *d = (dest); const char *s = (src); size_t l = strlen(s)+1; if ((len) < l) l = (len); memmove(d, s, l); d[l-1] = 0; } while (0)
-#ifdef __GNUC__
+#if __GNUC__
#define PRINTF_LIKE(M,N) __attribute__((format (printf, M, N)))
#else
#define PRINTF_LIKE(M,N)
#define UNUSED_ARG(ARG) ARG
#endif
+#if defined(__GNUC__) && (__GNUC__ < 3)
+# define GCC_VARMACROS 1
+#elif !defined(S_SPLINT_S)
+# define C99_VARMACROS 1
+#endif
+
#if defined(WITH_MALLOC_DMALLOC)
# define DMALLOC_FUNC_CHECK 1
# include <string.h>
int create_socket_client(struct uplinkNode *target);
void close_socket(void);
-typedef void (*exit_func_t)(void);
-void reg_exit_func(exit_func_t handler);
+typedef void (*exit_func_t)(void *extra);
+void reg_exit_func(exit_func_t handler, void *extra);
void call_exit_funcs(void);
char *mysep(char **sepstr, char *delim);
int match_ircglob(const char *text, const char *glob);
#define MATCH_USENICK 1
#define MATCH_VISIBLE 2
-int user_matches_glob(struct userNode *user, const char *glob, int flags);
+int user_matches_glob(struct userNode *user, const char *glob, int flags, int shared);
int is_overmask(char *mask);
int irccasecmp(const char *stra, const char *strb);
int ircncasecmp(const char *stra, const char *strb, unsigned int len);
const char *irccasestr(const char *haystack, const char *needle);
+char *ircstrlower(char *str);
DECLARE_LIST(string_buffer, char);
void string_buffer_append_string(struct string_buffer *buf, const char *tail);
void string_buffer_append_vprintf(struct string_buffer *buf, const char *fmt, va_list args);
void string_buffer_append_printf(struct string_buffer *buf, const char *fmt, ...);
void string_buffer_replace(struct string_buffer *buf, unsigned int from, unsigned int len, const char *repl);
+void
+irc_strtolower(char *str);
-int str_is_number(char *str);
+int str_is_number(const char *str);
#define enabled_string(string) (!irccasecmp((string), "on") || !strcmp((string), "1") || !irccasecmp((string), "enabled"))
#define disabled_string(string) (!irccasecmp((string), "off") || !strcmp((string), "0") || !irccasecmp((string), "disabled"))
#define true_string(string) (!irccasecmp((string), "true") || !strcmp((string), "1") || !irccasecmp((string), "yes"))