Index: maker/__forkpty.c
--- maker/__forkpty.c.orig	2007-06-12 08:17:50 +0200
+++ maker/__forkpty.c	2009-03-15 10:19:26 +0100
@@ -6,8 +6,12 @@
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <termios.h>
+#if defined(__NetBSD__)
+#include <util.h>
+#else
 #include <libutil.h>
 #endif
+#endif
 
 int _Forkpty(int *pty,char *name){
 	int pid;
Index: src/Makefile
--- src/Makefile.orig	2009-03-03 03:33:26 +0100
+++ src/Makefile	2009-03-15 10:22:41 +0100
@@ -289,7 +289,7 @@
 SUBIN = subin
 #endif #############
 #ifdef UNIX,OS2EMX ################################################
-CFLAGSPLUS =	if(WITHCPLUS,UNIX,OS2EMX) -x c++ -DQS
+CFLAGSPLUS =	if(WITHCPLUS,UNIX,OS2EMX)
 DGEXE =		./dg.exe
 COPY =		cp -f -p
 CFLAGS =	if(UNIX,OS2EMX) -O2
Index: src/X.c
--- src/X.c.orig	2007-10-29 09:43:06 +0100
+++ src/X.c	2009-03-15 10:19:26 +0100
@@ -25,6 +25,13 @@
 #include "delegate.h"
 #include "fpoll.h"
 #include "proc.h"
+
+/* #undef CS unconditionally
+ * real problem exists under Solaris (10) that defines CS in
+ * /usr/include/sys/ucontext.h which is included together with stdlib.h
+ */
+#undef CS
+
 void DBGMSG(PCStr(fmt),...);
 
 static jmp_buf tel_env;
Index: src/dget.c
--- src/dget.c.orig	2008-12-06 22:45:07 +0100
+++ src/dget.c	2009-03-15 10:19:26 +0100
@@ -39,6 +39,12 @@
 const char *DELEGATE_getEnv(PCStr(name));
 char *fgetsTIMEOUT(xPVStr(b),int s,FILE *fp);
 
+/* #undef ERR unconditionally
+ * real problem exists under Solaris (10) that defines ERR in
+ * /usr/include/sys/regset.h which is included together with stdlib.h
+ */
+#undef ERR
+
 const char *strid_find(int tab,int hx,int id);
 int connect2server(Connection *Conn,PCStr(proto),PCStr(host),int port);
 
Index: src/smtpgate.c
--- src/smtpgate.c.orig	2009-01-19 05:24:58 +0100
+++ src/smtpgate.c	2009-03-15 10:19:26 +0100
@@ -53,6 +53,12 @@
 #include "file.h"
 #include "auth.h"
 
+/* #undef FS unconditionally 
+ * real problem exists under Solaris (10) that defines FS in
+ * /usr/include/sys/ucontext.h which is included together with stdlib.h
+ */
+#undef FS
+
 #define LNSIZE  1024
 #define lfprintf	SMTP_lfprintf
 void SMTP_lfprintf(FILE *log,FILE *tosc,PCStr(fmt),...);
Index: src/telnet.c
--- src/telnet.c.orig	2008-12-14 10:33:10 +0100
+++ src/telnet.c	2009-03-15 10:19:26 +0100
@@ -29,6 +29,12 @@
 #include "auth.h"
 #include "proc.h"
 
+/* #undef CS unconditionally
+ * real problem exists under Solaris (10) that defines CS in
+ * /usr/include/sys/ucontext.h which is included together with stdlib.h
+ */
+#undef CS
+
 extern int IO_TIMEOUT;
 
 int connectToSsh(Connection *Conn,const char *host,int port,PCStr(user),PCStr(pass));
Index: src/textconv.c
--- src/textconv.c.orig	2009-01-19 05:49:47 +0100
+++ src/textconv.c	2009-03-15 10:19:26 +0100
@@ -695,7 +695,7 @@
 
 int *ccx_global;
 
-void setCCX(Connection *Conn,PVStr(code),PVStr(stat))
+static void local_setCCX(Connection *Conn,PVStr(code),PVStr(stat))
 {	const char *st;
 	int thru = 0;
 
@@ -731,7 +731,7 @@
 }
 void global_setCCX(Connection *Conn,PVStr(code),PVStr(stat))
 {
-	setCCX(Conn,AVStr(code),AVStr(stat));
+	local_setCCX(Conn,AVStr(code),AVStr(stat));
 	ccx_global = (int*)CCX0;
 }
 
Index: src/urlfind.c
--- src/urlfind.c.orig	2006-03-16 09:07:57 +0100
+++ src/urlfind.c	2009-03-15 10:19:26 +0100
@@ -25,6 +25,12 @@
 #include "ystring.h"
 #include "dglib.h"
 
+/* #undef ERR unconditionally
+ * real problem exists under Solaris (10) that defines ERR in
+ * /usr/include/sys/regset.h which is included together with stdlib.h
+ */
+#undef ERR
+
 static const char *usage = "\
 Usage: urlfind URL\n\
     -- Find recursively in URL space.\n\
Index: teleport/vehicle.c
--- teleport/vehicle.c.orig	2006-02-08 11:25:36 +0100
+++ teleport/vehicle.c	2009-03-15 10:19:26 +0100
@@ -22,6 +22,12 @@
 #include <stdio.h>
 #include "teleport.h"
 
+/* #undef ERR unconditionally
+ * real problem exists under Solaris (10) that defines ERR in
+ * /usr/include/sys/regset.h which is included together with stdlib.h
+ */
+#undef ERR
+
 #define TP_INVITE	"INVITE"
 #define TP_ROUTE	"ROUTE"
 #define IMSIZE	(1024*8)
