Pastey sunos.patch corrected

--- ~/open_euphoria/euphoria/docs/e2c.txt	Wed Sep 27 00:22:47 2017
+++ ~/open_euphoria_sun/euphoria/docs/e2c.txt	Wed Sep 27 00:23:45 2017 
@@ -269,6 +269,7 @@ 
 * FREEBSD 
 * LINUX 
 * OSX 
+* SUN 
 * WINDOWS 
 * NETBSD 
 * OPENBSD 
--- ~/open_euphoria/euphoria/docs/platform.txt	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/docs/platform.txt	Wed Sep 27 00:23:45 2017 
@@ -21,6 +21,9 @@ 
 operating system. It is very popular on  Internet server machines. It's 
 also open source. 
  
+**SunOS**. SunOS is a Unix-branded operating system. 
+Free and open-source versions based on OpenSolaris are available. 
+ 
 Apple's **OS X**. OS X is also based on the UNIX 
 operating system. While it is closed source, it is gaining a wide 
 following due to it's ease of use and power. 
@@ -79,6 +82,8 @@ 
        -- Windows code 
     case LINUX then 
        -- LINUX code 
+    case SUN then 
+       -- SUN code 
     case FREEBSD,NETBSD then 
        -- BSD code 
        ... etc 
@@ -94,6 +99,8 @@ 
   -- Windows code 
 elsifdef LINUX then 
   -- LINUX code 
+elsifdef SUN then 
+  -- SUN code 
 elsifdef FREEBSD or NETBSD then 
   -- BSD code 
 elsedef 
--- ~/open_euphoria/euphoria/docs/refman_2.txt	Wed Sep 27 00:22:46 2017 
+++ ~/open_euphoria_sun/euphoria/docs/refman_2.txt	Wed Sep 27 00:23:45 2017 
@@ -2813,6 +2813,7 @@ 
 * **WINDOWS** - Platform is Windows (GUI or Console) 
 * **LINUX** - Platform is Linux 
 * **OSX** - Platform is Mac OS X 
+* **SUN** - Platform is SunOS 
 * **FREEBSD** - Platform is FreeBSD 
 * **OPENBSD** - Platform is OpenBSD 
 * **NETBSD** - Platform is NetBSD 
@@ -4130,6 +4131,7 @@ 
 * UNIX:     platform is any kind of Unix style system 
 * LINUX:    platform is Linux 
 * FREEBSD:  platform is FreeBSD 
+* SUN:      platform is SunOS 
 * OSX:      platform is OS X for Macintosh 
 * SAFE:     turns on a slower debugging version of ##memory.e## called 
             ##safe.e## when defined. Switching mode by renaming files **//no longer works//**. 
--- ~/open_euphoria/euphoria/docs/using_euphoria.txt	Wed Sep 27 00:22:46 2017 
+++ ~/open_euphoria_sun/euphoria/docs/using_euphoria.txt	Wed Sep 27 00:23:45 2017 
@@ -532,7 +532,7 @@ 
 ; ##-PLAT word## (translator) 
 : Specify the target platform for translation.  This allows euphoria code to 
   be translated for any supported platform from any other supported platform. 
-  Supported platforms: FREEBSD, LINUX, NETBSD, OPENBSD, OSX, WINDOWS 
+  Supported platforms: FREEBSD, LINUX, NETBSD, OPENBSD, OSX, SUN, WINDOWS 
  
 ; ##-STRICT## (all) 
 : This turns on all warnings, overriding any with/without warning statement 
--- ~/open_euphoria/euphoria/docs/man/euc.1	Wed Sep 27 00:22:46 2017 
+++ ~/open_euphoria_sun/euphoria/docs/man/euc.1	Wed Sep 27 00:23:45 2017 
@@ -234,7 +234,7 @@ 
 Set the output filename 
 .TP 
 .B \-plat platform 
-Set the platform for the translated code.  Valid options are: WINDOWS, LINUX, FREEBSD, OSX, OPENBSD, NETBSD 
+Set the platform for the translated code.  Valid options are: WINDOWS, LINUX, FREEBSD, OSX, OPENBSD, NETBSD, SUN 
 .TP 
 .B \-silent  
 Do not Display status messages 
--- ~/open_euphoria/euphoria/include/euphoria/info.e	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/include/euphoria/info.e	Wed Sep 27 00:23:45 2017 
@@ -51,6 +51,8 @@ 
 		return "Linux" 
 	elsifdef OSX then 
 		return "OS X" 
+	elsifdef SUN then 
+		return "SunOS" 
 	elsifdef FREEBSD then 
 		return "FreeBSD" 
 	elsifdef OPENBSD then 
--- ~/open_euphoria/euphoria/include/std/filesys.e	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/include/std/filesys.e	Wed Sep 27 00:23:45 2017 
@@ -2300,6 +2300,18 @@ 
 					SIZEOF_STAT     = 144, 
 					$ 
 			end ifdef 
+		elsifdef SUN then 
+			ifdef BITS32 then 
+				constant 
+					STAT_ST_BLKSIZE = 80, 
+					SIZEOF_STAT     = 136, 
+					$ 
+			elsedef 
+				constant 
+					STAT_ST_BLKSIZE = 96, 
+					SIZEOF_STAT     = 128, 
+					$ 
+			end ifdef 
 		elsifdef FREEBSD then 
 			ifdef BITS32 then 
 				constant 
@@ -2322,8 +2334,8 @@ 
 				STAT_ST_BLKSIZE = 80, 
 				SIZEOF_STAT     = 100, 
 				$ 
-			stat_t_offset = 80 
-			stat_buf_size = 100 
+			--stat_t_offset = 80 
+			--stat_buf_size = 100 
 		end ifdef 
 end ifdef 
  
--- ~/open_euphoria/euphoria/include/std/machine.e	Wed Sep 27 00:22:46 2017 
+++ ~/open_euphoria_sun/euphoria/include/std/machine.e	Wed Sep 27 00:23:45 2017 
@@ -186,7 +186,11 @@ 
     ifdef OSX or BSD then 
         --** 
         -- @nodoc@ 
+        ifdef SUN then 
+            export constant MAP_ANONYMOUS = 0x100 
+        elsedef 
         export constant MAP_ANONYMOUS = 0x1000 
+        end ifdef 
     elsedef 
         export constant MAP_ANONYMOUS = 32 
     end ifdef 
--- ~/open_euphoria/euphoria/include/std/os.e	Wed Sep 27 00:22:46 2017 
+++ ~/open_euphoria_sun/euphoria/include/std/os.e	Wed Sep 27 00:23:45 2017 
@@ -36,6 +36,7 @@ 
 	WINDOWS = WIN32, 
 	LINUX, 
 	OSX, 
+	SUN, 
 	OPENBSD = 6, 
 	NETBSD, 
 	FREEBSD 
@@ -47,6 +48,7 @@ 
 -- * ##LINUX##   ~-- Host operating system is Linux 
 -- * ##FREEBSD## ~-- Host operating system is FreeBSD 
 -- * ##OSX##     ~-- Host operating system is Mac OS X 
+-- * ##SUN##     ~-- Host operating system is SunOS 
 -- * ##OPENBSD## ~-- Host operating system is OpenBSD 
 -- * ##NETBSD##  ~-- Host operating system is NetBSD 
 -- 
@@ -327,8 +329,8 @@ 
 -- public constant 
 --     WIN32 = WINDOWS, 
 --     LINUX, 
---     FREEBSD, 
 --     OSX, 
+--     SUN, 
 --	   OPENBSD, 
 --     NETBSD, 
 --     FREEBSD 
--- ~/open_euphoria/euphoria/packaging/source/Makefile	Wed Sep 27 00:22:46 2017 
+++ ~/open_euphoria_sun/euphoria/packaging/source/Makefile	Wed Sep 27 00:23:45 2017 
@@ -1,7 +1,7 @@ 
 include Makefile.eu 
  
  
-all : linux windows osx freebsd openbsd netbsd 
+all : linux windows osx freebsd openbsd netbsd sun 
  
 linux :  
 	$(MAKE) source-tarball PLATFORM=LINUX ARCH=x86 
@@ -27,6 +27,10 @@ 
 	$(MAKE) source-tarball PLATFORM=NETBSD ARCH=x86 
 	$(MAKE) source-tarball PLATFORM=NETBSD ARCH=x86_64 
  
+sun : 
+	$(MAKE) source-tarball PLATFORM=SUN ARCH=x86 
+	$(MAKE) source-tarball PLATFORM=SUN ARCH=x86_64 
+ 
 clean : 
 	-rm -r LINUX-x86 
 	-rm -r WINDOWS 
@@ -34,6 +38,7 @@ 
 	-rm -r FREEBSD 
 	-rm -r OPENBSD 
 	-rm -r NETBSD 
+	-rm -r SUN 
 	-rm -r LINUX-x86_64 
 	-rm -r WINDOWS-x86_64 
 	-rm -r OSX-x86_64 
@@ -40,6 +45,7 @@ 
 	-rm -r FREEBSD-x86_64 
 	-rm -r OPENBSD-x86_64 
 	-rm -r NETBSD-x86_64 
+	-rm -r SUN-x86_64 
  
 $(PLATFORM)-$(ARCH) : 
 	mkdir $(PLATFORM)-$(ARCH) 
@@ -50,4 +56,4 @@ 
 	make -C $(PLATFORM)-$(ARCH) clean 
 	make -C $(PLATFORM)-$(ARCH) source-tarball -j2 VERSION=$(VERSION) 
  
-.PHONY : linux windows osx freebsd openbsd netbsds all clean 
+.PHONY : linux windows osx freebsd openbsd netbsd sun all clean 
--- ~/open_euphoria/euphoria/packaging/unix/Makefile	Wed Sep 27 00:22:46 2017 
+++ ~/open_euphoria_sun/euphoria/packaging/unix/Makefile	Wed Sep 27 00:23:45 2017 
@@ -16,6 +16,8 @@ 
 OS=Linux 
 else ifeq "$(EOSX)" "1" 
 OS=OSX 
+else ifeq "$(ESUN)" "1" 
+OS=SunOS 
 else ifeq "$(EOPENBSD)" "1" 
 OS=OpenBSD 
 else ifeq "$(ENETBSD)" "1" 
--- ~/open_euphoria/euphoria/source/Makefile.gnu	Wed Sep 27 00:22:46 2017 
+++ ~/open_euphoria_sun/euphoria/source/Makefile.gnu	Wed Sep 27 00:23:45 2017 
@@ -83,6 +83,10 @@ 
     LDLFLAG=-lresolv 
     EBSDFLAG=-DEBSD -DEBSD62 -DEOSX 
   endif 
+  ifeq "$(ESUN)" "1" 
+    LDLFLAG=-lresolv -lnsl -lsocket 
+    EBSDFLAG=-DESUN 
+  endif 
   ifeq "$(EOPENBSD)" "1" 
     EBSDFLAG=-DEBSD -DEBSD62 -DEOPENBSD 
   endif 
@@ -241,6 +245,8 @@ 
     PLAT=FREEBSD 
 else ifeq "$(EOSX)" "1" 
     PLAT=OSX 
+else ifeq "$(ESUN)" "1" 
+    PLAT=SUN 
 else ifeq "$(EMINGW)" "1" 
     PLAT=WINDOWS 
 endif 
@@ -428,21 +434,14 @@ 
  
  
 BUILD_DIRS=\ 
-	$(BUILDDIR)/intobj/back/ \ 
-	$(BUILDDIR)/transobj/back/ \ 
-	$(BUILDDIR)/libobj/back/ \ 
-	$(BUILDDIR)/libobjdbg \ 
-	$(BUILDDIR)/libobjdbg/back/ \ 
-	$(BUILDDIR)/backobj/back/ \ 
-	$(BUILDDIR)/intobj/ \ 
-	$(BUILDDIR)/transobj/ \ 
-	$(BUILDDIR)/libobj/ \ 
-	$(BUILDDIR)/backobj/ \ 
-	$(BUILDDIR)/include/ \ 
-	$(BUILDDIR)/libobj-fPIC/ \ 
+	$(BUILDDIR)/backobj/back \ 
+	$(BUILDDIR)/include \ 
+	$(BUILDDIR)/intobj/back \ 
 	$(BUILDDIR)/libobj-fPIC/back \ 
-	$(BUILDDIR)/libobjdbg-fPIC \ 
-	$(BUILDDIR)/libobjdbg-fPIC/back 
+	$(BUILDDIR)/libobj/back \ 
+	$(BUILDDIR)/libobjdbg-fPIC/back \ 
+	$(BUILDDIR)/libobjdbg/back \ 
+	$(BUILDDIR)/transobj/back 
  
  
 clean : 	 
--- ~/open_euphoria/euphoria/source/be_execute.c	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/source/be_execute.c	Wed Sep 27 00:23:45 2017 
@@ -5018,6 +5018,9 @@ 
 #ifdef EOSX 
 				top = 4;  // OSX 
 #endif 
+#ifdef ESUN 
+				top = 5;  // SunOS 
+#endif 
 #ifdef EOPENBSD 
 				top = 6; // OpenBSD 
 #endif 
--- ~/open_euphoria/euphoria/source/be_machine.c	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/source/be_machine.c	Wed Sep 27 00:23:45 2017 
@@ -66,6 +66,12 @@ 
 #endif  
 #endif 
  
+// Same workaround for SUN 
+#ifdef ESUN 
+#ifndef INFINITY 
+#define INFINITY (1.0/0.0) 
+#endif  
+#endif 
  
 #include <sys/mman.h> 
  
@@ -3127,6 +3133,9 @@ 
 #ifdef EOSX 
 				return 4; 
 #else 
+#ifdef ESUN 
+				return 5; 
+#else 
 #ifdef EBSD // FreeBSD by this point 
 				return 8; 
 #else 
@@ -3140,6 +3149,7 @@ 
 #endif // EWINDOWS 
 #endif // ELINUX 
 #endif // EBSD 
+#endif // ESUN 
 #endif // EOSX 
 #endif // EOPENBSD 
 #endif // ENETBSD 
--- ~/open_euphoria/euphoria/source/be_main.c	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/source/be_main.c	Wed Sep 27 00:23:45 2017 
@@ -25,8 +25,12 @@ 
 #  ifdef EBSD 
 #    include <limits.h> 
 #  else 
+#    ifdef ESUN 
+#      include <limits.h> 
+#    else 
 #    include <linux/limits.h> 
 #  endif 
+#  endif 
 #  include <sys/types.h> 
 #  include <sys/stat.h> 
 #else 
--- ~/open_euphoria/euphoria/source/be_rterror.c	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/source/be_rterror.c	Wed Sep 27 00:23:45 2017 
@@ -33,6 +33,10 @@ 
 #include <unistd.h> 
 #endif 
  
+#ifdef ESUN 
+#include <sys/termios.h> 
+#endif 
+ 
 #include <signal.h> 
 #include <string.h> 
 #ifdef EWINDOWS 
--- ~/open_euphoria/euphoria/source/be_socket.c	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/source/be_socket.c	Wed Sep 27 00:23:45 2017 
@@ -9,6 +9,7 @@ 
 #endif 
 #include <stdio.h> 
 #include <stdlib.h> 
+#include <string.h> 
  
 #ifdef EUNIX 
 #ifndef timeval 
--- ~/open_euphoria/euphoria/source/buildsys.e	Wed Sep 27 00:22:46 2017 
+++ ~/open_euphoria_sun/euphoria/source/buildsys.e	Wed Sep 27 00:23:45 2017 
@@ -517,6 +517,8 @@ 
  
 			if TLINUX then 
 				l_flags &= " -ldl -lm -lpthread" 
+			elsif TSUN then 
+				l_flags &= " -lm -lpthread -lresolv -lnsl -lsocket" 
 			elsif TBSD then 
 				l_flags &= " -lm -lpthread" 
 			elsif TOSX then 
--- ~/open_euphoria/euphoria/source/configure	Wed Sep 27 00:22:46 2017 
+++ ~/open_euphoria_sun/euphoria/source/configure	Wed Sep 27 00:23:45 2017 
@@ -70,6 +70,10 @@ 
 	HOST_ARCH=ix86 
 	MFLAG=-m32 
 	 
+elif echo "$UNAME_MACHINE" | grep "i86pc" > /dev/null; then 
+	HOST_ARCH=ix86 
+	MFLAG=-m32 
+	 
 elif echo "$UNAME_MACHINE" | egrep "x86_64|amd64" > /dev/null; then 
 	HOST_ARCH=ix86_64 
 	MFLAG=-m64 
@@ -98,6 +102,10 @@ 
 	EHOST=FREEBSD 
 	TARGET=EFREEBSD 
 	EBSD=1 
+elif test $UNAME_SYSTEM = "SunOS"; then 
+	EHOST=ESUN 
+	TARGET=ESUN 
+	EBSD=1 
 # OS X > 10.4 (Darwin version 8 and up) supports 64-bit applications. 
 elif test $UNAME_SYSTEM = "Darwin"; then 
 	EHOST=EOSX 
@@ -381,7 +389,7 @@ 
 		echo "   --target value or --plat value" 
 		echo "                       Set the OS that we will translate to." 
 		echo "                       Values can be: WINDOWS, OSX, LINUX," 
-		echo "                       FREEBSD, OPENBSD or NETBSD." 
+		echo "                       SUN, FREEBSD, OPENBSD or NETBSD." 
 		echo "   --watcom            The translator will create C code" 
 		echo "                       for the Watcom compiler." 
 		echo "   --cc-prefix         Prefix to use with the compiler and" 
@@ -445,6 +453,8 @@ 
 	EFREEBSD=1 
 elif [ "$TARGET" = "EOSX" ]; then 
 	EOSX=1 
+elif [ "$TARGET" = "ESUN" ]; then 
+	ESUN=1 
 elif [ "$TARGET" = "ELINUX" ]; then 
 	ELINUX=1 
 elif [ "$TARGET" = "EWINDOWS" ]; then 
@@ -474,6 +484,7 @@ 
 [ -n "$EOPENBSD" ] && echo EOPENBSD="$EOPENBSD" >> "$PREFIX"${CONFIG_FILE} 
 [ -n "$ENETBSD" ]  && echo ENETBSD="$ENETBSD" >> "$PREFIX"${CONFIG_FILE} 
 [ -n "$EOSX" ] && echo EOSX="$EOSX" >> "$PREFIX"${CONFIG_FILE} 
+[ -n "$ESUN" ] && echo ESUN="$ESUN" >> "$PREFIX"${CONFIG_FILE} 
 [ -n "$ELINUX" ] && echo ELINUX="$ELINUX" >> "$PREFIX"${CONFIG_FILE} 
 [ -n "$EMINGW" ] && echo EMINGW="$EMINGW" >> "$PREFIX"${CONFIG_FILE} 
  
--- ~/open_euphoria/euphoria/source/execute.h	Wed Sep 27 00:22:46 2017 
+++ ~/open_euphoria_sun/euphoria/source/execute.h	Wed Sep 27 00:23:45 2017 
@@ -258,7 +258,11 @@ 
 #ifdef EBSD 
 #include <limits.h> 
 #else 
-#include <linux/limits.h> 
+#  ifdef ESUN 
+#    include <limits.h> 
+#  else 
+#    include <linux/limits.h> 
+#  endif 
 #endif 
 #else 
 #include <limits.h> 
--- ~/open_euphoria/euphoria/source/global.e	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/source/global.e	Wed Sep 27 00:23:45 2017 
@@ -48,6 +48,8 @@ 
 	version_name = "NetBSD" 
 elsifdef OSX then 
 	version_name = "Mac OS X" 
+elsifdef SUN then 
+	version_name = "SunOS" 
 elsifdef FREEBSD then 
 	version_name = "FreeBSD" 
 elsifdef UNIX then  --should never happen 
--- ~/open_euphoria/euphoria/source/platform.e	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/source/platform.e	Wed Sep 27 00:23:45 2017 
@@ -21,6 +21,7 @@ 
 	ULINUX = LINUX, 
 	UFREEBSD = FREEBSD, 
 	UOSX = OSX, 
+	USUN = SUN, 
 	UOPENBSD = OPENBSD, 
 	UNETBSD = NETBSD, 
 	DEFAULT_EXTS = { ".ex", ".exw", "", ".ex" } 
@@ -32,6 +33,7 @@ 
 	IUNIX    = 0, TUNIX    = 0, 
 	IBSD     = 0, TBSD     = 0, 
 	IOSX     = 0, TOSX     = 0, 
+	ISUN     = 0, TSUN     = 0, 
 	IOPENBSD = 0, TOPENBSD = 0, 
 	INETBSD  = 0, TNETBSD  = 0, 
 	IX86     = 0, TX86     = 0, 
@@ -48,6 +50,10 @@ 
 	IOSX = 1 
 	TOSX = 1 
  
+elsifdef SUN then 
+	ISUN = 1 
+	TSUN = 1 
+ 
 elsifdef FREEBSD then 
 	IBSD = 1 
 	TBSD = 1 
@@ -66,7 +72,7 @@ 
  
 end ifdef 
  
-ifdef OSX or FREEBSD or OPENBSD or NETBSD then 
+ifdef OSX or FREEBSD or OPENBSD or NETBSD or SUN then 
 	IBSD = 1 
 	TBSD = 1 
 end ifdef 
@@ -113,7 +119,7 @@ 
 	return ihost_platform 
 end function 
  
-sequence unices = { ULINUX, UFREEBSD, UOSX, UOPENBSD, UNETBSD } 
+sequence unices = { ULINUX, UFREEBSD, UOSX, UOPENBSD, UNETBSD, USUN } 
  
 public procedure set_host_platform(atom plat) 
 	ihost_platform = floor(plat) 
@@ -122,6 +128,7 @@ 
 	TWINDOWS = (ihost_platform = WIN32) 
 	TBSD     = (ihost_platform = UFREEBSD) 
 	TOSX     = (ihost_platform = UOSX) 
+	TSUN     = (ihost_platform = USUN) 
 	TLINUX   = (ihost_platform = ULINUX) 
 	TOPENBSD = (ihost_platform = UOPENBSD) 
 	TNETBSD  = (ihost_platform = UNETBSD) 
@@ -129,6 +136,7 @@ 
 	IWINDOWS = TWINDOWS 
 	IBSD     = TBSD 
 	IOSX     = TOSX 
+	ISUN     = TSUN 
 	ILINUX   = TLINUX 
 	IOPENBSD = TOPENBSD 
 	INETBSD  = TNETBSD 
@@ -231,6 +239,8 @@ 
 			local_defines &= {"UNIX", "LINUX"} 
 		elsif (IOSX and not for_translator) or (TOSX and for_translator) then 
 			local_defines &= {"UNIX", "BSD", "OSX"} 
+		elsif (ISUN and not for_translator) or (TSUN and for_translator) then 
+			local_defines &= {"UNIX", "BSD", "SUN"} 
 		elsif (IOPENBSD and not for_translator) or (TOPENBSD and for_translator) then 
 			local_defines &= { "UNIX", "BSD", "OPENBSD"} 
 		elsif (INETBSD and not for_translator) or (TNETBSD and for_translator) then 
--- ~/open_euphoria/euphoria/source/traninit.e	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/source/traninit.e	Wed Sep 27 00:23:45 2017 
@@ -187,6 +187,9 @@ 
 					case "OSX" then 
 						set_host_platform( UOSX ) 
  
+					case "SUN" then 
+						set_host_platform( USUN ) 
+ 
 					case "OPENBSD" then 
 						set_host_platform( UOPENBSD ) 
  
@@ -194,7 +197,7 @@ 
 						set_host_platform( UNETBSD ) 
  
 					case else 
-						ShowMsg(2, UNKNOWN_PLATFORM_1__SUPPORTED_PLATFORMS_ARE_2, { val, "WINDOWS, LINUX, FREEBSD, OSX, OPENBSD, NETBSD" }) 
+						ShowMsg(2, UNKNOWN_PLATFORM_1__SUPPORTED_PLATFORMS_ARE_2, { val, "WINDOWS, LINUX, FREEBSD, OSX, SUN, OPENBSD, NETBSD" }) 
 						abort(1) 
 				end switch 
  
--- ~/open_euphoria/euphoria/tests/check_diffs.sh	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/tests/check_diffs.sh	Wed Sep 27 00:23:45 2017 
@@ -6,8 +6,8 @@ 
 # will implement SAFE behavior for std/machine.e if not memory.e will implement faster behavior 
 # for std/machine.e. 
 # 
-egrep 'export ' ../include/std/safe.e | sort | awk -F '(' '{ print $1; }' | awk -F '=' '{ print $1;}' > exported_from_safe.txt  
-egrep 'export ' ../include/std/memory.e | sort | awk -F '(' '{ print $1; }' | awk -F '=' '{ print $1;}' > exported_from_memory.txt 
+egrep 'export ' ../include/std/safe.e | sort | /usr/xpg4/bin/awk -F '(' '{ print $1; }' | /usr/xpg4/bin/awk -F '=' '{ print $1;}' > exported_from_safe.txt  
+egrep 'export ' ../include/std/memory.e | sort | /usr/xpg4/bin/awk -F '(' '{ print $1; }' | /usr/xpg4/bin/awk -F '=' '{ print $1;}' > exported_from_memory.txt 
 if diff exported_from_safe.txt exported_from_memory.txt; then 
 	echo "Both std/memory.e and std/safe.e provide the same interface to std/machine.e....good."  
 else 
@@ -14,8 +14,8 @@ 
 	echo "Error: std/memory.e and std/safe.e export different symbols to std/machine.e....bad." 
 	exit 1 
 fi 
-egrep 'public ' ../include/std/safe.e | sort | awk -F '(' '{ print $1; }' | awk -F '=' '{ print $1;}' > publicized_from_safe.txt  
-egrep 'public ' ../include/std/memory.e | sort | awk -F '(' '{ print $1; }' | awk -F '=' '{ print $1;}' > publicized_from_memory.txt 
+egrep 'public ' ../include/std/safe.e | sort | /usr/xpg4/bin/awk -F '(' '{ print $1; }' | /usr/xpg4/bin/awk -F '=' '{ print $1;}' > publicized_from_safe.txt  
+egrep 'public ' ../include/std/memory.e | sort | /usr/xpg4/bin/awk -F '(' '{ print $1; }' | /usr/xpg4/bin/awk -F '=' '{ print $1;}' > publicized_from_memory.txt 
 if diff publicized_from_safe.txt publicized_from_memory.txt | grep '>'; then 
 	echo "Error: std/memory.e symbols not in std/safe.e to all files        ...bad." 
 	exit 1 
--- ~/open_euphoria/euphoria/tests/t_abadcase.e	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/tests/t_abadcase.e	Wed Sep 27 00:23:45 2017 
@@ -13,6 +13,11 @@ 
 include std/regex.e  
 include std/unittest.e 
   
+ifdef SUN then 
+	puts(1, "Platform does not use debian packaging system.") 
+	abort(0) 
+end ifdef 
+ 
 constant version_pattern = regex:new("(\\d+\\.)*\\d+")  
 constant library_link_pattern = regex:new("=> +(/|\\()?", NO_AUTO_CAPTURE)  
   
--- ~/open_euphoria/euphoria/tests/t_io.e	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/tests/t_io.e	Wed Sep 27 00:23:45 2017 
@@ -192,7 +192,7 @@ 
  
  
 -- OpenBSD allows seeking on STDIN, STDOUT and STDERR 
-ifdef not OPENBSD and not NETBSD and not FREEBSD then 
+ifdef not OPENBSD and not NETBSD and not FREEBSD and not SUN then 
 	test_equal( "Seek STDIN",  1, seek(0, 0)) 
 	test_equal( "Seek STDOUT", 1, seek(1, 0)) 
 	test_equal( "Seek STDERR", 1, seek(2, 0)) 
--- ~/open_euphoria/euphoria/tests/t_map.e	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/tests/t_map.e	Wed Sep 27 00:23:45 2017 
@@ -51,7 +51,7 @@ 
 test_equal("map m1 get 1000",           "1000", map:get(m1, 1000, 999) ) 
  
 -- add 2000 floats 
-o2 = map:threshold(o1) 
+o2 = map:threshold(size(o1)) 
 for i = 1 to 1000 do 
 	map:put(m1, -i*1.333333, i) 
 end for 
--- ~/open_euphoria/euphoria/tests/t_net_http.e	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/tests/t_net_http.e	Wed Sep 27 00:23:45 2017 
@@ -18,7 +18,7 @@ 
 	assert("content readable http_get no path", length(content) > 1) 
 	test_not_equal("content non-empty with http_get no path", length(content[2]), 0) 
 	 
-	content = http_get("http://www.iana.org/domains/example/") 
+	content = http_get("http://openeuphoria.org/docs/") 
 	if atom(content) then 
 		test_fail(sprintf("content readable from http_get with a path %d", {content})) 
 	else 
@@ -26,7 +26,7 @@ 
 		test_true("content correct form from http_get with a path", match("<title>", "" & content[2])) 
 	end if 
  
-	content = http_get("http://www.iana.org:80/domains/example/") 
+	content = http_get("http://openeuphoria.org:80/docs/") 
 	if atom(content) then 
 		test_fail("content readable from http_get with port and path") 
 	else 
--- ~/open_euphoria/euphoria/tests/t_platform.e	Wed Sep 27 00:22:47 2017 
+++ ~/open_euphoria_sun/euphoria/tests/t_platform.e	Wed Sep 27 00:23:45 2017 
@@ -30,10 +30,14 @@ 
 	platform_defines &= "OSX " 
 end ifdef 
  
+ifdef SUN then 
+	platform_defines &= "SUN " 
+end ifdef 
+ 
 ifdef WIN32 or WINDOWS then 
     ifdef not WIN32 or not WINDOWS then 
 		test_fail("One of the accompanying defines is not defined. Defines: " & platform_defines) 
-	elsifdef UNIX or LINUX or OPENBSD or NETBSD or FREEBSD or OSX then 
+	elsifdef UNIX or LINUX or OPENBSD or NETBSD or FREEBSD or OSX or SUN then 
 		test_fail("OS Name Conflict: Both Windows and non-Windows OS def-symbol defined. Defines: " & platform_defines)	 
 	end ifdef 
 	test_equal("WIN32=platform()", WIN32, platform() ) 
@@ -51,6 +55,8 @@ 
 	    test_equal("FREEBSD=platform()", FREEBSD, platform()) 
 	elsifdef OSX then 
 	    test_equal("OSX=platform()", OSX, platform()) 
+	elsifdef SUN then 
+	    test_equal("SUN=platform()", SUN, platform()) 
 	elsedef 
 		test_fail("UNIX def-symbol is set but no supported UNIX def-symbol is set. Defines: " & platform_defines) 
 	end ifdef