Hi,

There is a patch to build netsurf for QNX4. But there are no any frontends 
for QNX4 yet. So it's impossible to build (link) QNX4 version at this 
moment.

-- 
Respectfully,
Oleg Bolshakov
diff -rNu netsurf/Makefile netsurf.qnx4/Makefile
--- netsurf/Makefile	2010-03-04 19:44:22.653771908 +0300
+++ netsurf.qnx4/Makefile	2010-03-04 20:33:39.000000000 +0300
@@ -94,7 +94,9 @@
       ifneq ($(TARGET),amiga)
         ifneq ($(TARGET),framebuffer)
           ifneq ($(TARGET),windows)
-            $(error Unknown TARGET "$(TARGET)", should either be "riscos", "gtk", "beos", "amiga", "framebuffer" or "windows")
+            ifneq ($(TARGET),qnx4)
+              $(error Unknown TARGET "$(TARGET)", should either be "riscos", "gtk", "beos", "amiga", "framebuffer", "windows" or "qnx4")
+            endif
           endif
         endif
       endif
@@ -117,6 +119,14 @@
   endif
 endif
 
+# Building for QNX4
+ifeq ($(TARGET),qnx4)
+  CC := wacc
+  CXX := wacc
+  EXEEXT :=
+  PKG_CONFIG :=
+endif
+
 ifeq ($(TARGET),riscos)
   ifeq ($(HOST),riscos)
     # Build for RO on RO
@@ -175,8 +185,16 @@
         PKG_CONFIG := $(MINGW_INSTALL_ENV)/bin/pkg-config
       endif
     else
-      # Building for GTK, Amiga, Framebuffer
-      PKG_CONFIG := pkg-config
+      ifeq ($(TARGET),qnx4)
+        # Building for QNX4
+        CC := wacc
+        CXX := wacc
+        EXEEXT :=
+        PKG_CONFIG :=
+      else
+        # Building for GTK, Amiga, Framebuffer
+        PKG_CONFIG := pkg-config
+      endif
     endif
   endif
 endif
@@ -516,6 +534,32 @@
 endif
 
 # ----------------------------------------------------------------------------
+# QNX4 target setup
+# ----------------------------------------------------------------------------
+
+ifeq ($(TARGET),qnx4)
+#  NETSURF_FEATURE_ROSPRITE_CFLAGS := -DWITH_NSSPRITE
+#  NETSURF_FEATURE_BMP_CFLAGS := -DWITH_BMP
+#  NETSURF_FEATURE_GIF_CFLAGS := -DWITH_GIF
+#  NETSURF_FEATURE_PNG_CFLAGS := -DWITH_PNG
+#  NETSURF_FEATURE_NSSVG_CFLAGS := -DWITH_NS_SVG
+
+#    $(eval $(call feature_enabled,ROSPRITE,-DWITH_NSSPRITE,-lrosprite,RISC OS Sprite decoder))
+#    $(eval $(call feature_enabled,BMP,-DWITH_BMP,-lnsbmp,NetSurf BMP decoder))
+#    $(eval $(call feature_enabled,GIF,-DWITH_GIF,-lnsgif,NetSurf GIF decoder))
+#    $(eval $(call feature_enabled,PNG,-DWITH_PNG,-lpng,PNG support))
+#    $(eval $(call feature_enabled,NSSVG,-DWITH_NS_SVG,-lsvgtiny,SVG rendering))
+#    $(eval $(call feature_enabled,MNG,,-llcms -ljpeg,libmng extras))
+
+  CFLAGS += -D__USE_INLINE__ -DQNX4 -za99 -Wc,-aq -Drestrict="" -DICONVCONST=const -I.
+  LDFLAGS += -lxml2 -lcares -lcurl
+  LDFLAGS += -lssl -lcrypto -lhubbub -lcss -lparserutils -lwapcaplet 
+  LDFLAGS += -lunix -lclib -liconv -lowc
+
+  GCCVER := WCC
+endif
+
+# ----------------------------------------------------------------------------
 # Framebuffer target setup
 # ----------------------------------------------------------------------------
 
@@ -719,6 +763,16 @@
 
 endef
 else
+ifeq ($(GCCVER),WCC)
+define compile_target_c
+$$(OBJROOT)/$(2): $$(OBJROOT)/created
+	@echo \"$$(CC) $$(CFLAGS) -c -o $$(OBJROOT)/$(2) -c $(1)\"
+	@echo \"$$(OBJROOT)/$(2)\"
+	@echo
+	$$(CC) $$(CFLAGS) -c -o $$(OBJROOT)/$(2) -c $(1)
+
+endef
+else
 define compile_target_c
 $$(DEPROOT)/$(3) $$(OBJROOT)/$(2): $$(OBJROOT)/created
 	$$(VQ)echo " COMPILE: $(1)"
@@ -728,6 +782,7 @@
 
 endef
 endif
+endif
 
 define compile_target_cpp
 $$(DEPROOT)/$(3) $$(OBJROOT)/$(2): $$(OBJROOT)/created
diff -rNu netsurf/Makefile.defaults netsurf.qnx4/Makefile.defaults
--- netsurf/Makefile.defaults	2010-03-04 19:44:22.522770000 +0300
+++ netsurf.qnx4/Makefile.defaults	2010-03-04 19:49:58.000000000 +0300
@@ -257,6 +257,38 @@
 
 endif
 
+# ----------------------------------------------------------------------------
+# QNX4-specific options                                                                                  
+# ----------------------------------------------------------------------------                           
+ifeq ($(TARGET),qnx4)                                                                                    
+                                                                                                         
+  # Enable NetSurf's use of librosprite for displaying RISC OS Sprites                                   
+  # Valid options: YES, NO, AUTO                                                                         
+  NETSURF_USE_ROSPRITE := NO                                                                             
+                                                                                                         
+  # Enable NetSurf's use of libharu for PDF export.                                                      
+  # Valid options: YES, NO                                                                               
+  NETSURF_USE_HARU_PDF := NO                                                                             
+                                                                                                         
+  # Enable NetSurf's use of libpng for displaying PNGs.  If MNG and PNG                                  
+  # are both enabled then NetSurf will choose libpng for PNGs, leaving                                   
+  # MNGs and JNGs to libmng.                                                                             
+  # Valid options: YES, NO      (at least one of PNG/MNG highly recommended)                             
+  NETSURF_USE_PNG := NO                                                                                  
+                                                                                                         
+  # Enable NetSurf's use of libnsbmp for displaying BMPs and ICOs
+  # Valid options: YES, NO
+  NETSURF_USE_BMP := NO
+
+  # Force using glibc internal iconv implementation instead of external libiconv
+  # Valid options: YES, NO
+  NETSURF_USE_LIBICONV_PLUG := NO
+
+  # Optimisation levels
+  CFLAGS += -DQNX4
+
+endif
+
 # Include any local configuration
 -include Makefile.config
 
diff -rNu netsurf/Makefile.sources netsurf.qnx4/Makefile.sources
--- netsurf/Makefile.sources	2010-03-04 19:44:22.627772305 +0300
+++ netsurf.qnx4/Makefile.sources	2010-03-04 20:38:47.891771405 +0300
@@ -98,6 +98,10 @@
 	stringview/stringview.c stringview/urlhistory.c
 S_AMIGA := $(addprefix amiga/,$(S_AMIGA))
 
+# S_QNX4 are sources purely for the QNX4 build
+S_QNX4 := gnu_regex.c
+S_QNX4 := $(addprefix qnx4/,$(S_QNX4))
+
 # S_FRAMEBUFFER are sources purely for the framebuffer build
 S_FRAMEBUFFER := gui.c framebuffer.c tree.c history.c hotlist.c 	\
         save.c schedule.c thumbnail.c misc.c bitmap.c filetype.c	\
@@ -174,6 +178,11 @@
 EXETARGET := NetSurf.exe
 endif
 
+ifeq ($(TARGET),qnx4)
+SOURCES := $(S_COMMON) $(S_IMAGE) $(S_BROWSER) $(S_QNX4)
+EXETARGET := NetSurf
+endif
+
 ifeq ($(SOURCES),)
 $(error Unable to build NetSurf, could not determine set of sources to build)
 endif
diff -rNu netsurf/content/fetchcache.c netsurf.qnx4/content/fetchcache.c
--- netsurf/content/fetchcache.c	2010-03-04 19:44:19.337786488 +0300
+++ netsurf.qnx4/content/fetchcache.c	2010-02-21 20:05:39.000000000 +0300
@@ -30,7 +30,11 @@
 #include <string.h>
 #include <strings.h>
 #include <sys/types.h>
+#ifndef QNX4
 #include <regex.h>
+#else
+#include "qnx4/gnu_regex.h"
+#endif
 #include <time.h>
 #include <unistd.h>
 #include <curl/curl.h>  /* for curl_getdate() */
@@ -579,7 +583,11 @@
 	char *type = 0;
 	unsigned int i;
 	int r;
+#ifndef QNX4
 	regmatch_t pmatch[2 + MAX_ATTRS * 3];
+#else
+	gnu_regmatch_t pmatch[2 + MAX_ATTRS * 3];
+#endif
 
 	*params = malloc((MAX_ATTRS * 2 + 2) * sizeof (*params)[0]);
 	if (!*params)
@@ -587,7 +595,11 @@
 	for (i = 0; i != MAX_ATTRS * 2 + 2; i++)
 		(*params)[i] = 0;
 
+#ifndef QNX4
 	r = regexec(&re_content_type, s, 2 + MAX_ATTRS * 3, pmatch, 0);
+#else
+	r = gnu_regexec(&re_content_type, s, 2 + MAX_ATTRS * 3, pmatch, 0);
+#endif
 	if (r) {
 		char *semi;
 		LOG(("failed to parse content-type '%s'", s));
diff -rNu netsurf/css/css.c netsurf.qnx4/css/css.c
--- netsurf/css/css.c	2010-03-04 19:44:06.403521547 +0300
+++ netsurf.qnx4/css/css.c	2010-02-21 10:45:56.000000000 +0300
@@ -17,6 +17,9 @@
  */
 
 #include <assert.h>
+#ifdef QNX4
+#include <unix.h>
+#endif
 
 #include <libwapcaplet/libwapcaplet.h>
 
diff -rNu netsurf/desktop/frames.c netsurf.qnx4/desktop/frames.c
--- netsurf/desktop/frames.c	2010-03-04 19:44:18.982521856 +0300
+++ netsurf.qnx4/desktop/frames.c	2010-03-04 20:31:09.000000000 +0300
@@ -264,8 +264,14 @@
  */
 
 void browser_window_recalculate_frameset(struct browser_window *bw) {
+#ifndef QNX4
 	int widths[bw->cols][bw->rows];
 	int heights[bw->cols][bw->rows];
+#else
+    int **widths;
+    int **heights;
+    char *_ptr;
+#endif
 	int bw_width, bw_height;
 	int avail_width, avail_height;
 	int row, row2, col, index;
@@ -276,6 +282,14 @@
 
 	assert(bw);
 
+#ifdef QNX4
+    _ptr = malloc(sizeof(int) * bw->cols * bw->rows * 2);
+    assert(_ptr);
+    widths = (int **)_ptr;
+    _ptr += sizeof(int) * bw->cols * bw->rows;
+    heights = (int **)_ptr;
+#endif
+
 	/* window dimensions */
 	if (!bw->parent) {
 		gui_window_get_dimensions(bw->window, &bw_width, &bw_height, false);
@@ -430,6 +444,9 @@
 				browser_window_recalculate_frameset(window);
 		}
 	}
+#ifdef QNX4
+	free(_ptr);
+#endif
 }
 
 
diff -rNu netsurf/desktop/history_core.c netsurf.qnx4/desktop/history_core.c
--- netsurf/desktop/history_core.c	2010-03-04 19:44:19.066521846 +0300
+++ netsurf.qnx4/desktop/history_core.c	2010-02-20 22:32:57.000000000 +0300
@@ -629,13 +629,23 @@
 	int tailsize = 5;
 	int xoffset = x - x0;
 	int yoffset = y - y0;
+#ifndef QNX4
         plot_style_t pstyle_history_rect = { 
             .stroke_type = PLOT_OP_TYPE_SOLID,
             .stroke_colour = c,
             .stroke_width = entry == history->current ? 2 : 1,
         };
+#else
+	plot_style_t pstyle_history_rect;
+#endif
 	plot_font_style_t fstyle = *plot_style_font;
 
+#ifdef QNX4
+	pstyle_history_rect.stroke_type = PLOT_OP_TYPE_SOLID;
+	pstyle_history_rect.stroke_colour = c;
+	pstyle_history_rect.stroke_width = entry == history->current ? 2 : 1;
+#endif
+
 	if (clip) {
 		if(!plot.clip(x0 + xoffset, y0 + yoffset, x1 + xoffset, y1 + yoffset))
 			return false;
diff -rNu netsurf/desktop/netsurf.c netsurf.qnx4/desktop/netsurf.c
--- netsurf/desktop/netsurf.c	2010-03-04 19:44:18.986528162 +0300
+++ netsurf.qnx4/desktop/netsurf.c	2010-02-20 22:41:14.000000000 +0300
@@ -97,7 +97,7 @@
 #endif
 
 #if !((defined(__SVR4) && defined(__sun)) || defined(__NetBSD__) || \
-	defined(__OpenBSD__) || defined(_WIN32)) 
+	defined(__OpenBSD__) || defined(_WIN32) || defined(QNX4))
 	stdout = stderr;
 #endif
 
diff -rNu netsurf/desktop/save_complete.c netsurf.qnx4/desktop/save_complete.c
--- netsurf/desktop/save_complete.c	2010-03-04 19:44:19.071544761 +0300
+++ netsurf.qnx4/desktop/save_complete.c	2010-02-21 20:02:58.000000000 +0300
@@ -30,7 +30,11 @@
 #include <stdio.h>
 #include <string.h>
 #include <sys/types.h>
+#ifndef QNX4
 #include <regex.h>
+#else
+#include "qnx4/gnu_regex.h"
+#endif
 #include <libxml/HTMLtree.h>
 #include <libxml/parserInternals.h>
 #include "utils/config.h"
@@ -348,7 +352,11 @@
 	int m;
 	unsigned int i;
 	unsigned int imports = 0;
+#ifndef QNX4
 	regmatch_t match[11];
+#else
+	gnu_regmatch_t match[11];
+#endif
 	url_func_result result;
 
 	/* count number occurences of @import to (over)estimate result size */
@@ -370,8 +378,13 @@
 	*osize = 0;
 
 	while (offset < size) {
+#ifndef QNX4
 		m = regexec(&save_complete_import_re, source + offset,
 				11, match, 0);
+#else
+		m = gnu_regexec(&save_complete_import_re, source + offset,
+				11, match, 0);
+#endif
 		if (m)
 			break;
 
diff -rNu netsurf/desktop/scroll.c netsurf.qnx4/desktop/scroll.c
--- netsurf/desktop/scroll.c	2010-03-04 19:44:18.896528945 +0300
+++ netsurf.qnx4/desktop/scroll.c	2010-02-21 00:24:54.000000000 +0300
@@ -210,6 +210,7 @@
 	int well_length, bar_off, bar_c0, bar_c1;
 	int v[6]; /* array of triangle vertices */
 	int x0, y0, x1, y1;
+#ifndef QNX4
 	plot_style_t pstyle_scroll_widget_bg_colour = {
 		.fill_type = PLOT_OP_TYPE_SOLID,
 		.fill_colour = scroll_widget_bg_colour,
@@ -222,6 +223,18 @@
 		.fill_type = PLOT_OP_TYPE_SOLID,
 		.fill_colour = scroll_widget_arrow_colour,
 	};
+#else
+	plot_style_t pstyle_scroll_widget_bg_colour;
+	plot_style_t pstyle_scroll_widget_fg_colour;
+	plot_style_t pstyle_scroll_widget_arrow_colour;
+
+	pstyle_scroll_widget_bg_colour.fill_type = PLOT_OP_TYPE_SOLID;
+	pstyle_scroll_widget_bg_colour.fill_colour = scroll_widget_bg_colour;
+	pstyle_scroll_widget_fg_colour.fill_type = PLOT_OP_TYPE_SOLID;
+	pstyle_scroll_widget_fg_colour.fill_colour = scroll_widget_fg_colour;
+	pstyle_scroll_widget_arrow_colour.fill_type = PLOT_OP_TYPE_SOLID;
+	pstyle_scroll_widget_arrow_colour.fill_colour = scroll_widget_arrow_colour;
+#endif
 
 	well_length = scroll->length - 2 * SCROLLBAR_WIDTH;
 	x0 = x;
diff -rNu netsurf/qnx4/gnu_regex.c netsurf.qnx4/qnx4/gnu_regex.c
--- netsurf/qnx4/gnu_regex.c	1970-01-01 03:00:00.000000000 +0300
+++ netsurf.qnx4/qnx4/gnu_regex.c	2010-02-21 19:56:05.000000000 +0300
@@ -0,0 +1,33 @@
+#include <stdlib.h>
+
+#include "qnx4/gnu_regex.h"
+
+int gnu_regexec( const regex_t *__preg, const char *__str,
+				 size_t __nmatch, gnu_regmatch_t *__gnu_pmatch, int __eflags )
+{
+	regmatch_t		*w__pmatch;
+	int				m;
+	int				i = 0;
+
+	w__pmatch = malloc(sizeof(*w__pmatch) * __nmatch);
+	if (w__pmatch == NULL)
+		return 1;
+
+	m = regexec(__preg, __str, __nmatch, w__pmatch, __eflags);
+	if (m)
+		return m;
+
+	while (i < __nmatch) {
+		if (w__pmatch[i].rm_sp == NULL)
+			__gnu_pmatch[i].rm_so = -1;
+		else
+			__gnu_pmatch[i].rm_so = w__pmatch[i].rm_sp - __str;
+		if (w__pmatch[i].rm_ep == NULL)
+			__gnu_pmatch[i].rm_eo = -1;
+		else
+			__gnu_pmatch[i].rm_eo = w__pmatch[i].rm_ep - __str;
+	}
+
+	return m;
+}
+
diff -rNu netsurf/qnx4/gnu_regex.h netsurf.qnx4/qnx4/gnu_regex.h
--- netsurf/qnx4/gnu_regex.h	1970-01-01 03:00:00.000000000 +0300
+++ netsurf.qnx4/qnx4/gnu_regex.h	2010-02-21 19:45:08.000000000 +0300
@@ -0,0 +1,18 @@
+#ifndef GNU_REGEX_H
+#define GNU_REGEX_H
+
+#include <regex.h>
+
+typedef int regoff_t;
+
+typedef struct
+{
+	regoff_t	rm_so;
+	regoff_t	rm_eo;
+} gnu_regmatch_t;
+
+
+int gnu_regexec( const regex_t *__preg, const char *__str,
+				 size_t __nmatch, gnu_regmatch_t *__gnu_pmatch, int __eflags );
+
+#endif
diff -rNu netsurf/render/box.c netsurf.qnx4/render/box.c
--- netsurf/render/box.c	2010-03-04 19:44:02.705536115 +0300
+++ netsurf.qnx4/render/box.c	2010-02-21 00:54:45.000000000 +0300
@@ -621,6 +621,10 @@
 {
 	unsigned int i;
 	struct box *c, *prev;
+#ifdef QNX4
+	static const char *box_type[] = {"UNKNOWN", "FIXED", "AUTO", "PERCENT", "RELATIVE"};
+	static const char *box_positioned[] = {"normal", "positioned"};
+#endif
 
 	for (i = 0; i != depth; i++)
 		fprintf(stream, "  ");
@@ -687,12 +691,17 @@
 		fprintf(stream, " (columns");
 		for (i = 0; i != box->columns; i++)
 			fprintf(stream, " (%s %s %i %i %i)",
+#ifndef QNX4
 					((const char *[]) {"UNKNOWN", "FIXED",
 					"AUTO", "PERCENT", "RELATIVE"})
 					[box->col[i].type],
 					((const char *[]) {"normal",
 					"positioned"})
 					[box->col[i].positioned],
+#else
+					box_type[box->col[i].type],
+					box_positioned[box->col[i].positioned?1:0],
+#endif
 					box->col[i].width,
 					box->col[i].min, box->col[i].max);
 		fprintf(stream, ")");
diff -rNu netsurf/render/directory.c netsurf.qnx4/render/directory.c
--- netsurf/render/directory.c	2010-03-04 19:44:02.662521773 +0300
+++ netsurf.qnx4/render/directory.c	2010-02-21 10:46:33.000000000 +0300
@@ -28,6 +28,9 @@
 #include <stdlib.h>
 #include <sys/stat.h>
 #include <time.h>
+#ifdef QNX4
+#include <unix.h>
+#endif
 #include "content/content.h"
 #include "render/directory.h"
 #include "render/html.h"
diff -rNu netsurf/render/html_redraw.c netsurf.qnx4/render/html_redraw.c
--- netsurf/render/html_redraw.c	2010-03-04 19:44:02.698522792 +0300
+++ netsurf.qnx4/render/html_redraw.c	2010-03-04 20:46:07.000000000 +0300
@@ -122,10 +122,17 @@
 	struct box *box;
 	bool result = true, want_knockout;
 	bool select, select_only;
+#ifndef QNX4
 	plot_style_t pstyle_fill_bg = {
 		.fill_type = PLOT_OP_TYPE_SOLID,
 		.fill_colour = background_colour,
 	};
+#else
+	plot_style_t pstyle_fill_bg;
+
+	pstyle_fill_bg.fill_type = PLOT_OP_TYPE_SOLID;
+	pstyle_fill_bg.fill_colour = background_colour;
+#endif
 
 	box = c->data.html.layout;
 	assert(box);
@@ -1559,10 +1566,17 @@
 	css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX;
 	struct box *parent;
 	css_color bgcol;
+#ifndef QNX4
 	plot_style_t pstyle_fill_bg = {
 		.fill_type = PLOT_OP_TYPE_SOLID,
 		.fill_colour = *background_colour,
 	};
+#else
+	plot_style_t pstyle_fill_bg;
+
+	pstyle_fill_bg.fill_type = PLOT_OP_TYPE_SOLID;
+	pstyle_fill_bg.fill_colour = *background_colour;
+#endif
 
 	if (html_redraw_printing && option_remove_backgrounds)
 		return true;
@@ -1771,10 +1785,17 @@
 	css_fixed hpos = 0, vpos = 0;
 	css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX;
 	css_color bgcol;
+#ifndef QNX4
 	plot_style_t pstyle_fill_bg = {
 		.fill_type = PLOT_OP_TYPE_SOLID,
 		.fill_colour = *background_colour,
 	};
+#else
+	plot_style_t pstyle_fill_bg;
+
+	pstyle_fill_bg.fill_type = PLOT_OP_TYPE_SOLID;
+	pstyle_fill_bg.fill_colour = *background_colour;
+#endif
 
 	plot_content = (box->background != NULL);
 
@@ -1956,10 +1977,17 @@
 		float scale, colour colour, float ratio)
 {
 	struct box *c;
+#ifndef QNX4
 	plot_style_t plot_style_box = {
 		.stroke_type = PLOT_OP_TYPE_SOLID,
 		.stroke_colour = colour,
 	};
+#else
+	plot_style_t plot_style_box;
+
+	plot_style_box.stroke_type = PLOT_OP_TYPE_SOLID;
+	plot_style_box.stroke_colour = colour;
+#endif
 
 	for (c = box->next;
 			c && c != box->inline_end;
@@ -1993,10 +2021,17 @@
 		float scale, colour colour, float ratio)
 {
 	struct box *c;
+#ifndef QNX4
 	plot_style_t plot_style_box = {
 		.stroke_type = PLOT_OP_TYPE_SOLID,
 		.stroke_colour = colour,
 	};
+#else
+	plot_style_t plot_style_box;
+
+	plot_style_box.stroke_type = PLOT_OP_TYPE_SOLID;
+	plot_style_box.stroke_colour = colour;
+#endif
 
 	/* draw through text descendants */
 	for (c = box->children; c; c = c->next) {
diff -rNu netsurf/render/hubbub_binding.c netsurf.qnx4/render/hubbub_binding.c
--- netsurf/render/hubbub_binding.c	2010-03-04 19:44:02.661522065 +0300
+++ netsurf.qnx4/render/hubbub_binding.c	2010-02-21 11:45:48.000000000 +0300
@@ -21,6 +21,9 @@
 #include <assert.h>
 #include <stdbool.h>
 #include <string.h>
+#ifdef QNX4
+#include <unix.h>
+#endif
 
 #include <libxml/HTMLparser.h>
 #include <libxml/HTMLtree.h>
@@ -769,7 +772,7 @@
 hubbub_error change_encoding(void *ctx, const char *charset)
 {
 	hubbub_ctx *c = (hubbub_ctx *) ctx;
-	uint32_t source;
+	hubbub_charset_source source;
 	const char *name;
 
 	/* If we have an encoding here, it means we are *certain* */
diff -rNu netsurf/render/list.c netsurf.qnx4/render/list.c
--- netsurf/render/list.c	2010-03-04 19:44:02.700521790 +0300
+++ netsurf.qnx4/render/list.c	2010-02-21 11:46:14.000000000 +0300
@@ -24,6 +24,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
+#ifdef QNX4
+#include <unix.h>
+#endif
 #include "css/css.h"
 #include "render/list.h"
 #include "utils/log.h"
diff -rNu netsurf/render/textplain.c netsurf.qnx4/render/textplain.c
--- netsurf/render/textplain.c	2010-03-04 19:44:02.664521888 +0300
+++ netsurf.qnx4/render/textplain.c	2010-02-21 18:34:13.000000000 +0300
@@ -143,7 +143,10 @@
 	union content_msg_data msg_data;
 
 	do {
-		char *inbuf = c->source_data + c->data.textplain.converted;
+#ifndef ICONVCONST
+#define ICONVCONST
+#endif
+		ICONVCONST char *inbuf = c->source_data + c->data.textplain.converted;
 		size_t inbytesleft = c->source_size -
 				c->data.textplain.converted;
 		char *outbuf = c->data.textplain.utf8_data +
diff -rNu netsurf/utils/config.h netsurf.qnx4/utils/config.h
--- netsurf/utils/config.h	2010-03-04 19:44:16.275526699 +0300
+++ netsurf.qnx4/utils/config.h	2010-02-21 11:28:04.000000000 +0300
@@ -26,7 +26,7 @@
 #define HAVE_STRNDUP
 #if defined(__FreeBSD__) || (defined(__SRV4) && defined(__sun)) || \
 	defined(__APPLE__) || defined(__HAIKU__) || defined(__BEOS__) \
-	|| defined(__OpenBSD__) || defined(_WIN32)
+	|| defined(__OpenBSD__) || defined(_WIN32) || defined(QNX4)
 	/* FreeBSD and Solaris do not have this function, so
 	 * we implement it ourselves in util.c
 	 */
@@ -36,7 +36,7 @@
 
 #define HAVE_STRCASESTR
 #if (!(defined(_GNU_SOURCE) || defined(__NetBSD__) || defined(__OpenBSD__)) \
-	|| defined(riscos) || defined(__APPLE__) || defined(_WIN32))
+	|| defined(riscos) || defined(__APPLE__) || defined(_WIN32) || defined(QNX4))
 #undef HAVE_STRCASESTR
 char *strcasestr(const char *haystack, const char *needle);
 #endif
diff -rNu netsurf/utils/talloc.c netsurf.qnx4/utils/talloc.c
--- netsurf/utils/talloc.c	2010-03-04 19:44:16.471522148 +0300
+++ netsurf.qnx4/utils/talloc.c	2010-02-21 18:41:17.000000000 +0300
@@ -64,6 +64,13 @@
 #include "talloc.h"
 #endif /* not _TALLOC_SAMBA3 */
 
+#ifdef QNX4
+#include <string.h>
+#include <unix.h>
+#define HAVE_VA_COPY
+#include <va_copy.h>
+#endif
+
 /* use this to force every realloc to change the pointer, to stress test
    code that might not cope */
 #define ALWAYS_REALLOC 0
diff -rNu netsurf/utils/url.c netsurf.qnx4/utils/url.c
--- netsurf/utils/url.c	2010-03-04 19:44:16.467530579 +0300
+++ netsurf.qnx4/utils/url.c	2010-03-04 20:53:45.000000000 +0300
@@ -30,7 +30,11 @@
 #include <stdlib.h>
 #include <string.h>
 #include <strings.h>
+#ifndef QNX4
 #include <regex.h>
+#else
+#include "qnx4/gnu_regex.h"
+#endif
 #include <unistd.h>
 #include "curl/curl.h"
 #include "utils/log.h"
@@ -136,7 +140,11 @@
 	size_t bufsize;
 	char* norm;
 	bool http = false;
+#ifndef QNX4
 	regmatch_t match[10];
+#else
+	gnu_regmatch_t match[10];
+#endif
 
 	*result = NULL;
 
@@ -179,7 +187,11 @@
 
 	/* finally verify that it's actually an URL we're working on
 	 * (RFC regex too fussy to tolerate above WSP problems) */
+#ifndef QNX4
 	if (regexec(&url_re, norm, 10, match, 0)) {
+#else
+	if (gnu_regexec(&url_re, norm, 10, match, 0)) {
+#endif
 		LOG(("url '%s' failed to match regex", url));
 		free(norm);
 		*result = NULL;
@@ -191,7 +203,11 @@
 		memmove(norm + SLEN("http://";), norm, len + 1);
 		memcpy(norm, "http://";, SLEN("http://";)); /* do NOT copy NUL */
 		len += SLEN("http://";);
+#ifndef QNX4
 		if (regexec(&url_re, norm, 10, match, 0)) {
+#else
+		if (gnu_regexec(&url_re, norm, 10, match, 0)) {
+#endif
 			LOG(("url '%s' failed to match regex", norm));
 			free(norm);
 			*result = NULL;
@@ -806,14 +822,22 @@
 		bool remove_extensions)
 {
 	int m;
+#ifndef QNX4
 	regmatch_t match[10];
+#else
+	gnu_regmatch_t match[10];
+#endif
 	regoff_t start, end;
 	size_t i;
 	char *dot;
 
 	*result = 0;
 
+#ifndef QNX4
 	m = regexec(&url_re, url, 10, match, 0);
+#else
+	m = gnu_regexec(&url_re, url, 10, match, 0);
+#endif
 	if (m) {
 		LOG(("url '%s' failed to match regex", url));
 		return URL_FUNC_FAILED;
diff -rNu netsurf/utils/useragent.c netsurf.qnx4/utils/useragent.c
--- netsurf/utils/useragent.c	2010-03-04 19:44:16.466541138 +0300
+++ netsurf.qnx4/utils/useragent.c	2010-02-21 20:10:08.000000000 +0300
@@ -19,6 +19,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef QNX4
+#include <unix.h>
+#endif
 
 #include "utils/config.h"
 #include "utils/utsname.h"
diff -rNu netsurf/utils/utf8.c netsurf.qnx4/utils/utf8.c
--- netsurf/utils/utf8.c	2010-03-04 19:44:16.475535788 +0300
+++ netsurf.qnx4/utils/utf8.c	2010-02-21 20:09:23.000000000 +0300
@@ -225,6 +225,9 @@
 	return utf8_convert(string, len, encname, "UTF-8", result);
 }
 
+#ifndef ICONVCONST
+#define ICONVCONST
+#endif
 /**
  * Convert a string from one encoding to another
  *
@@ -239,7 +242,8 @@
 		const char *from, const char *to, char **result)
 {
 	iconv_t cd;
-	char *temp, *out, *in;
+	char *temp, *out;
+	ICONVCONST char *in;
 	size_t slen, rlen;
 
 	assert(string && from && to && result);
diff -rNu netsurf/utils/utils.h netsurf.qnx4/utils/utils.h
--- netsurf/utils/utils.h	2010-03-04 19:44:16.275526699 +0300
+++ netsurf.qnx4/utils/utils.h	2010-02-21 11:41:09.000000000 +0300
@@ -26,6 +26,9 @@
 #include <sys/types.h>
 #include <regex.h>
 #include <assert.h>
+#ifdef QNX4
+#include <unix.h>
+#endif
 
 #ifndef NOF_ELEMENTS
 #define NOF_ELEMENTS(array) (sizeof(array)/sizeof(*(array)))
@@ -43,10 +46,14 @@
 #define PRIxPTR "x"
 #endif
 
-#if defined(__HAIKU__) || defined(__BEOS__)
+#if defined(__HAIKU__) || defined(__BEOS__) || defined(QNX4)
 #define strtof(s,p) ((float)(strtod((s),(p))))
 #endif
 
+#if defined(QNX4)
+#define ceilf(s) ((float)(ceil((s))))
+#endif
+
 /**
  * Calculate length of constant C string.
  *

Reply via email to