aboutsummaryrefslogtreecommitdiff
path: root/ports/libmagic/0006-Remove-Wrap-POSIX-headers.patch
blob: 56efac2481577b956c300570ed041eab79bb1612 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
From b20c8e62851f3cb53083a3e7811518092f98dc26 Mon Sep 17 00:00:00 2001
From: Long Nguyen <nguyen.long.908132@gmail.com>
Date: Sat, 8 May 2021 22:47:32 +0700
Subject: [PATCH 06/14] Remove/Wrap POSIX headers

---
 src/buffer.c   | 2 ++
 src/cdf.c      | 2 ++
 src/dprintf.c  | 2 ++
 src/file.c     | 1 -
 src/getline.c  | 2 ++
 src/is_csv.c   | 2 ++
 src/is_json.c  | 2 ++
 src/magic.c    | 2 ++
 src/memtest.c  | 2 ++
 src/mygetopt.h | 2 ++
 src/pread.c    | 2 ++
 src/readcdf.c  | 2 ++
 12 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/buffer.c b/src/buffer.c
index 227015a..f3d8efa 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -31,7 +31,9 @@ FILE_RCSID("@(#)$File: buffer.c,v 1.8 2020/02/16 15:52:49 christos Exp $")
 #endif	/* lint */
 
 #include "magic.h"
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <string.h>
 #include <stdlib.h>
 #include <sys/stat.h>
diff --git a/src/cdf.c b/src/cdf.c
index bb81d63..dc9ec56 100644
--- a/src/cdf.c
+++ b/src/cdf.c
@@ -43,7 +43,9 @@ FILE_RCSID("@(#)$File: cdf.c,v 1.116 2019/08/26 14:31:39 christos Exp $")
 #include <err.h>
 #endif
 #include <stdlib.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <string.h>
 #include <time.h>
 #include <ctype.h>
diff --git a/src/dprintf.c b/src/dprintf.c
index 027a64f..873c547 100644
--- a/src/dprintf.c
+++ b/src/dprintf.c
@@ -32,7 +32,9 @@ FILE_RCSID("@(#)$File: dprintf.c,v 1.2 2018/09/09 20:33:28 christos Exp $")
 #endif	/* lint */
 
 #include <assert.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <stdio.h>
 #include <stdarg.h>
 
diff --git a/src/file.c b/src/file.c
index 87b9ab1..2889f8a 100644
--- a/src/file.c
+++ b/src/file.c
@@ -38,7 +38,6 @@ FILE_RCSID("@(#)$File: file.c,v 1.189 2021/02/05 21:33:49 christos Exp $")
 #include "magic.h"
 
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 #ifdef RESTORE_TIME
 # if (__COHERENT__ >= 0x420)
diff --git a/src/getline.c b/src/getline.c
index b00de01..c2d41ca 100644
--- a/src/getline.c
+++ b/src/getline.c
@@ -33,7 +33,9 @@
 #if !HAVE_GETLINE
 #include <stdlib.h>
 #include <stdio.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <errno.h>
 #include <string.h>
 
diff --git a/src/is_csv.c b/src/is_csv.c
index 937ab5f..2f704c5 100644
--- a/src/is_csv.c
+++ b/src/is_csv.c
@@ -166,7 +166,9 @@ file_is_csv(struct magic_set *ms, const struct buffer *b, int looks_text)
 #include <sys/stat.h>
 #include <stdio.h>
 #include <fcntl.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <stdlib.h>
 #include <stdint.h>
 #include <err.h>
diff --git a/src/is_json.c b/src/is_json.c
index 0b12438..997a276 100644
--- a/src/is_json.c
+++ b/src/is_json.c
@@ -436,7 +436,9 @@ file_is_json(struct magic_set *ms, const struct buffer *b)
 #include <sys/stat.h>
 #include <stdio.h>
 #include <fcntl.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <stdlib.h>
 #include <stdint.h>
 #include <err.h>
diff --git a/src/magic.c b/src/magic.c
index 81a0840..e9aeafa 100644
--- a/src/magic.c
+++ b/src/magic.c
@@ -39,7 +39,9 @@ FILE_RCSID("@(#)$File: magic.c,v 1.114 2021/02/05 21:33:49 christos Exp $")
 #include "magic.h"
 
 #include <stdlib.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <string.h>
 #ifdef QUICK
 #include <sys/mman.h>
diff --git a/src/memtest.c b/src/memtest.c
index f9506f6..ea50242 100644
--- a/src/memtest.c
+++ b/src/memtest.c
@@ -34,7 +34,9 @@
 #include <stdlib.h>
 #include <err.h>
 #include <fcntl.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <dlfcn.h>
 #include <magic.h>
 
diff --git a/src/mygetopt.h b/src/mygetopt.h
index d766762..b8e044c 100644
--- a/src/mygetopt.h
+++ b/src/mygetopt.h
@@ -39,7 +39,9 @@
 #ifndef _GETOPT_H_
 #define _GETOPT_H_
 
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 /*
  * Gnu like getopt_long() and BSD4.4 getsubopt()/optreset extensions
diff --git a/src/pread.c b/src/pread.c
index 3ab52d1..fc48d84 100644
--- a/src/pread.c
+++ b/src/pread.c
@@ -3,7 +3,9 @@
 FILE_RCSID("@(#)$File: pread.c,v 1.2 2013/04/02 16:23:07 christos Exp $")
 #endif  /* lint */
 #include <fcntl.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 
 ssize_t
 pread(int fd, void *buf, size_t len, off_t off) {
diff --git a/src/readcdf.c b/src/readcdf.c
index 7622c7b..977cb75 100644
--- a/src/readcdf.c
+++ b/src/readcdf.c
@@ -31,7 +31,9 @@ FILE_RCSID("@(#)$File: readcdf.c,v 1.74 2019/09/11 15:46:30 christos Exp $")
 
 #include <assert.h>
 #include <stdlib.h>
+#ifdef HAVE_UNISTD_H
 #include <unistd.h>
+#endif
 #include <string.h>
 #include <time.h>
 #include <ctype.h>
-- 
2.29.2.windows.2