diff --git a/src/includes.h b/src/includes.h
new file mode 100644
index 0000000..ec91b85
--- /dev/null
+++ b/src/includes.h
@@ -0,0 +1,109 @@
+/*
+ * uhub - A tiny ADC p2p connection hub
+ * Copyright (C) 2007-2010, Jan Vidar Krey
+ *
+ * This program 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ *
+ */
+
+#ifndef HAVE_UHUB_INCLUDES_H
+#define HAVE_UHUB_INCLUDES_H
+
+#define _FILE_OFFSET_BITS 64
+
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
+#ifdef WINSOCK
+# include
+# include
+#else
+# include
+# include
+# include
+# include
+# include
+# include
+# include
+#endif
+
+# include
+# include
+# include
+
+#ifndef __sun__
+# include
+# include
+#endif
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#if !defined(WIN32)
+# include
+# include
+# include
+#endif
+
+#ifdef SSL_SUPPORT
+# include
+# include
+#endif
+
+#ifdef __linux__
+# define USE_EPOLL
+# include
+#endif
+
+#ifdef BSD_LIKE
+# define USE_KQUEUE
+# include
+#endif
+
+#define USE_SELECT
+# ifndef WINSOCK
+# include
+#endif
+
+#if !defined(WIN32)
+# define HAVE_STRNDUP
+# define HAVE_GETRLIMIT
+# if !defined(__HAIKU__)
+# define HAVE_MEMMEM
+# endif
+#endif
+
+#if defined(BSD_LIKE) || defined(__sun__)
+# undef HAVE_STRNDUP
+# undef HAVE_MEMMEM
+#endif
+
+#if defined(WIN32)
+/* Windows uses %Iu for size_t */
+#define PRINTF_SIZE_T "%Iu"
+#else
+/* NOTE: does not work for old versions of gcc (like 2.95) */
+#define PRINTF_SIZE_T "%zu"
+#endif
+
+#define uhub_assert assert
+
+
+#endif /* HAVE_UHUB_INCLUDES_H */
diff --git a/src/system.h b/src/system.h
index 58aeee1..c96cc95 100644
--- a/src/system.h
+++ b/src/system.h
@@ -1,6 +1,6 @@
/*
* uhub - A tiny ADC p2p connection hub
- * Copyright (C) 2007-2009, Jan Vidar Krey
+ * Copyright (C) 2007-2010, Jan Vidar Krey
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -20,225 +20,127 @@
#ifndef HAVE_UHUB_SYSTEM_H
#define HAVE_UHUB_SYSTEM_H
-#define _FILE_OFFSET_BITS 64
-
-#if USE_REGPARM && __GNUC__ >= 3
-#define REGPRM1 __attribute__((regparm(1)))
-#define REGPRM2 __attribute__((regparm(2)))
-#define REGPRM3 __attribute__((regparm(3)))
-#else
-#define REGPRM1
-#define REGPRM2
-#define REGPRM3
-#endif
-
-#ifndef FORCEINLINE
-#if __GNUC__ < 3
-#define FORCEINLINE inline
-#else
-#define FORCEINLINE inline __attribute__((always_inline))
-#endif
-#endif
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) || (defined(__APPLE__) && defined(__MACH__))
-#define BSD_LIKE
+# define BSD_LIKE
#endif
#if defined(__CYGWIN__) || defined(__MINGW32__)
-#ifndef WINSOCK
-#define WINSOCK
+# ifndef WINSOCK
+# define WINSOCK
+# endif
#endif
-#endif
-
-#ifdef WINSOCK
-#include
-#include
-#else
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#endif
-
-#include
-#include
-#include
-
-#ifndef __sun__
-#include
-#include
-#endif
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#if !defined(WIN32)
-#include
-#include
-#include
-#define HAVE_STRNDUP
-#ifndef __HAIKU__
-#define HAVE_MEMMEM
-#endif
-#define HAVE_GETRLIMIT
-#endif
-
-/* printf and size_t support */
-#if defined(WIN32)
-/* Windows uses %Iu for size_t */
-#define PRINTF_SIZE_T "%Iu"
-#else
-#define PRINTF_SIZE_T "%zu"
-#endif
-
-#ifdef SSL_SUPPORT
-#include
-#include
-#endif
-
-#include "../version.h"
-
-#define uhub_assert assert
-
-#ifdef __linux__
-#define USE_EPOLL
-#include
-#endif
-
-#ifdef BSD_LIKE
-#define USE_KQUEUE
-#include
-#endif
-
-#define USE_SELECT
-#ifndef WINSOCK
-#include
-#endif
-
-#if defined(BSD_LIKE) || defined(__sun__)
-#undef HAVE_STRNDUP
-#undef HAVE_MEMMEM
-#endif
-
/*
* Detect operating system info.
* See: http://predef.sourceforge.net/
*/
#if defined(__linux__)
-#define OPSYS "Linux"
+# define OPSYS "Linux"
#endif
#if defined(_WIN32) || defined(__MINGW32__) || defined(_WIN64) || defined(__WIN32__) || defined(__WINDOWS__)
-#define OPSYS "Windows"
+# define OPSYS "Windows"
#endif
#if defined(__APPLE__) && defined(__MACH__)
-#define OPSYS "MacOSX"
+# define OPSYS "MacOSX"
#endif
#if defined(__FreeBSD__)
-#define OPSYS "FreeBSD"
+# define OPSYS "FreeBSD"
#endif
#if defined(__OpenBSD__)
-#define OPSYS "OpenBSD"
+# define OPSYS "OpenBSD"
#endif
#if defined(__NetBSD__)
-#define OPSYS "NetBSD"
+# define OPSYS "NetBSD"
#endif
#if defined(__sun__)
-#if defined(__SVR4) || defined(__svr4__)
-#define OPSYS "Solaris"
-#else
-#define OPSYS "SunOS"
-#endif
+# if defined(__SVR4) || defined(__svr4__)
+# define OPSYS "Solaris"
+# else
+# define OPSYS "SunOS"
+# endif
#endif
#if defined(__HAIKU__)
-#define OPSYS "Haiku"
+# define OPSYS "Haiku"
#endif
/* Detect CPUs */
#if defined(__alpha__) || defined(__alpha)
-#define CPUINFO "Alpha"
+# define CPUINFO "Alpha"
#endif
#if defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) || defined(__amd64) || defined(_M_X64)
-#define CPUINFO "AMD64"
+# define CPUINFO "AMD64"
#endif
#if defined(__arm__) || defined(__thumb__) || defined(_ARM) || defined(__TARGET_ARCH_ARM)
-#define CPUINFO "ARM"
+# define CPUINFO "ARM"
#endif
#if defined(__i386__) || defined(__i386) || defined(i386) || defined(_M_IX86) || defined(__X86__) || defined(_X86_) || defined(__I86__) || defined(__INTEL__) || defined(__THW_INTEL__)
-#define CPUINFO "i386"
+# define CPUINFO "i386"
#endif
#if defined(__ia64__) || defined(_IA64) || defined(__IA64__) || defined(__ia64) || defined(_M_IA64)
-#define CPUINFO "IA64"
+# define CPUINFO "IA64"
#endif
#if defined(__hppa__) || defined(__hppa)
-#define CPUINFO "PARISC"
+# define CPUINFO "PARISC"
#endif
#if defined(__m68k__) || defined(M68000)
-#define CPUINFO "M68K"
+# define CPUINFO "M68K"
#endif
#if defined(__mips__) || defined(mips) || defined(__mips) || defined(__MIPS__)
-#define CPUINFO "MIPS"
+# define CPUINFO "MIPS"
#endif
#if defined(__POWERPC__) || defined(__ppc__) || defined(_ARCH_PPC) || defined(__powerpc) || defined(__powerpc__)
-#define CPUINFO "PowerPC"
+# define CPUINFO "PowerPC"
#endif
#if defined(__sparc__) || defined(__sparc)
-#define CPUINFO "SPARC"
+# define CPUINFO "SPARC"
#endif
#if defined(__sh__)
-#define CPUINFO "SuperH"
+# define CPUINFO "SuperH"
#endif
+/* System includes */
+#include "includes.h"
+#include "../version.h"
+
+
/* Misc */
#ifdef MSG_NOSIGNAL
-#define UHUB_SEND_SIGNAL MSG_NOSIGNAL
+# define UHUB_SEND_SIGNAL MSG_NOSIGNAL
#else
-#ifdef MSG_NOPIPE
-#define UHUB_SEND_SIGNAL MSG_NOPIPE
-#else
-#define UHUB_SEND_SIGNAL 0
-#endif
+# ifdef MSG_NOPIPE
+# define UHUB_SEND_SIGNAL MSG_NOPIPE
+# else
+# define UHUB_SEND_SIGNAL 0
+# endif
#endif
#ifndef INET6_ADDRSTRLEN
-#define INET6_ADDRSTRLEN 46
+# define INET6_ADDRSTRLEN 46
#endif
#ifndef MIN
-#define MIN(a, b) ((a) < (b) ? (a) : (b))
+# define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#ifndef MAX
-#define MAX(a, b) ((a) > (b) ? (a) : (b))
+# define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
#endif /* HAVE_UHUB_SYSTEM_H */