]> jfr.im git - irc/evilnet/x3.git/blobdiff - src/common.h
Couple of srvx updates.
[irc/evilnet/x3.git] / src / common.h
index 90cab5e5b3713bf2714eb30ba7c597dd9256122a..b2f5789e5bb195f29b5e339e70cfa765dd49bd02 100644 (file)
@@ -5,7 +5,7 @@
  *
  * 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,
@@ -41,7 +41,7 @@ extern struct tm *localtime_r(const time_t *clock, struct tm *res);
 #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)
@@ -56,6 +56,12 @@ extern struct tm *localtime_r(const time_t *clock, struct tm *res);
 #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>
@@ -95,6 +101,7 @@ extern void x3_free(const char *, unsigned int, void *);
 extern void verify(const void *ptr);
 #  define verify(x) verify(x)
 # endif
+
 #elif defined(WITH_MALLOC_SLAB)
 # define malloc(n) slab_malloc(__FILE__, __LINE__, (n))
 # undef calloc
@@ -119,6 +126,9 @@ extern void verify(const void *ptr);
 # define verify(ptr) (void)(ptr)
 #endif
 
+extern char *x3_msnprintf(const int size, const char *format, ...);
+#define msnprintf x3_msnprintf
+
 extern time_t now;
 extern int quit_services;
 extern struct log_type *MAIN_LOG;
@@ -158,8 +168,8 @@ const char *irc_ntoa(const irc_in_addr_t *addr);
 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);
@@ -173,7 +183,7 @@ int mmatch(const char *glob, const char *newglob);
 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);
 
 
@@ -258,6 +268,7 @@ void tools_cleanup(void);
 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);
@@ -265,7 +276,10 @@ void string_buffer_append_substring(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(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"))