r8302: import mini HEIMDAL into the tree
[samba.git] / source4 / heimdal / lib / roken / roken.h
1 /* -*- C -*- */
2 /*
3  * Copyright (c) 1995-2005 Kungliga Tekniska Högskolan
4  * (Royal Institute of Technology, Stockholm, Sweden).
5  * All rights reserved.
6  * 
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 
18  * 3. Neither the name of the Institute nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21  * 
22  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
26  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  */
34
35 /* $Id: roken.h.in,v 1.175 2005/07/07 19:16:17 lha Exp $ */
36
37 #include <stdio.h>
38 #include <stdlib.h>
39 #include <stdarg.h>
40 #include <string.h>
41 #include <signal.h>
42
43 #ifdef _AIX
44 struct ether_addr;
45 struct sockaddr_dl;
46 #endif
47 #ifdef HAVE_SYS_PARAM_H
48 #include <sys/param.h>
49 #endif
50 #ifdef HAVE_INTTYPES_H
51 #include <inttypes.h>
52 #endif
53 #ifdef HAVE_SYS_TYPES_H
54 #include <sys/types.h>
55 #endif
56 #ifdef HAVE_SYS_BITYPES_H
57 #include <sys/bitypes.h>
58 #endif
59 #ifdef HAVE_BIND_BITYPES_H
60 #include <bind/bitypes.h>
61 #endif
62 #ifdef HAVE_NETINET_IN6_MACHTYPES_H
63 #include <netinet/in6_machtypes.h>
64 #endif
65 #ifdef HAVE_UNISTD_H
66 #include <unistd.h>
67 #endif
68 #ifdef HAVE_SYS_SOCKET_H
69 #include <sys/socket.h>
70 #endif
71 #ifdef HAVE_SYS_UIO_H
72 #include <sys/uio.h>
73 #endif
74 #ifdef HAVE_GRP_H
75 #include <grp.h>
76 #endif
77 #ifdef HAVE_SYS_STAT_H
78 #include <sys/stat.h>
79 #endif
80 #ifdef HAVE_NETINET_IN_H
81 #include <netinet/in.h>
82 #endif
83 #ifdef HAVE_NETINET_IN6_H
84 #include <netinet/in6.h>
85 #endif
86 #ifdef HAVE_NETINET6_IN6_H
87 #include <netinet6/in6.h>
88 #endif
89 #ifdef HAVE_ARPA_INET_H
90 #include <arpa/inet.h>
91 #endif
92 #ifdef HAVE_NETDB_H
93 #include <netdb.h>
94 #endif
95 #ifdef HAVE_ARPA_NAMESER_H
96 #include <arpa/nameser.h>
97 #endif
98 #ifdef HAVE_RESOLV_H
99 #include <resolv.h>
100 #endif
101 #ifdef HAVE_SYSLOG_H
102 #include <syslog.h>
103 #endif
104 #ifdef HAVE_FCNTL_H
105 #include <fcntl.h>
106 #endif
107 #ifdef HAVE_ERRNO_H
108 #include <errno.h>
109 #endif
110 #include <err.h>
111 #ifdef HAVE_TERMIOS_H
112 #include <termios.h>
113 #endif
114 #if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
115 #include <sys/ioctl.h>
116 #endif
117 #ifdef TIME_WITH_SYS_TIME
118 #include <sys/time.h>
119 #include <time.h>
120 #elif defined(HAVE_SYS_TIME_H)
121 #include <sys/time.h>
122 #else
123 #include <time.h>
124 #endif
125 #ifdef HAVE_STRINGS_H
126 #include <strings.h>
127 #endif
128
129 #ifdef HAVE_PATHS_H
130 #include <paths.h>
131 #endif
132
133 #ifndef HAVE_SSIZE_T
134 typedef int ssize_t;
135 #endif
136
137 #include <roken-common.h>
138
139 ROKEN_CPP_START
140
141 #if !defined(HAVE_SETSID) && defined(HAVE__SETSID)
142 #define setsid _setsid
143 #endif
144
145 #ifndef HAVE_PUTENV
146 int ROKEN_LIB_FUNCTION putenv(const char *string);
147 #endif
148
149 #if !defined(HAVE_SETENV) || defined(NEED_SETENV_PROTO)
150 int ROKEN_LIB_FUNCTION setenv(const char *var, const char *val, int rewrite);
151 #endif
152
153 #if !defined(HAVE_UNSETENV) || defined(NEED_UNSETENV_PROTO)
154 void ROKEN_LIB_FUNCTION unsetenv(const char *name);
155 #endif
156
157 #if !defined(HAVE_GETUSERSHELL) || defined(NEED_GETUSERSHELL_PROTO)
158 char * ROKEN_LIB_FUNCTION getusershell(void);
159 void ROKEN_LIB_FUNCTION endusershell(void);
160 #endif
161
162 #if !defined(HAVE_SNPRINTF) || defined(NEED_SNPRINTF_PROTO)
163 int ROKEN_LIB_FUNCTION snprintf (char *str, size_t sz, const char *format, ...)
164      __attribute__ ((format (printf, 3, 4)));
165 #endif
166
167 #if !defined(HAVE_VSNPRINTF) || defined(NEED_VSNPRINTF_PROTO)
168 int ROKEN_LIB_FUNCTION 
169      vsnprintf (char *str, size_t sz, const char *format, va_list ap)
170      __attribute__((format (printf, 3, 0)));
171 #endif
172
173 #if !defined(HAVE_ASPRINTF) || defined(NEED_ASPRINTF_PROTO)
174 int ROKEN_LIB_FUNCTION
175      asprintf (char **ret, const char *format, ...)
176      __attribute__ ((format (printf, 2, 3)));
177 #endif
178
179 #if !defined(HAVE_VASPRINTF) || defined(NEED_VASPRINTF_PROTO)
180 int ROKEN_LIB_FUNCTION
181     vasprintf (char **ret, const char *format, va_list ap)
182      __attribute__((format (printf, 2, 0)));
183 #endif
184
185 #if !defined(HAVE_ASNPRINTF) || defined(NEED_ASNPRINTF_PROTO)
186 int ROKEN_LIB_FUNCTION
187     asnprintf (char **ret, size_t max_sz, const char *format, ...)
188      __attribute__ ((format (printf, 3, 4)));
189 #endif
190
191 #if !defined(HAVE_VASNPRINTF) || defined(NEED_VASNPRINTF_PROTO)
192 int ROKEN_LIB_FUNCTION
193     vasnprintf (char **ret, size_t max_sz, const char *format, va_list ap)
194      __attribute__((format (printf, 3, 0)));
195 #endif
196
197 #ifndef HAVE_STRDUP
198 char * ROKEN_LIB_FUNCTION strdup(const char *old);
199 #endif
200
201 #if !defined(HAVE_STRNDUP) || defined(NEED_STRNDUP_PROTO)
202 char * ROKEN_LIB_FUNCTION strndup(const char *old, size_t sz);
203 #endif
204
205 #ifndef HAVE_STRLWR
206 char * ROKEN_LIB_FUNCTION strlwr(char *);
207 #endif
208
209 #ifndef HAVE_STRNLEN
210 size_t ROKEN_LIB_FUNCTION strnlen(const char*, size_t);
211 #endif
212
213 #if !defined(HAVE_STRSEP) || defined(NEED_STRSEP_PROTO)
214 char * ROKEN_LIB_FUNCTION strsep(char**, const char*);
215 #endif
216
217 #if !defined(HAVE_STRSEP_COPY) || defined(NEED_STRSEP_COPY_PROTO)
218 ssize_t ROKEN_LIB_FUNCTION strsep_copy(const char**, const char*, char*, size_t);
219 #endif
220
221 #ifndef HAVE_STRCASECMP
222 int ROKEN_LIB_FUNCTION strcasecmp(const char *s1, const char *s2);
223 #endif
224
225 #ifdef NEED_FCLOSE_PROTO
226 int ROKEN_LIB_FUNCTION fclose(FILE *);
227 #endif
228
229 #ifdef NEED_STRTOK_R_PROTO
230 char * ROKEN_LIB_FUNCTION strtok_r(char *s1, const char *s2, char **lasts);
231 #endif
232
233 #ifndef HAVE_STRUPR
234 char * ROKEN_LIB_FUNCTION strupr(char *);
235 #endif
236
237 #ifndef HAVE_STRLCPY
238 size_t ROKEN_LIB_FUNCTION strlcpy (char *dst, const char *src, size_t dst_sz);
239 #endif
240
241 #ifndef HAVE_STRLCAT
242 size_t ROKEN_LIB_FUNCTION strlcat (char *dst, const char *src, size_t dst_sz);
243 #endif
244
245 #ifndef HAVE_GETDTABLESIZE
246 int ROKEN_LIB_FUNCTION getdtablesize(void);
247 #endif
248
249 #if !defined(HAVE_STRERROR) && !defined(strerror)
250 char * ROKEN_LIB_FUNCTION strerror(int eno);
251 #endif
252
253 #if !defined(HAVE_HSTRERROR) || defined(NEED_HSTRERROR_PROTO)
254 /* This causes a fatal error under Psoriasis */
255 #if !(defined(SunOS) && (SunOS >= 50))
256 const char * ROKEN_LIB_FUNCTION hstrerror(int herr);
257 #endif
258 #endif
259
260 #if !HAVE_DECL_H_ERRNO
261 extern int h_errno;
262 #endif
263
264 #if !defined(HAVE_INET_ATON) || defined(NEED_INET_ATON_PROTO)
265 int ROKEN_LIB_FUNCTION inet_aton(const char *cp, struct in_addr *adr);
266 #endif
267
268 #ifndef HAVE_INET_NTOP
269 const char * ROKEN_LIB_FUNCTION
270 inet_ntop(int af, const void *src, char *dst, size_t size);
271 #endif
272
273 #ifndef HAVE_INET_PTON
274 int ROKEN_LIB_FUNCTION
275 inet_pton(int af, const char *src, void *dst);
276 #endif
277
278 #if !defined(HAVE_GETCWD)
279 char* ROKEN_LIB_FUNCTION getcwd(char *path, size_t size);
280 #endif
281
282 #ifdef HAVE_PWD_H
283 #include <pwd.h>
284 struct passwd * ROKEN_LIB_FUNCTION k_getpwnam (const char *user);
285 struct passwd * ROKEN_LIB_FUNCTION k_getpwuid (uid_t uid);
286 #endif
287
288 const char * ROKEN_LIB_FUNCTION get_default_username (void);
289
290 #ifndef HAVE_SETEUID
291 int ROKEN_LIB_FUNCTION seteuid(uid_t euid);
292 #endif
293
294 #ifndef HAVE_SETEGID
295 int ROKEN_LIB_FUNCTION setegid(gid_t egid);
296 #endif
297
298 #ifndef HAVE_LSTAT
299 int ROKEN_LIB_FUNCTION lstat(const char *path, struct stat *buf);
300 #endif
301
302 #if !defined(HAVE_MKSTEMP) || defined(NEED_MKSTEMP_PROTO)
303 int ROKEN_LIB_FUNCTION mkstemp(char *);
304 #endif
305
306 #ifndef HAVE_CGETENT
307 int ROKEN_LIB_FUNCTION cgetent(char **buf, char **db_array, const char *name);
308 int ROKEN_LIB_FUNCTION cgetstr(char *buf, const char *cap, char **str);
309 #endif
310
311 #ifndef HAVE_INITGROUPS
312 int ROKEN_LIB_FUNCTION initgroups(const char *name, gid_t basegid);
313 #endif
314
315 #ifndef HAVE_FCHOWN
316 int ROKEN_LIB_FUNCTION fchown(int fd, uid_t owner, gid_t group);
317 #endif
318
319 #if !defined(HAVE_DAEMON) || defined(NEED_DAEMON_PROTO)
320 int ROKEN_LIB_FUNCTION daemon(int nochdir, int noclose);
321 #endif
322
323 #ifndef HAVE_INNETGR
324 int ROKEN_LIB_FUNCTION innetgr(const char *netgroup, const char *machine, 
325             const char *user, const char *domain);
326 #endif
327
328 #ifndef HAVE_CHOWN
329 int ROKEN_LIB_FUNCTION chown(const char *path, uid_t owner, gid_t group);
330 #endif
331
332 #ifndef HAVE_RCMD
333 int ROKEN_LIB_FUNCTION
334     rcmd(char **ahost, unsigned short inport, const char *locuser,
335          const char *remuser, const char *cmd, int *fd2p);
336 #endif
337
338 #if !defined(HAVE_INNETGR) || defined(NEED_INNETGR_PROTO)
339 int ROKEN_LIB_FUNCTION innetgr(const char*, const char*,
340     const char*, const char*);
341 #endif
342
343 #ifndef HAVE_IRUSEROK
344 int ROKEN_LIB_FUNCTION iruserok(unsigned raddr, int superuser, 
345     const char *ruser, const char *luser);
346 #endif
347
348 #if !defined(HAVE_GETHOSTNAME) || defined(NEED_GETHOSTNAME_PROTO)
349 int ROKEN_LIB_FUNCTION gethostname(char *name, int namelen);
350 #endif
351
352 #ifndef HAVE_WRITEV
353 ssize_t ROKEN_LIB_FUNCTION
354 writev(int d, const struct iovec *iov, int iovcnt);
355 #endif
356
357 #ifndef HAVE_READV
358 ssize_t ROKEN_LIB_FUNCTION
359 readv(int d, const struct iovec *iov, int iovcnt);
360 #endif
361
362 #ifndef HAVE_MKSTEMP
363 int ROKEN_LIB_FUNCTION
364 mkstemp(char *template);
365 #endif
366
367 #ifndef HAVE_PIDFILE
368 void ROKEN_LIB_FUNCTION pidfile (const char*);
369 #endif
370
371 #ifndef HAVE_BSWAP32
372 unsigned int ROKEN_LIB_FUNCTION bswap32(unsigned int);
373 #endif
374
375 #ifndef HAVE_BSWAP16
376 unsigned short ROKEN_LIB_FUNCTION bswap16(unsigned short);
377 #endif
378
379 #ifndef HAVE_FLOCK
380 #ifndef LOCK_SH
381 #define LOCK_SH   1             /* Shared lock */
382 #endif
383 #ifndef LOCK_EX
384 #define LOCK_EX   2             /* Exclusive lock */
385 #endif
386 #ifndef LOCK_NB
387 #define LOCK_NB   4             /* Don't block when locking */
388 #endif
389 #ifndef LOCK_UN
390 #define LOCK_UN   8             /* Unlock */
391 #endif
392
393 int flock(int fd, int operation);
394 #endif /* HAVE_FLOCK */
395
396 time_t ROKEN_LIB_FUNCTION tm2time (struct tm tm, int local);
397
398 int ROKEN_LIB_FUNCTION unix_verify_user(char *user, char *password);
399
400 int ROKEN_LIB_FUNCTION roken_concat (char *s, size_t len, ...);
401
402 size_t ROKEN_LIB_FUNCTION roken_mconcat (char **s, size_t max_len, ...);
403
404 int ROKEN_LIB_FUNCTION roken_vconcat (char *s, size_t len, va_list args);
405
406 size_t ROKEN_LIB_FUNCTION
407     roken_vmconcat (char **s, size_t max_len, va_list args);
408
409 ssize_t ROKEN_LIB_FUNCTION net_write (int fd, const void *buf, size_t nbytes);
410
411 ssize_t ROKEN_LIB_FUNCTION net_read (int fd, void *buf, size_t nbytes);
412
413 int ROKEN_LIB_FUNCTION issuid(void);
414
415 #ifndef HAVE_STRUCT_WINSIZE
416 struct winsize {
417         unsigned short ws_row, ws_col;
418         unsigned short ws_xpixel, ws_ypixel;
419 };
420 #endif
421
422 int ROKEN_LIB_FUNCTION get_window_size(int fd, struct winsize *);
423
424 #ifndef HAVE_VSYSLOG
425 void ROKEN_LIB_FUNCTION vsyslog(int pri, const char *fmt, va_list ap);
426 #endif
427
428 #if !HAVE_DECL_OPTARG
429 extern char *optarg;
430 #endif
431 #if !HAVE_DECL_OPTIND
432 extern int optind;
433 #endif
434 #if !HAVE_DECL_OPTERR
435 extern int opterr;
436 #endif
437
438 #if !HAVE_DECL_ENVIRON
439 extern char **environ;
440 #endif
441
442 #ifndef HAVE_GETIPNODEBYNAME
443 struct hostent * ROKEN_LIB_FUNCTION
444 getipnodebyname (const char *name, int af, int flags, int *error_num);
445 #endif
446
447 #ifndef HAVE_GETIPNODEBYADDR
448 struct hostent * ROKEN_LIB_FUNCTION
449 getipnodebyaddr (const void *src, size_t len, int af, int *error_num);
450 #endif
451
452 #ifndef HAVE_FREEHOSTENT
453 void ROKEN_LIB_FUNCTION
454 freehostent (struct hostent *h);
455 #endif
456
457 #ifndef HAVE_COPYHOSTENT
458 struct hostent * ROKEN_LIB_FUNCTION
459 copyhostent (const struct hostent *h);
460 #endif
461
462 #ifndef HAVE_SOCKLEN_T
463 typedef int socklen_t;
464 #endif
465
466 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
467
468 #ifndef HAVE_SA_FAMILY_T
469 typedef unsigned short sa_family_t;
470 #endif
471
472 #ifdef HAVE_IPV6
473 #define _SS_MAXSIZE sizeof(struct sockaddr_in6)
474 #else
475 #define _SS_MAXSIZE sizeof(struct sockaddr_in)
476 #endif
477
478 #define _SS_ALIGNSIZE   sizeof(unsigned long)
479
480 #if HAVE_STRUCT_SOCKADDR_SA_LEN
481
482 typedef unsigned char roken_sa_family_t;
483
484 #define _SS_PAD1SIZE   ((2 * _SS_ALIGNSIZE - sizeof (roken_sa_family_t) - sizeof(unsigned char)) % _SS_ALIGNSIZE)
485 #define _SS_PAD2SIZE   (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + sizeof(unsigned char) + _SS_PAD1SIZE + _SS_ALIGNSIZE))
486
487 struct sockaddr_storage {
488     unsigned char       ss_len;
489     roken_sa_family_t   ss_family;
490     char                __ss_pad1[_SS_PAD1SIZE];
491     unsigned long       __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1];
492 };
493
494 #else /* !HAVE_STRUCT_SOCKADDR_SA_LEN */
495
496 typedef unsigned short roken_sa_family_t;
497
498 #define _SS_PAD1SIZE   ((2 * _SS_ALIGNSIZE - sizeof (roken_sa_family_t)) % _SS_ALIGNSIZE)
499 #define _SS_PAD2SIZE   (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + _SS_PAD1SIZE + _SS_ALIGNSIZE))
500
501 struct sockaddr_storage {
502     roken_sa_family_t   ss_family;
503     char                __ss_pad1[_SS_PAD1SIZE];
504     unsigned long       __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1];
505 };
506
507 #endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
508
509 #endif /* HAVE_STRUCT_SOCKADDR_STORAGE */
510
511 #ifndef HAVE_STRUCT_ADDRINFO
512 struct addrinfo {
513     int    ai_flags;
514     int    ai_family;
515     int    ai_socktype;
516     int    ai_protocol;
517     size_t ai_addrlen;
518     char  *ai_canonname;
519     struct sockaddr *ai_addr;
520     struct addrinfo *ai_next;
521 };
522 #endif
523
524 #ifndef HAVE_GETADDRINFO
525 int ROKEN_LIB_FUNCTION
526 getaddrinfo(const char *nodename,
527             const char *servname,
528             const struct addrinfo *hints,
529             struct addrinfo **res);
530 #endif
531
532 #ifndef HAVE_GETNAMEINFO
533 int ROKEN_LIB_FUNCTION
534 getnameinfo(const struct sockaddr *sa, socklen_t salen,
535                 char *host, size_t hostlen,
536                 char *serv, size_t servlen,
537                 int flags);
538 #endif
539
540 #ifndef HAVE_FREEADDRINFO
541 void ROKEN_LIB_FUNCTION
542 freeaddrinfo(struct addrinfo *ai);
543 #endif
544
545 #ifndef HAVE_GAI_STRERROR
546 char * ROKEN_LIB_FUNCTION
547 gai_strerror(int ecode);
548 #endif
549
550 int ROKEN_LIB_FUNCTION
551 getnameinfo_verified(const struct sockaddr *sa, socklen_t salen,
552                      char *host, size_t hostlen,
553                      char *serv, size_t servlen,
554                      int flags);
555
556 int ROKEN_LIB_FUNCTION
557 roken_getaddrinfo_hostspec(const char *, int, struct addrinfo **); 
558 int ROKEN_LIB_FUNCTION
559 roken_getaddrinfo_hostspec2(const char *, int, int, struct addrinfo **);
560
561 #ifndef HAVE_STRFTIME
562 size_t ROKEN_LIB_FUNCTION
563 strftime (char *buf, size_t maxsize, const char *format,
564           const struct tm *tm);
565 #endif
566
567 #ifndef HAVE_STRPTIME
568 char * ROKEN_LIB_FUNCTION
569 strptime (const char *buf, const char *format, struct tm *timeptr);
570 #endif
571
572 #ifndef HAVE_EMALLOC
573 void * ROKEN_LIB_FUNCTION emalloc (size_t);
574 #endif
575 #ifndef HAVE_ECALLOC
576 void * ROKEN_LIB_FUNCTION ecalloc(size_t num, size_t sz);
577 #endif
578 #ifndef HAVE_EREALLOC
579 void * ROKEN_LIB_FUNCTION erealloc (void *, size_t);
580 #endif
581 #ifndef HAVE_ESTRDUP
582 char * ROKEN_LIB_FUNCTION estrdup (const char *);
583 #endif
584
585 /*
586  * kludges and such
587  */
588
589 #if 1
590 int ROKEN_LIB_FUNCTION
591 roken_gethostby_setup(const char*, const char*);
592 struct hostent* ROKEN_LIB_FUNCTION
593 roken_gethostbyname(const char*);
594 struct hostent* ROKEN_LIB_FUNCTION 
595 roken_gethostbyaddr(const void*, size_t, int);
596 #else
597 #ifdef GETHOSTBYNAME_PROTO_COMPATIBLE
598 #define roken_gethostbyname(x) gethostbyname(x)
599 #else
600 #define roken_gethostbyname(x) gethostbyname((char *)x)
601 #endif
602
603 #ifdef GETHOSTBYADDR_PROTO_COMPATIBLE
604 #define roken_gethostbyaddr(a, l, t) gethostbyaddr(a, l, t)
605 #else
606 #define roken_gethostbyaddr(a, l, t) gethostbyaddr((char *)a, l, t)
607 #endif
608 #endif
609
610 #ifdef GETSERVBYNAME_PROTO_COMPATIBLE
611 #define roken_getservbyname(x,y) getservbyname(x,y)
612 #else
613 #define roken_getservbyname(x,y) getservbyname((char *)x, (char *)y)
614 #endif
615
616 #ifdef OPENLOG_PROTO_COMPATIBLE
617 #define roken_openlog(a,b,c) openlog(a,b,c)
618 #else
619 #define roken_openlog(a,b,c) openlog((char *)a,b,c)
620 #endif
621
622 #ifdef GETSOCKNAME_PROTO_COMPATIBLE
623 #define roken_getsockname(a,b,c) getsockname(a,b,c)
624 #else
625 #define roken_getsockname(a,b,c) getsockname(a, b, (void*)c)
626 #endif
627
628 #ifndef HAVE_SETPROGNAME
629 void ROKEN_LIB_FUNCTION setprogname(const char *argv0);
630 #endif
631
632 #ifndef HAVE_GETPROGNAME
633 const char * ROKEN_LIB_FUNCTION getprogname(void);
634 #endif
635
636 #if !defined(HAVE_SETPROGNAME) && !defined(HAVE_GETPROGNAME) && !HAVE_DECL___PROGNAME
637 extern const char *__progname;
638 #endif
639
640 void ROKEN_LIB_FUNCTION mini_inetd_addrinfo (struct addrinfo*);
641 void ROKEN_LIB_FUNCTION mini_inetd (int port);
642
643 #ifndef HAVE_LOCALTIME_R
644 struct tm * ROKEN_LIB_FUNCTION
645 localtime_r(const time_t *timer, struct tm *result);
646 #endif
647
648 #if !defined(HAVE_STRSVIS) || defined(NEED_STRSVIS_PROTO)
649 int ROKEN_LIB_FUNCTION
650 strsvis(char *dst, const char *src, int flag, const char *extra);
651 #endif
652
653 #if !defined(HAVE_STRUNVIS) || defined(NEED_STRUNVIS_PROTO)
654 int ROKEN_LIB_FUNCTION
655 strunvis(char *dst, const char *src);
656 #endif
657
658 #if !defined(HAVE_STRVIS) || defined(NEED_STRVIS_PROTO)
659 int ROKEN_LIB_FUNCTION
660 strvis(char *dst, const char *src, int flag);
661 #endif
662
663 #if !defined(HAVE_STRVISX) || defined(NEED_STRVISX_PROTO)
664 int ROKEN_LIB_FUNCTION
665 strvisx(char *dst, const char *src, size_t len, int flag);
666 #endif
667
668 #if !defined(HAVE_SVIS) || defined(NEED_SVIS_PROTO)
669 char * ROKEN_LIB_FUNCTION
670 svis(char *dst, int c, int flag, int nextc, const char *extra);
671 #endif
672
673 #if !defined(HAVE_UNVIS) || defined(NEED_UNVIS_PROTO)
674 int ROKEN_LIB_FUNCTION
675 unvis(char *cp, int c, int *astate, int flag);
676 #endif
677
678 #if !defined(HAVE_VIS) || defined(NEED_VIS_PROTO)
679 char * ROKEN_LIB_FUNCTION
680 vis(char *dst, int c, int flag, int nextc);
681 #endif
682
683 #if !defined(HAVE_CLOSEFROM)
684 int ROKEN_LIB_FUNCTION
685 closefrom(int);
686 #endif
687
688 ROKEN_CPP_END