summaryrefslogtreecommitdiff
path: root/archivers/zoo/patches/patch-ab
blob: 385e6acfe18ca8cd8fec59bc074ab98a3e3d2672 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
$NetBSD: patch-ab,v 1.8 2015/02/27 09:31:47 wiz Exp $

- use standard headers
- use standard macros for seeking
- don't declare own lseek
- use off_t
- supply missing return value
- on sunos ignore unsupported tm_gmtoff
- include nixtime.i early enough, before the first call to time()

--- bsd.c.orig	1993-05-01 04:21:53.000000000 +0000
+++ bsd.c
@@ -26,7 +26,7 @@ to be on the safe side.  It is needed fo
 long lseek PARMS ((int, long, int));
 long tell (fd)
 int fd;
-{ return (lseek (fd, 0L, 1)); }
+{ return (lseek (fd, 0L, SEEK_CUR)); }
 #endif
 
 long ftell();
@@ -50,6 +50,17 @@ Date and time functions are standard UNI
 #include <sys/stat.h>
 #include <sys/time.h>
 
+/* Standard UNIX-compatible time routines */
+#include "nixtime.i"
+
+/* Standard UNIX-specific file attribute routines */
+#include "nixmode.i"
+
+#include <unistd.h>
+#ifndef SEEK_CUR
+# define  SEEK_CUR    1
+#endif
+
 /* Function isadir() returns 1 if the supplied handle is a directory, 
 else it returns 0.  
 */
@@ -74,46 +85,27 @@ long gettz()
 #define SEC_IN_DAY	(24L * 60L * 60L)
 #define INV_VALUE		(SEC_IN_DAY + 1L)
 	static long retval = INV_VALUE;	     /* cache, init to impossible value */
-#ifndef __386BSD__
-   struct timeval tp;
-   struct timezone tzp;
-#else
    time_t lt;
    struct tm *tm;
-#endif
 	if (retval != INV_VALUE)				 /* if have cached value, return it */
 		return retval;
-#ifndef __386BSD__
-   gettimeofday (&tp, &tzp);              /* specific to 4.3BSD */
-   /* return (tzp.tz_minuteswest * 60); */ /* old incorrect code */
-	/* Timezone fix thanks to Bill Davidsen <wedu@ge-crd.ARPA> */
-	/* !! - ache@hq.demos.su */
-	retval = tzp.tz_minuteswest * 60 - (tzp.tz_dsttime != 0) * 3600L;
-#else
 	time(&lt);
 	tm = localtime(&lt);
+#if defined(__sun)
+	retval = 0;
+#else
 	retval = -tm->tm_gmtoff;
 #endif
 	return retval;
 }
 
-/* Standard UNIX-compatible time routines */
-#include "nixtime.i"
-
-/* Standard UNIX-specific file attribute routines */
-#include "nixmode.i"
-
-#ifndef SEEK_CUR
-# define  SEEK_CUR    1
-#endif
-
 /* Truncate a file. */
 int zootrunc(f) FILE *f;
 {
-	extern long lseek();
-	long seekpos;
+	off_t seekpos;
 	int fd = fileno(f);
 	seekpos = lseek(fd, 0L, SEEK_CUR);
 	if (seekpos >= 0)
 		return ftruncate(fd, seekpos);
+	return 0;
 }