From 125b5969d523329f43da1c5868c0767460d58bd7 Mon Sep 17 00:00:00 2001
From: zesstra <zesstra@zesstra.de>
Date: Wed, 15 Apr 2009 23:41:16 +0200
Subject: [PATCH 05/12] Removed checks for __BEOS__

These systems are anyway not supported any longer.

Signed-off-by: zesstra <zesstra@zesstra.de>
---
 src/comm.c      |   36 ++++++++----------------------------
 src/make_func.y |    3 ---
 src/object.c    |    4 ++--
 src/port.h      |   49 +++++++++++++++++++------------------------------
 src/simulate.c  |    2 --
 src/slaballoc.c |    2 +-
 src/smalloc.c   |    2 +-
 7 files changed, 31 insertions(+), 67 deletions(-)

diff --git a/src/comm.c b/src/comm.c
index 5dd5dbf..d823b41 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -814,8 +814,6 @@ set_socket_nonblocking (SOCKET_T new_socket)
 {
     int tmp;
 
-#ifndef __BEOS__
-
     tmp = 1;
 
 # ifdef USE_IOCTL_FIONBIO
@@ -834,19 +832,6 @@ set_socket_nonblocking (SOCKET_T new_socket)
     }
 # endif /* !USE_IOCTL_FIONBIO */
 
-#else /* if __BEOS__ */
-
-    /* BeOS up to R4 uses different filedescriptors for files and sockets;
-     * so a fcntl() modifies the regular file with the number <new_socket>,
-     * but not the socket itself. setsockopt() comes to our rescue.
-     * TODO: Add setsockopt() to configure to test?
-     */
-    tmp = 1;
-    if (setsockopt(new_socket, SOL_SOCKET, SO_NONBLOCK, &tmp, sizeof tmp))
-        perror("setsockopt SO_NONBLOCK");
-
-#endif /* if !__BEOS__ */
-
 } /* set_socket_nonblocking() */
 
 /*-------------------------------------------------------------------------*/
@@ -2599,7 +2584,7 @@ get_message (char *buff)
          *   to prevent freezing.
          * TODO: Always use the readfds information.
          */
-#if !defined(__BEOS__) && !defined(CYGWIN)
+#if !defined(CYGWIN)
         if (udp_s >= 0)
 #else
         if (udp_s >= 0 && FD_ISSET(udp_s, &readfds))
@@ -5952,9 +5937,7 @@ open_ipv6_conn( const char *hostname, const unsigned short int port
     int sock;
     int con = 0;
     int fd_flags;
-#ifdef __BEOS__
-    const int bos = 1;
-#endif
+
     struct hostent *h;
     struct protoent *p;
     struct sockaddr_in6 addr;
@@ -5969,19 +5952,16 @@ open_ipv6_conn( const char *hostname, const unsigned short int port
         return -1;
     }
     endprotoent();
-#ifdef __BEOS__
-    if (setsockopt(sock, SOL_SOCKET, SO_NONBLOCK, &bos, sizeof(bos)))
-#else
-        fd_flags = fcntl(sock, F_GETFL, 0);
-#  if defined(O_NONBLOCK)
+
+    fd_flags = fcntl(sock, F_GETFL, 0);
+#if defined(O_NONBLOCK)
     fd_flags |= O_NONBLOCK;
-#  elif defined(O_NDELAY)
+#elif defined(O_NDELAY)
     fd_flags |= O_NDELAY;
-#  elif defined(FNDELAY)
+#elif defined(FNDELAY)
     fd_flags |= O_FNDELAY;
-#  endif
-    if (fcntl(sock, F_SETFL, fd_flags) == -1)
 #endif
+    if (fcntl(sock, F_SETFL, fd_flags) == -1)
     {
         perror("setsockopt/fcntl");
         close(sock);
diff --git a/src/make_func.y b/src/make_func.y
index 3c957d5..2608559 100644
--- a/src/make_func.y
+++ b/src/make_func.y
@@ -2706,9 +2706,6 @@ read_machine (void)
 #ifdef AMIGA
     add_define("AMIGA",-1,"");
 #endif
-#ifdef __BEOS__
-    add_define("__BEOS__", -1, "");
-#endif
 #ifdef DEBUG
     add_define("DEBUG", -1, "");
 #endif
diff --git a/src/object.c b/src/object.c
index 225d903..646d1c6 100644
--- a/src/object.c
+++ b/src/object.c
@@ -6871,7 +6871,7 @@ v_save_object (svalue_t *sp, int numarg)
         i = 0; /* Result from efun */
 
         unlink(name);
-#if !defined(MSDOS_FS) && !defined(AMIGA) && !defined(__BEOS__)
+#if !defined(MSDOS_FS) && !defined(AMIGA)
         if (link(tmp_name, name) == -1)
 #else
         close(f);
@@ -6884,7 +6884,7 @@ v_save_object (svalue_t *sp, int numarg)
             add_message("Failed to save object !\n");
             i = 1;
         }
-#if !defined(MSDOS_FS) && !defined(AMIGA) && !defined(__BEOS__)
+#if !defined(MSDOS_FS) && !defined(AMIGA)
         close(f);
         unlink(tmp_name);
 #endif
diff --git a/src/port.h b/src/port.h
index b413793..c8f8510 100644
--- a/src/port.h
+++ b/src/port.h
@@ -102,15 +102,6 @@ extern int errno;
 #include <math.h>
 #include <float.h>
 
-#ifdef __BEOS__
-     /* BeOS defines some standard non-standard types itself (like int32).
-      * Since the defs will be used as part of the networking includes,
-      * we force them in here globally and simply adapt the other
-      * definitions to avoid clashes.
-      */
-#    include <SupportDefs.h>
-#endif
-
 #ifdef HAVE_SYS_PARAM_H
 #    include <sys/param.h>
 #endif
@@ -424,34 +415,32 @@ typedef p_uint       mp_uint;
 #define SCNxMPINT  PRIxPINT
 
 
-#ifndef __BEOS__
 /* int32 : an integer with 32 bits.
    TODO: just use (u)int32_t instead of (u)int32. */
 typedef int32_t   int32;
 typedef uint32_t  uint32;
-#  ifndef PRId32
+#ifndef PRId32
    /* unfortunately there seems to be no PRId32 from inttypes.h or alike.
       TODO: Once we require C99, we can get rid of the this stuff */
-#    if !defined(CHAR_BIT) || CHAR_BIT != 8
-#      error CHAR_BIT does not exist or is != 8 which is currently not supported!
-       Thats it.
-#    endif
+#  if !defined(CHAR_BIT) || CHAR_BIT != 8
+#    error CHAR_BIT does not exist or is != 8 which is currently not supported!
+     Thats it.
+#  endif
    /* now sizeof(int32) has to be sizeof(char) * 4 == 4. */
-#    if SIZEOF_INT == 4
-#      define __PRId32PREFIX
-#    elif SIZEOF_LONG == 4
-#      define __PRId32PREFIX "l"
-#    elif SIZEOF_SHORT == 4
-#      define __PRIx32PREFIX "h"
-#    else
-#      error Could not find length modifier for (u)int32
-       Thats it.
-#    endif
-#    define PRId32 __PRId32PREFIX "d"
-#    define PRIu32 __PRId32PREFIX "u"
-#    define PRIx32 __PRId32PREFIX "x"
-#  endif /* PRId32 */
-#endif /* __BEOS__ */
+#  if SIZEOF_INT == 4
+#    define __PRId32PREFIX
+#  elif SIZEOF_LONG == 4
+#    define __PRId32PREFIX "l"
+#  elif SIZEOF_SHORT == 4
+#    define __PRIx32PREFIX "h"
+#  else
+#    error Could not find length modifier for (u)int32
+     Thats it.
+#  endif
+#  define PRId32 __PRId32PREFIX "d"
+#  define PRIu32 __PRId32PREFIX "u"
+#  define PRIx32 __PRId32PREFIX "x"
+#endif /* PRId32 */
 
 
 /* type to use with constant pointer arithmetic. */
diff --git a/src/simulate.c b/src/simulate.c
index 6acdc68..246b51d 100644
--- a/src/simulate.c
+++ b/src/simulate.c
@@ -580,7 +580,6 @@ dump_core(void)
  */
 
 {
-#if !defined(__BEOS__)
     /* we want a core dump, and abort() seems to fail for linux and sun */
     (void)signal(SIGFPE, SIG_DFL);
     {
@@ -588,7 +587,6 @@ dump_core(void)
         *((char*)0) = 0/a;
         *((char*)fatal) = 0/a;
     }
-#endif
     abort();
 } /* dump_core() */
 
diff --git a/src/slaballoc.c b/src/slaballoc.c
index 5aceca7..7278596 100644
--- a/src/slaballoc.c
+++ b/src/slaballoc.c
@@ -2092,7 +2092,7 @@ mem_realloc (POINTER p, size_t size)
 
 /* Extra types and definitions for the AVL routines */
 
-#if defined (sun) || defined(AMIGA) || defined(__linux__) || defined(__BEOS__)
+#if defined (sun) || defined(AMIGA) || defined(__linux__)
     /* there is a type signed char */
     typedef signed char balance_t;
 #   define BALANCE_T_BITS 8
diff --git a/src/smalloc.c b/src/smalloc.c
index 407ea1e..5fd23e7 100644
--- a/src/smalloc.c
+++ b/src/smalloc.c
@@ -1885,7 +1885,7 @@ mem_realloc (POINTER p, size_t size)
 
 /* Extra types and definitions for the AVL routines */
 
-#if defined (sun) || defined(AMIGA) || defined(__linux__) || defined(__BEOS__)
+#if defined (sun) || defined(AMIGA) || defined(__linux__)
     /* there is a type signed char */
     typedef signed char balance_t;
 #   define BALANCE_T_BITS 8
-- 
1.6.1

