Files
pkgsrc-ng/archivers/unarj/patches/patch-ac
2016-01-21 23:42:40 +01:00

57 lines
1.4 KiB
Plaintext

$NetBSD: patch-ac,v 1.4 2015/08/11 18:07:55 wiz Exp $
--- environ.c.orig 2002-06-05 10:28:06.000000000 +0000
+++ environ.c
@@ -430,16 +430,10 @@ uint host;
#define SUBS_DEFINED
+#include <stdlib.h>
+#include <string.h>
#include <time.h>
-
-#ifndef time_t
-#define time_t long
-#endif
-
-extern struct tm *localtime();
-extern time_t time();
-extern char *strcpy();
-extern voidp *malloc();
+#include <sys/types.h>
FILE *
file_open(name, mode)
@@ -535,8 +529,12 @@ uint mode;
}
long
-gettz() /* returns the offset from GMT in seconds */
+gettz(stamp) /* returns the offset from GMT in seconds */
+time_t stamp;
{
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+ return -localtime(&stamp)->tm_gmtoff;
+#else
#define NOONOFFSET 43200L
#define SEC_IN_DAY (24L * 60L * 60L)
#define INV_VALUE (SEC_IN_DAY + 1L)
@@ -552,6 +550,7 @@ gettz() /* returns the offset fr
noontm = localtime(&noon);
retval = NOONOFFSET - 60 * (60 * noontm->tm_hour - noontm->tm_min);
return retval;
+#endif
}
long
@@ -609,7 +608,8 @@ uint host;
(uint) attribute;
(uint) host;
- m_time = mstonix(tstamp) + gettz();
+ m_time = mstonix(tstamp);
+ m_time += gettz(m_time);
tb.mtime = m_time; /* Set modification time */
tb.atime = m_time; /* Set access time */