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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
|
Port to C99, fix glibc-specific defines, missing or bad includes
https://bugs.gentoo.org/880341
--- a/arc4random.c
+++ b/arc4random.c
@@ -1,5 +1,6 @@
#include <sys/types.h>
#include <stdlib.h>
+#include <time.h>
#include "config.h"
@@ -9,8 +10,8 @@
* application anyway. Screw you, hippy!
*/
-u_int32_t
-arc4random(void)
+u_int32_t arc4random(void);
+u_int32_t arc4random(void)
{
static int init;
--- a/dnsres.h
+++ b/dnsres.h
@@ -118,10 +118,7 @@
#define _DNSRES_H_
#include <sys/param.h>
-#if (!defined(BSD)) || (BSD < 199306)
-# include <sys/bitypes.h>
-#endif
-#include <sys/cdefs.h>
+#include <sys/types.h>
/*
* Type values for resources and queries
@@ -373,7 +370,10 @@
};
#endif
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct addrinfo;
struct dnsres;
struct dnsres_cbstate;
@@ -431,7 +431,10 @@
int dnsres_net_addrcmp(struct sockaddr *, struct sockaddr *);
int dnsres_getrrsetbyname(const char *, unsigned int, unsigned int, unsigned int, struct dnsres_rrsetinfo **);
void dnsres_freerrset(struct dnsres_rrsetinfo *);
-__END_DECLS
+
+#ifdef __cplusplus
+}
+#endif
/*
* Global defines and variables for resolver stub.
--- a/resolv.h
+++ b/resolv.h
@@ -119,12 +119,7 @@
#define _RESOLV_H_
#include <sys/param.h>
-#if (!defined(BSD)) || (BSD < 199306)
-# include <sys/bitypes.h>
-#else
# include <sys/types.h>
-#endif
-#include <sys/cdefs.h>
#include <sys/socket.h>
#include <stdio.h>
@@ -275,7 +270,10 @@
struct dnsres_target;
struct res_search_state;
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
+
int res_hnok(const char *);
int res_ownok(const char *);
int res_mailok(const char *);
@@ -353,7 +351,10 @@
void res_close(struct dnsres_socket *);
unsigned short getshort(const unsigned char *);
unsigned int getlong(const unsigned char *);
-__END_DECLS
+
+#ifdef __cplusplus
+}
+#endif
#ifndef HAVE_FGETLN
char *fgetln(FILE *, size_t *);
--- a/res_debug.c
+++ b/res_debug.c
@@ -109,8 +109,7 @@
/* XXX: we should use getservbyport() instead. */
static const char *
-dewks(wks)
- int wks;
+dewks(int wks)
{
static char nbuf[20];
@@ -169,8 +168,7 @@
/* XXX: we should use getprotobynumber() instead. */
static const char *
-deproto(protonum)
- int protonum;
+deproto(int protonum)
{
static char nbuf[20];
@@ -390,10 +388,7 @@
}
const u_char *
-__dnsres_p_cdnname(cp, msg, len, file)
- const u_char *cp, *msg;
- int len;
- FILE *file;
+__dnsres_p_cdnname(const u_char *cp, const u_char *msg, int len, FILE *file)
{
char name[DNSRES_MAXDNAME];
int n;
@@ -420,11 +415,7 @@
length supplied). */
const u_char *
-__dnsres_p_fqnname(cp, msg, msglen, name, namelen)
- const u_char *cp, *msg;
- int msglen;
- char *name;
- int namelen;
+__dnsres_p_fqnname(const u_char *cp, const u_char *msg, int msglen, char *name, int namelen)
{
int n, newlen;
@@ -444,9 +435,7 @@
*/
const u_char *
-__dnsres_p_fqname(cp, msg, file)
- const u_char *cp, *msg;
- FILE *file;
+__dnsres_p_fqname(const u_char *cp, const u_char *msg, FILE *file)
{
char name[DNSRES_MAXDNAME];
const u_char *n;
@@ -918,10 +907,7 @@
};
int
-__dnsres_sym_ston(syms, name, success)
- const struct res_sym *syms;
- char *name;
- int *success;
+__dnsres_sym_ston(const struct res_sym *syms, char *name, int *success)
{
for (; syms->name != 0; syms++) {
if (strcasecmp (name, syms->name) == 0) {
@@ -936,10 +922,7 @@
}
const char *
-__dnsres_sym_ntos(syms, number, success)
- const struct res_sym *syms;
- int number;
- int *success;
+__dnsres_sym_ntos(const struct res_sym *syms, int number, int *success)
{
static char unname[20];
@@ -959,10 +942,7 @@
const char *
-__dnsres_sym_ntop(syms, number, success)
- const struct res_sym *syms;
- int number;
- int *success;
+__dnsres_sym_ntop(const struct res_sym *syms, int number, int *success)
{
static char unname[20];
@@ -983,8 +963,7 @@
* Return a string for the type
*/
const char *
-__dnsres_p_type(type)
- int type;
+__dnsres_p_type(int type)
{
return (__dnsres_sym_ntos (__dnsres_p_type_syms, type, (int *)0));
}
@@ -993,8 +972,7 @@
* Return a mnemonic for class
*/
const char *
-__dnsres_p_class(class)
- int class;
+__dnsres_p_class(int class)
{
return (__dnsres_sym_ntos (__dnsres_p_class_syms, class, (int *)0));
}
@@ -1003,8 +981,7 @@
* Return a mnemonic for an option
*/
const char *
-__dnsres_p_option(option)
- u_long option;
+__dnsres_p_option(u_long option)
{
static char nbuf[40];
@@ -1033,8 +1010,7 @@
* Return a mnemonic for a time to live
*/
const char *
-p_time(value)
- u_int32_t value;
+p_time(u_int32_t value)
{
static char nbuf[40];
char *ebuf;
@@ -1115,8 +1091,7 @@
/* takes an XeY precision/size value, returns a string representation. */
static const char *
-precsize_ntoa(prec)
- u_int8_t prec;
+precsize_ntoa(u_int8_t prec)
{
static char retbuf[sizeof "90000000.00"];
unsigned long val;
@@ -1133,8 +1108,7 @@
/* converts ascii size/precision X * 10**Y(cm) to 0xXY. moves pointer. */
static u_int8_t
-precsize_aton(strptr)
- char **strptr;
+precsize_aton(unsigned char **strptr)
{
unsigned int mval = 0, cmval = 0;
u_int8_t retval = 0;
@@ -1175,9 +1149,7 @@
/* converts ascii lat/lon to unsigned encoded 32-bit number. moves pointer. */
static u_int32_t
-latlon2ul(latlonstrptr,which)
- char **latlonstrptr;
- int *which;
+latlon2ul(unsigned char **latlonstrptr, int *which)
{
unsigned char *cp;
u_int32_t retval;
@@ -1274,9 +1246,7 @@
/* converts a zone file representation in a string to an RDATA on-the-wire
* representation. */
int
-loc_aton(ascii, binary)
- const char *ascii;
- u_char *binary;
+loc_aton(const char *ascii, u_char *binary)
{
const unsigned char *maxcp;
u_char *bcp;
@@ -1385,19 +1355,14 @@
}
const char *
-loc_ntoa(binary, ascii)
- const u_char *binary;
- char *ascii;
+loc_ntoa(const u_char *binary, char *ascii)
{
return loc_ntoal(binary, ascii, 255);
}
/* takes an on-the-wire LOC RR and formats it in a human readable format. */
static const char *
-loc_ntoal(binary, ascii, ascii_len)
- const u_char *binary;
- char *ascii;
- int ascii_len;
+loc_ntoal(const u_char *binary, char *ascii, int ascii_len)
{
static char *error = "?";
register const u_char *cp = binary;
@@ -1499,8 +1464,7 @@
/* Return the number of DNS hierarchy levels in the name. */
int
-__dnsres_dn_count_labels(name)
- char *name;
+__dnsres_dn_count_labels(char *name)
{
int i, len, count;
@@ -1530,8 +1494,7 @@
* SIG records are required to be printed like this, by the Secure DNS RFC.
*/
char *
-__dnsres_p_secstodate (secs)
- unsigned long secs;
+__dnsres_p_secstodate (unsigned long secs)
{
static char output[15]; /* YYYYMMDDHHMMSS and null */
time_t clock = secs;
|