pkgsrc - initial commit
[pkgsrc.git] / archivers / zoo / patches / patch-ab
1 $NetBSD: patch-ab,v 1.5 2009/04/25 23:46:47 gdt Exp $
2
3 --- bsd.c.orig  1993-05-01 06:21:53.000000000 +0200
4 +++ bsd.c
5 @@ -69,8 +69,12 @@ ZOOFILE f;
6  }
7  
8  /* Function gettz() returns the offset from GMT in seconds */
9 -long gettz()
10 +long gettz(t)
11 +long t;
12  {
13 +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
14 +   return -localtime(&t)->tm_gmtoff;
15 +#else
16  #define SEC_IN_DAY     (24L * 60L * 60L)
17  #define INV_VALUE              (SEC_IN_DAY + 1L)
18         static long retval = INV_VALUE;      /* cache, init to impossible value */
19 @@ -95,6 +99,7 @@ long gettz()
20         retval = -tm->tm_gmtoff;
21  #endif
22         return retval;
23 +#endif
24  }
25  
26  /* Standard UNIX-compatible time routines */
27 @@ -103,15 +108,19 @@ long gettz()
28  /* Standard UNIX-specific file attribute routines */
29  #include "nixmode.i"
30  
31 +#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
32 +#include <unistd.h>
33 +#else
34  #ifndef SEEK_CUR
35  # define  SEEK_CUR    1
36  #endif
37 +#endif
38  
39  /* Truncate a file. */
40  int zootrunc(f) FILE *f;
41  {
42 -       extern long lseek();
43 -       long seekpos;
44 +       extern off_t lseek();
45 +       off_t seekpos;
46         int fd = fileno(f);
47         seekpos = lseek(fd, 0L, SEEK_CUR);
48         if (seekpos >= 0)