]> granicus.if.org Git - nethack/commitdiff
BSD and POSIX
authorcohrs <cohrs>
Sun, 6 Jul 2003 22:06:46 +0000 (22:06 +0000)
committercohrs <cohrs>
Sun, 6 Jul 2003 22:06:46 +0000 (22:06 +0000)
Finally got around to installing OpenBSD (rev 3.3) in a vmware partition.
Found that several #if BSD's were inappropriate for modern BSD's.  Haven't
installed FreeBSD or NetBSD, but based on reading their man pages,
these changes are needed there too.  Mostly due to POSIX time() signature.

include/system.h
include/unixconf.h
src/files.c
src/hacklib.c
src/u_init.c
sys/unix/unixunix.c

index fc3964a466a0407fcf5558761b3c89d25ade7c1c..a4efff98322c918a39163e60c6b00affb04f2bf8 100644 (file)
@@ -521,7 +521,7 @@ E struct tm *FDECL(localtime, (const time_t *));
 #  endif
 # endif
 
-# if defined(ULTRIX) || defined(SYSV) || defined(MICRO) || defined(VMS) || defined(MAC) || (defined(HPUX) && defined(_POSIX_SOURCE))
+# if defined(ULTRIX) || (defined(BSD) && defined(POSIX_TYPES)) || defined(SYSV) || defined(MICRO) || defined(VMS) || defined(MAC) || (defined(HPUX) && defined(_POSIX_SOURCE))
 E time_t FDECL(time, (time_t *));
 # else
 E long FDECL(time, (time_t *));
index 19ebd7f44cd68dfd2a374e5e4179231aac9bbb01..fe1b00661df4d4069a476f71e1aa1e01a4c30f22 100644 (file)
@@ -19,7 +19,7 @@
  */
 
 /* define exactly one of the following four choices */
-/* #define BSD 1 */    /* define for 4.n BSD  */
+/* #define BSD 1 */    /* define for 4.n/Free/Open/Net BSD  */
                        /* also for relatives like SunOS 4.x, DG/UX, and */
                        /* older versions of Linux */
 /* #define ULTRIX */   /* define for Ultrix v3.0 or higher (but not lower) */
 #  ifdef AMS
 #define AMS_MAILBOX    "/Mailbox"
 #  else
+#   if defined(__FreeBSD__) || defined(__OpenBSD__)
+#define DEF_MAILREADER "/usr/bin/mail"
+#   else
 #define DEF_MAILREADER "/usr/ucb/Mail"
+#   endif
 #  endif
 #else
 # if (defined(SYSV) || defined(DGUX) || defined(HPUX)) && !defined(LINUX)
-#  if defined(M_XENIX) || defined(__FreeBSD__)
+#  if defined(M_XENIX)
 #define DEF_MAILREADER "/usr/bin/mail"
 #  else
 #   ifdef __sgi
index 941b323670c3a737b8a3a96c0c1ab618b51df8a5..cd1089cf683c656a052c38b6047a9dfeaf03ba74 100644 (file)
@@ -930,6 +930,7 @@ restore_saved_game()
        return fd;
 }
 
+#if defined(UNIX) && defined(QT_GRAPHICS)
 /*ARGSUSED*/
 static char*
 plname_from_file(filename)
@@ -982,6 +983,7 @@ const char* filename;
     }
 #endif
 }
+#endif /* defined(UNIX) && defined(QT_GRAPHICS) */
 
 char**
 get_saved_games()
index c34e7509bcc188d0e1a5d8faf33bb5ee230e2ee7..0d082705aa6251d9c126204a3c135a7ea6b2d97c 100644 (file)
@@ -467,7 +467,7 @@ setrandom()
        srandom((unsigned int) time((time_t *)0));
 #else
 # if defined(__APPLE__) || defined(BSD) || defined(LINUX) || defined(ULTRIX) || defined(CYGWIN32) /* system srandom() */
-#  ifdef BSD
+#  if defined(BSD) && !defined(POSIX_TYPES)
 #   if defined(SUNOS4)
        (void)
 #   endif
@@ -490,12 +490,12 @@ getlt()
 {
        time_t date;
 
-#ifdef BSD
+#if defined(BSD) && !defined(POSIX_TYPES)
        (void) time((long *)(&date));
 #else
        (void) time(&date);
 #endif
-#if (defined(ULTRIX) && !(defined(ULTRIX_PROTO) || defined(NHSTDC))) || defined(BSD)
+#if (defined(ULTRIX) && !(defined(ULTRIX_PROTO) || defined(NHSTDC))) || (defined(BSD) && !defined(POSIX_TYPES))
        return(localtime((long *)(&date)));
 #else
        return(localtime(&date));
@@ -542,7 +542,7 @@ time_t date;
        if (date == 0)
                lt = getlt();
        else
-#if (defined(ULTRIX) && !(defined(ULTRIX_PROTO) || defined(NHSTDC))) || defined(BSD)
+#if (defined(ULTRIX) && !(defined(ULTRIX_PROTO) || defined(NHSTDC))) || (defined(BSD) && !defined(POSIX_TYPES))
                lt = localtime((long *)(&date));
 #else
                lt = localtime(&date);
index 2a371916a0841cb71e154fd50295ef35027179bd..114893c50de5d8c7020f16e23af908e96ae3270b 100644 (file)
@@ -583,7 +583,7 @@ u_init()
                        aligns[flags.initalign].value;
        u.ulycn = NON_PM;
 
-#ifdef BSD
+#if defined(BSD) && !defined(POSIX_TYPES)
        (void) time((long *)&u.ubirthday);
 #else
        (void) time(&u.ubirthday);
index df8caec83c0a36eea278c5c9fd7730ee53d57591..ed17c91c10e6c12682ab450a7994ad69b84693a4 100644 (file)
@@ -35,7 +35,7 @@ int fd;
 #ifndef INSURANCE
        if(buf.st_size != sizeof(int)) return(0);       /* not an xlock file */
 #endif
-#ifdef BSD
+#if defined(BSD) && !defined(POSIX_TYPES)
        (void) time((long *)(&date));
 #else
        (void) time(&date);