chiark / gitweb /
disorder.h: more consistent approach to function attributes
[disorder] / lib / common.h
index 154338e85d1e561e2faebaec2256422ca2f513c3..6c90fd6aad0cb4f405075184b349e3e6f2dbb2cc 100644 (file)
 # include <config.h>
 #endif
 
+#if _WIN32
+# include "disorder-win32.h"
+#else
+# define SOCKET int
+# define INVALID_SOCKET (-1)
+# define declspec(x)
+# define socket_error() (errno)
+# define system_error() (errno)
+# define network_init()
+#endif
+
 #if HAVE_INTTYPES_H
 # include <inttypes.h>
 #endif
@@ -112,6 +123,18 @@ typedef unsigned char uint32_t;
 # endif
 #endif
 
+#if ! HAVE_UINT16_T
+# if USHRT_MAX == 65535
+typedef unsigned short uint16_t;
+# else
+#  error cannot determine uint16_t
+# endif
+#endif
+
+#if !HAVE_CLOSESOCKET
+# define closesocket close
+#endif
+
 #endif /* COMMENT_H */
 
 /*