openbsd-ports/archivers/zoo/patches/patch-bsd_c
2006-04-07 07:40:18 +00:00

52 lines
1.2 KiB
Plaintext

$OpenBSD: patch-bsd_c,v 1.1 2006/04/07 07:40:18 pvalchev Exp $
--- bsd.c.orig Fri Apr 30 22:21:53 1993
+++ bsd.c Fri Apr 7 01:38:55 2006
@@ -69,8 +69,16 @@ ZOOFILE f;
}
/* Function gettz() returns the offset from GMT in seconds */
-long gettz()
+long gettz(t)
+#if defined(__OpenBSD__)
+time_t t;
+#else
+long t;
+#endif
{
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+ return -localtime(&t)->tm_gmtoff;
+#else
#define SEC_IN_DAY (24L * 60L * 60L)
#define INV_VALUE (SEC_IN_DAY + 1L)
static long retval = INV_VALUE; /* cache, init to impossible value */
@@ -95,6 +103,7 @@ long gettz()
retval = -tm->tm_gmtoff;
#endif
return retval;
+#endif
}
/* Standard UNIX-compatible time routines */
@@ -103,15 +112,19 @@ long gettz()
/* Standard UNIX-specific file attribute routines */
#include "nixmode.i"
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#include <unistd.h>
+#else
#ifndef SEEK_CUR
# define SEEK_CUR 1
#endif
+#endif
/* Truncate a file. */
int zootrunc(f) FILE *f;
{
- extern long lseek();
- long seekpos;
+ extern off_t lseek();
+ off_t seekpos;
int fd = fileno(f);
seekpos = lseek(fd, 0L, SEEK_CUR);
if (seekpos >= 0)