Files
pkgsrc-ng/archivers/xbin/patches/patch-aa
2016-01-21 23:40:00 +01:00

71 lines
1.8 KiB
Plaintext

$NetBSD: patch-aa,v 1.4 2014/05/25 16:40:09 rodent Exp $
Add missing includes. Fix build for OpenBSD 5.5.
--- xbinunix.c.orig 2014-05-25 16:36:21.000000000 +0000
+++ xbinunix.c
@@ -2,12 +2,17 @@
static char version[] = "xbin.c Version 2.3 09/30/85";
#endif lint
+#include <stdlib.h>
+#include <limits.h>
#include <stdio.h>
+#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/dir.h>
+#include <dirent.h>
-#ifdef MAXNAMLEN /* 4.2 BSD */
+#if defined(NAME_MAX)
+#define FNAMELEN NAME_MAX
+#elif defined(MAXNAMLEN) /* 4.2 BSD */
#define FNAMELEN MAXNAMLEN
#else
#define FNAMELEN DIRSIZ
@@ -15,7 +20,12 @@ static char version[] = "xbin.c Version
#ifdef BSD
#include <sys/time.h>
+#if defined(__OpenBSD__)
+#include <sys/param.h>
+#endif
+#if (defined(__OpenBSD__) && (OpenBSD < 201405)) || !defined(__OpenBSD__)
#include <sys/timeb.h>
+#endif
#define search_last rindex
extern char *rindex();
#else
@@ -287,10 +297,11 @@ forge_info()
int n;
long tdiff;
struct tm *tp;
-#ifdef BSD
+#if (defined(BSD) && !defined(__OpenBSD__)) || (defined(__OpenBSD__) && (OpenBSD < 201405))
struct timeb tbuf;
#else
long bs;
+ struct timezone tzone;
#endif
for (np = mh.m_name; *np; np++)
@@ -310,7 +321,7 @@ forge_info()
put4(buf + H_RLENOFF, mh.m_rsrclen);
/* convert unix file time to mac time format */
-#ifdef BSD
+#if (defined(BSD) && !defined(__OpenBSD__)) || (defined(__OpenBSD__) && (OpenBSD < 201405))
ftime(&tbuf);
tp = localtime(&tbuf.time);
tdiff = TIMEDIFF - tbuf.timezone * 60;
@@ -320,7 +331,7 @@ forge_info()
/* I hope this is right! -andy */
time(&bs);
tp = localtime(&bs);
- tdiff = TIMEDIFF - timezone;
+ tdiff = TIMEDIFF - tzone.tz_minuteswest;
if (tp->tm_isdst)
tdiff += 60 * 60;
#endif