summaryrefslogtreecommitdiff
path: root/archivers/pxz/files/patch-pxz.c
blob: 4f09c008714bd431343935194b700cf82e50e404 (plain) (blame)
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
--- pxz.c.orig	2014-10-18 17:06:27 UTC
+++ pxz.c
@@ -23,11 +23,17 @@
 
 #include <string.h>
 #include <stdio.h>
+#ifndef __FreeBSD__
 #include <stdio_ext.h>
+#endif
 #include <stdlib.h>
 #include <inttypes.h>
 #include <unistd.h>
+#ifdef __FreeBSD__
+#include <err.h>
+#else
 #include <error.h>
+#endif
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/mman.h>
@@ -42,6 +48,10 @@
 #include <omp.h>
 #endif
 
+#ifdef __FreeBSD__
+#define error errc
+#endif
+
 #ifndef XZ_BINARY
 #define XZ_BINARY "xz"
 #endif
@@ -121,6 +131,13 @@ const struct option long_opts[] = {
 	{ NULL,             0,                 NULL,   0 }
 };
 
+#ifdef __FreeBSD__
+static size_t __fpending (FILE *fp)
+{
+	return (fp->_p - fp->_bf._base);
+}
+#endif
+
 void __attribute__((noreturn)) run_xz( char **argv ) {
 	execvp(XZ_BINARY, argv);
 	error(0, errno, "execution of "XZ_BINARY" binary failed");