summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAshish Gupta <ashmew2@gmail.com>2017-04-13 23:36:26 +0200
committerAshish Gupta <ashmew2@gmail.com>2017-06-10 08:25:29 +0200
commit6fed24e8948c1acaaeae002b9ee7ee44a7e2e0a5 (patch)
tree313901d40813d40f94fc5898f782ff55c82df26d /utils
parent6fd280bb5b27842a0ef2977798566c37bd4e1d0e (diff)
downloadnetsurf-6fed24e8948c1acaaeae002b9ee7ee44a7e2e0a5.tar.gz
netsurf-6fed24e8948c1acaaeae002b9ee7ee44a7e2e0a5.tar.bz2
Step 2 : Abuse _TARGET_IS_KOLIBRIOS and build with make TARGET=kolibrios
Diffstat (limited to 'utils')
-rw-r--r--utils/config.h19
-rw-r--r--utils/inet.h14
-rw-r--r--utils/nsoption.h11
-rw-r--r--utils/utils.c14
4 files changed, 49 insertions, 9 deletions
diff --git a/utils/config.h b/utils/config.h
index ddd1c6e8e..075287684 100644
--- a/utils/config.h
+++ b/utils/config.h
@@ -66,19 +66,23 @@ char *strchrnul(const char *s, int c);
#undef HAVE_SYS_SELECT
#undef HAVE_POSIX_INET_HEADERS
#endif
-
+#if (defined(_TARGET_IS_KOLIBRIOS))
+#undef HAVE_INETATON
+#undef HAVE_POSIX_INET_HEADERS
+#endif
+
#define HAVE_INETPTON
-#if (defined(_WIN32))
+#if (defined(_WIN32)) || (defined(_TARGET_IS_KOLIBRIOS))
#undef HAVE_INETPTON
#endif
#define HAVE_UTSNAME
-#if (defined(_WIN32))
+#if (defined(_WIN32)) || (defined(_TARGET_IS_KOLIBRIOS))
#undef HAVE_UTSNAME
#endif
#define HAVE_REALPATH
-#if (defined(_WIN32))
+#if (defined(_WIN32)) || (defined(_TARGET_IS_KOLIBRIOS))
#undef HAVE_REALPATH
char *realpath(const char *path, char *resolved_path);
#endif
@@ -99,7 +103,7 @@ char *realpath(const char *path, char *resolved_path);
#endif
#define HAVE_MMAP
-#if (defined(_WIN32) || defined(__riscos__) || defined(__HAIKU__) || defined(__BEOS__) || defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__))
+#if (defined(_WIN32) || defined(__riscos__) || defined(__HAIKU__) || defined(__BEOS__) || defined(__amigaos4__) || defined(__AMIGA__) || defined(__MINT__)) || defined(_TARGET_IS_KOLIBRIOS)
#undef HAVE_MMAP
#endif
@@ -139,4 +143,9 @@ char *realpath(const char *path, char *resolved_path);
#define NO_IPV6
#endif
+/* kolibriOS */
+#if defined(_TARGET_IS_KOLIBRIOS)
+#define NO_IPV6
+#endif
+
#endif
diff --git a/utils/inet.h b/utils/inet.h
index da1798432..1d2263fb8 100644
--- a/utils/inet.h
+++ b/utils/inet.h
@@ -33,6 +33,18 @@
#include "utils/config.h"
+#ifdef _TARGET_IS_KOLIBRIOS
+
+#include <sys/select.h>
+
+/* Internet address. */
+struct in_addr {
+ uint32_t s_addr; /* address in network byte order */
+};
+
+extern int AF_INET;
+
+#else
#ifdef HAVE_POSIX_INET_HEADERS
#include <sys/socket.h>
@@ -52,6 +64,8 @@
#endif
+#endif
+
#ifndef HAVE_INETATON
int inet_aton(const char *cp, struct in_addr *inp);
#endif
diff --git a/utils/nsoption.h b/utils/nsoption.h
index e60ebd114..dc23a70ff 100644
--- a/utils/nsoption.h
+++ b/utils/nsoption.h
@@ -56,6 +56,13 @@
#define NSOPTION_UINT(NAME, DEFAULT)
#define NSOPTION_COLOUR(NAME, DEFAULT)
+#ifndef _TARGET_IS_KOLIBRIOS
+#define _TARGET_IS_KOLIBRIOS
+#endif
+#ifdef _TARGET_IS_KOLIBRIOS
+#define nskolibrios
+#endif
+
#include "desktop/options.h"
#if defined(riscos)
#include "riscos/options.h"
@@ -73,6 +80,8 @@
#include "monkey/options.h"
#elif defined(nswin32)
#include "windows/options.h"
+#elif defined(nskolibrios)
+#include "kolibrios/fb/options.h"
#endif
#undef NSOPTION_BOOL
@@ -146,6 +155,8 @@ enum nsoption_e {
#include "monkey/options.h"
#elif defined(nswin32)
#include "windows/options.h"
+#elif defined(nskolibrios)
+#include "kolibrios/fb/options.h"
#endif
NSOPTION_LISTEND /* end of list */
};
diff --git a/utils/utils.c b/utils/utils.c
index 15c91c621..e464a4382 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -25,6 +25,9 @@
#include <string.h>
#include <strings.h>
#include <sys/stat.h>
+#ifdef _TARGET_IS_KOLIBRIOS
+#include <errno.h>
+#endif
#include "utils/messages.h"
#include "utils/dirent.h"
@@ -418,6 +421,7 @@ char *realpath(const char *path, char *resolved_path)
}
return ret;
}
+#endif
#ifndef HAVE_INETATON
@@ -448,10 +452,15 @@ int inet_aton(const char *cp, struct in_addr *inp)
int inet_pton(int af, const char *src, void *dst)
{
int ret;
-
+#ifndef _TARGET_IS_KOLIBRIOS
if (af == AF_INET) {
ret = inet_aton(src, dst);
}
+#else
+ if (1) {
+ ret = inet_aton(src, dst);
+ }
+#endif
#if !defined(NO_IPV6)
else if (af == AF_INET6) {
/* TODO: implement v6 address support */
@@ -468,6 +477,3 @@ int inet_pton(int af, const char *src, void *dst)
}
#endif
-
-
-#endif