File:  [cvs.NetBSD.org] / pkgsrc / archivers / zoo / patches / patch-ab
Revision 1.8: download - view: text, annotated - select for diffs
Fri Feb 27 09:31:47 2015 UTC (9 years, 11 months ago) by wiz
Branches: MAIN
CVS tags: pkgsrc-2024Q4-base, pkgsrc-2024Q4, pkgsrc-2024Q3-base, pkgsrc-2024Q3, pkgsrc-2024Q2-base, pkgsrc-2024Q2, pkgsrc-2024Q1-base, pkgsrc-2024Q1, pkgsrc-2023Q4-base, pkgsrc-2023Q4, pkgsrc-2023Q3-base, pkgsrc-2023Q3, pkgsrc-2023Q2-base, pkgsrc-2023Q2, pkgsrc-2023Q1-base, pkgsrc-2023Q1, pkgsrc-2022Q4-base, pkgsrc-2022Q4, pkgsrc-2022Q3-base, pkgsrc-2022Q3, pkgsrc-2022Q2-base, pkgsrc-2022Q2, pkgsrc-2022Q1-base, pkgsrc-2022Q1, pkgsrc-2021Q4-base, pkgsrc-2021Q4, pkgsrc-2021Q3-base, pkgsrc-2021Q3, pkgsrc-2021Q2-base, pkgsrc-2021Q2, pkgsrc-2021Q1-base, pkgsrc-2021Q1, pkgsrc-2020Q4-base, pkgsrc-2020Q4, pkgsrc-2020Q3-base, pkgsrc-2020Q3, pkgsrc-2020Q2-base, pkgsrc-2020Q2, pkgsrc-2020Q1-base, pkgsrc-2020Q1, pkgsrc-2019Q4-base, pkgsrc-2019Q4, pkgsrc-2019Q3-base, pkgsrc-2019Q3, pkgsrc-2019Q2-base, pkgsrc-2019Q2, pkgsrc-2019Q1-base, pkgsrc-2019Q1, pkgsrc-2018Q4-base, pkgsrc-2018Q4, pkgsrc-2018Q3-base, pkgsrc-2018Q3, pkgsrc-2018Q2-base, pkgsrc-2018Q2, pkgsrc-2018Q1-base, pkgsrc-2018Q1, pkgsrc-2017Q4-base, pkgsrc-2017Q4, pkgsrc-2017Q3-base, pkgsrc-2017Q3, pkgsrc-2017Q2-base, pkgsrc-2017Q2, pkgsrc-2017Q1-base, pkgsrc-2017Q1, pkgsrc-2016Q4-base, pkgsrc-2016Q4, pkgsrc-2016Q3-base, pkgsrc-2016Q3, pkgsrc-2016Q2-base, pkgsrc-2016Q2, pkgsrc-2016Q1-base, pkgsrc-2016Q1, pkgsrc-2015Q4-base, pkgsrc-2015Q4, pkgsrc-2015Q3-base, pkgsrc-2015Q3, pkgsrc-2015Q2-base, pkgsrc-2015Q2, pkgsrc-2015Q1-base, pkgsrc-2015Q1, HEAD
Fix build on Linux. From Matthias Ferdinand on pkgsrc-users.

$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;
 }

CVSweb <webmaster@jp.NetBSD.org>