Remove $Id$
[heimdal.git] / lib / roken / roken.h.in
blobb04559890a82827f9695e20be5bd91ac4f95493a
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:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
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.
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.
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.
35 #include <stdio.h>
36 #include <stdlib.h>
37 #include <stdarg.h>
38 #ifdef HAVE_STDINT_H
39 #include <stdint.h>
40 #endif
41 #include <string.h>
42 #include <signal.h>
44 #ifdef _AIX
45 struct ether_addr;
46 struct sockaddr_dl;
47 #endif
48 #ifdef HAVE_SYS_PARAM_H
49 #include <sys/param.h>
50 #endif
51 #ifdef HAVE_INTTYPES_H
52 #include <inttypes.h>
53 #endif
54 #ifdef HAVE_SYS_TYPES_H
55 #include <sys/types.h>
56 #endif
57 #ifdef HAVE_SYS_BITYPES_H
58 #include <sys/bitypes.h>
59 #endif
60 #ifdef HAVE_BIND_BITYPES_H
61 #include <bind/bitypes.h>
62 #endif
63 #ifdef HAVE_NETINET_IN6_MACHTYPES_H
64 #include <netinet/in6_machtypes.h>
65 #endif
66 #ifdef HAVE_UNISTD_H
67 #include <unistd.h>
68 #endif
69 #ifdef HAVE_SYS_SOCKET_H
70 #include <sys/socket.h>
71 #endif
72 #ifdef HAVE_SYS_UIO_H
73 #include <sys/uio.h>
74 #endif
75 #ifdef HAVE_GRP_H
76 #include <grp.h>
77 #endif
78 #ifdef HAVE_SYS_STAT_H
79 #include <sys/stat.h>
80 #endif
81 #ifdef HAVE_NETINET_IN_H
82 #include <netinet/in.h>
83 #endif
84 #ifdef HAVE_NETINET_IN6_H
85 #include <netinet/in6.h>
86 #endif
87 #ifdef HAVE_NETINET6_IN6_H
88 #include <netinet6/in6.h>
89 #endif
90 #ifdef HAVE_ARPA_INET_H
91 #include <arpa/inet.h>
92 #endif
93 #ifdef HAVE_NETDB_H
94 #include <netdb.h>
95 #endif
96 #ifdef HAVE_ARPA_NAMESER_H
97 #include <arpa/nameser.h>
98 #endif
99 #ifdef HAVE_RESOLV_H
100 #include <resolv.h>
101 #endif
102 #ifdef HAVE_SYSLOG_H
103 #include <syslog.h>
104 #endif
105 #ifdef HAVE_FCNTL_H
106 #include <fcntl.h>
107 #endif
108 #ifdef HAVE_ERRNO_H
109 #include <errno.h>
110 #endif
111 #include <err.h>
112 #ifdef HAVE_TERMIOS_H
113 #include <termios.h>
114 #endif
115 #if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
116 #include <sys/ioctl.h>
117 #endif
118 #ifdef TIME_WITH_SYS_TIME
119 #include <sys/time.h>
120 #include <time.h>
121 #elif defined(HAVE_SYS_TIME_H)
122 #include <sys/time.h>
123 #else
124 #include <time.h>
125 #endif
127 #ifdef HAVE_PATHS_H
128 #include <paths.h>
129 #endif
131 #ifndef HAVE_SSIZE_T
132 typedef int ssize_t;
133 #endif
135 #include <roken-common.h>
137 ROKEN_CPP_START
139 #ifdef HAVE_UINTPTR_T
140 #define rk_UNCONST(x) ((void *)(uintptr_t)(const void *)(x))
141 #else
142 #define rk_UNCONST(x) ((void *)(unsigned long)(const void *)(x))
143 #endif
145 #if !defined(HAVE_SETSID) && defined(HAVE__SETSID)
146 #define setsid _setsid
147 #endif
149 #ifndef HAVE_PUTENV
150 #define putenv rk_putenv
151 int ROKEN_LIB_FUNCTION putenv(const char *);
152 #endif
154 #if !defined(HAVE_SETENV) || defined(NEED_SETENV_PROTO)
155 #ifndef HAVE_SETENV
156 #define setenv rk_setenv
157 #endif
158 int ROKEN_LIB_FUNCTION setenv(const char *, const char *, int);
159 #endif
161 #if !defined(HAVE_UNSETENV) || defined(NEED_UNSETENV_PROTO)
162 #ifndef HAVE_UNSETENV
163 #define unsetenv rk_unsetenv
164 #endif
165 void ROKEN_LIB_FUNCTION unsetenv(const char *);
166 #endif
168 #if !defined(HAVE_GETUSERSHELL) || defined(NEED_GETUSERSHELL_PROTO)
169 #ifndef HAVE_GETUSERSHELL
170 #define getusershell rk_getusershell
171 #define endusershell rk_endusershell
172 #endif
173 char * ROKEN_LIB_FUNCTION getusershell(void);
174 void ROKEN_LIB_FUNCTION endusershell(void);
175 #endif
177 #if !defined(HAVE_SNPRINTF) || defined(NEED_SNPRINTF_PROTO)
178 #ifndef HAVE_SNPRINTF
179 #define snprintf rk_snprintf
180 #endif
181 int ROKEN_LIB_FUNCTION
182 rk_snprintf (char *, size_t, const char *, ...)
183 __attribute__ ((format (printf, 3, 4)));
184 #endif
186 #if !defined(HAVE_VSNPRINTF) || defined(NEED_VSNPRINTF_PROTO)
187 #ifndef HAVE_VSNPRINTF
188 #define vsnprintf rk_vsnprintf
189 #endif
190 int ROKEN_LIB_FUNCTION
191 rk_vsnprintf (char *, size_t, const char *, va_list)
192 __attribute__((format (printf, 3, 0)));
193 #endif
195 #if !defined(HAVE_ASPRINTF) || defined(NEED_ASPRINTF_PROTO)
196 #ifndef HAVE_ASPRINTF
197 #define asprintf rk_asprintf
198 #endif
199 int ROKEN_LIB_FUNCTION
200 rk_asprintf (char **, const char *, ...)
201 __attribute__ ((format (printf, 2, 3)));
202 #endif
204 #if !defined(HAVE_VASPRINTF) || defined(NEED_VASPRINTF_PROTO)
205 #ifndef HAVE_VASPRINTF
206 #define vasprintf rk_vasprintf
207 #endif
208 int ROKEN_LIB_FUNCTION
209 rk_vasprintf (char **, const char *, va_list)
210 __attribute__((format (printf, 2, 0)));
211 #endif
213 #if !defined(HAVE_ASNPRINTF) || defined(NEED_ASNPRINTF_PROTO)
214 #ifndef HAVE_ASNPRINTF
215 #define asnprintf rk_asnprintf
216 #endif
217 int ROKEN_LIB_FUNCTION
218 rk_asnprintf (char **, size_t, const char *, ...)
219 __attribute__ ((format (printf, 3, 4)));
220 #endif
222 #if !defined(HAVE_VASNPRINTF) || defined(NEED_VASNPRINTF_PROTO)
223 #ifndef HAVE_VASNPRINTF
224 #define vasnprintf rk_vasnprintf
225 #endif
226 int ROKEN_LIB_FUNCTION
227 vasnprintf (char **, size_t, const char *, va_list)
228 __attribute__((format (printf, 3, 0)));
229 #endif
231 #ifndef HAVE_STRDUP
232 #define strdup rk_strdup
233 char * ROKEN_LIB_FUNCTION strdup(const char *);
234 #endif
236 #if !defined(HAVE_STRNDUP) || defined(NEED_STRNDUP_PROTO)
237 #ifndef HAVE_STRNDUP
238 #define strndup rk_strndup
239 #endif
240 char * ROKEN_LIB_FUNCTION strndup(const char *, size_t);
241 #endif
243 #ifndef HAVE_STRLWR
244 #define strlwr rk_strlwr
245 char * ROKEN_LIB_FUNCTION strlwr(char *);
246 #endif
248 #ifndef HAVE_STRNLEN
249 #define strnlen rk_strnlen
250 size_t ROKEN_LIB_FUNCTION strnlen(const char*, size_t);
251 #endif
253 #if !defined(HAVE_STRSEP) || defined(NEED_STRSEP_PROTO)
254 #ifndef HAVE_STRSEP
255 #define strsep rk_strsep
256 #endif
257 char * ROKEN_LIB_FUNCTION strsep(char**, const char*);
258 #endif
260 #if !defined(HAVE_STRSEP_COPY) || defined(NEED_STRSEP_COPY_PROTO)
261 #ifndef HAVE_STRSEP_COPY
262 #define strsep_copy rk_strsep_copy
263 #endif
264 ssize_t ROKEN_LIB_FUNCTION strsep_copy(const char**, const char*, char*, size_t);
265 #endif
267 #ifndef HAVE_STRCASECMP
268 #define strcasecmp rk_strcasecmp
269 int ROKEN_LIB_FUNCTION strcasecmp(const char *, const char *);
270 #endif
272 #ifdef NEED_FCLOSE_PROTO
273 int ROKEN_LIB_FUNCTION fclose(FILE *);
274 #endif
276 #ifdef NEED_STRTOK_R_PROTO
277 char * ROKEN_LIB_FUNCTION strtok_r(char *, const char *, char **);
278 #endif
280 #ifndef HAVE_STRUPR
281 #define strupr rk_strupr
282 char * ROKEN_LIB_FUNCTION strupr(char *);
283 #endif
285 #ifndef HAVE_STRLCPY
286 #define strlcpy rk_strlcpy
287 size_t ROKEN_LIB_FUNCTION strlcpy (char *, const char *, size_t);
288 #endif
290 #ifndef HAVE_STRLCAT
291 #define strlcat rk_strlcat
292 size_t ROKEN_LIB_FUNCTION strlcat (char *, const char *, size_t);
293 #endif
295 #ifndef HAVE_GETDTABLESIZE
296 #define getdtablesize rk_getdtablesize
297 int ROKEN_LIB_FUNCTION getdtablesize(void);
298 #endif
300 #if !defined(HAVE_STRERROR) && !defined(strerror)
301 #define strerror rk_strerror
302 char * ROKEN_LIB_FUNCTION strerror(int);
303 #endif
305 #if !defined(HAVE_HSTRERROR) || defined(NEED_HSTRERROR_PROTO)
306 #ifndef HAVE_HSTRERROR
307 #define hstrerror rk_hstrerror
308 #endif
309 /* This causes a fatal error under Psoriasis */
310 #if !(defined(SunOS) && (SunOS >= 50))
311 const char * ROKEN_LIB_FUNCTION hstrerror(int);
312 #endif
313 #endif
315 #if !HAVE_DECL_H_ERRNO
316 extern int h_errno;
317 #endif
319 #if !defined(HAVE_INET_ATON) || defined(NEED_INET_ATON_PROTO)
320 #ifndef HAVE_INET_ATON
321 #define inet_aton rk_inet_aton
322 #endif
323 int ROKEN_LIB_FUNCTION inet_aton(const char *, struct in_addr *);
324 #endif
326 #ifndef HAVE_INET_NTOP
327 #define inet_ntop rk_inet_ntop
328 const char * ROKEN_LIB_FUNCTION
329 inet_ntop(int af, const void *src, char *dst, size_t size);
330 #endif
332 #ifndef HAVE_INET_PTON
333 #define inet_pton rk_inet_pton
334 int ROKEN_LIB_FUNCTION
335 inet_pton(int, const char *, void *);
336 #endif
338 #if !defined(HAVE_GETCWD)
339 #define getcwd rk_getcwd
340 char* ROKEN_LIB_FUNCTION getcwd(char *, size_t);
341 #endif
343 #ifdef HAVE_PWD_H
344 #include <pwd.h>
345 struct passwd * ROKEN_LIB_FUNCTION k_getpwnam (const char *);
346 struct passwd * ROKEN_LIB_FUNCTION k_getpwuid (uid_t);
347 #endif
349 const char * ROKEN_LIB_FUNCTION get_default_username (void);
351 #ifndef HAVE_SETEUID
352 #define seteuid rk_seteuid
353 int ROKEN_LIB_FUNCTION seteuid(uid_t);
354 #endif
356 #ifndef HAVE_SETEGID
357 #define setegid rk_setegid
358 int ROKEN_LIB_FUNCTION setegid(gid_t);
359 #endif
361 #ifndef HAVE_LSTAT
362 #define lstat rk_lstat
363 int ROKEN_LIB_FUNCTION lstat(const char *, struct stat *);
364 #endif
366 #if !defined(HAVE_MKSTEMP) || defined(NEED_MKSTEMP_PROTO)
367 #ifndef HAVE_MKSTEMP
368 #define mkstemp rk_mkstemp
369 #endif
370 int ROKEN_LIB_FUNCTION mkstemp(char *);
371 #endif
373 #ifndef HAVE_CGETENT
374 #define cgetent rk_cgetent
375 #define cgetstr rk_cgetstr
376 int ROKEN_LIB_FUNCTION cgetent(char **, char **, const char *);
377 int ROKEN_LIB_FUNCTION cgetstr(char *, const char *, char **);
378 #endif
380 #ifndef HAVE_INITGROUPS
381 #define initgroups rk_initgroups
382 int ROKEN_LIB_FUNCTION initgroups(const char *, gid_t);
383 #endif
385 #ifndef HAVE_FCHOWN
386 #define fchown rk_fchown
387 int ROKEN_LIB_FUNCTION fchown(int, uid_t, gid_t);
388 #endif
390 #if !defined(HAVE_DAEMON) || defined(NEED_DAEMON_PROTO)
391 #ifndef HAVE_DAEMON
392 #define daemon rk_daemon
393 #endif
394 int ROKEN_LIB_FUNCTION daemon(int, int);
395 #endif
397 #ifndef HAVE_CHOWN
398 #define chown rk_chown
399 int ROKEN_LIB_FUNCTION chown(const char *, uid_t, gid_t);
400 #endif
402 #ifndef HAVE_RCMD
403 #define rcmd rk_rcmd
404 int ROKEN_LIB_FUNCTION
405 rcmd(char **, unsigned short, const char *,
406 const char *, const char *, int *);
407 #endif
409 #if !defined(HAVE_INNETGR) || defined(NEED_INNETGR_PROTO)
410 #ifndef HAVE_INNETGR
411 #define innetgr rk_innetgr
412 #endif
413 int ROKEN_LIB_FUNCTION innetgr(const char*, const char*,
414 const char*, const char*);
415 #endif
417 #ifndef HAVE_IRUSEROK
418 #define iruserok rk_iruserok
419 int ROKEN_LIB_FUNCTION iruserok(unsigned, int,
420 const char *, const char *);
421 #endif
423 #if !defined(HAVE_GETHOSTNAME) || defined(NEED_GETHOSTNAME_PROTO)
424 #ifndef HAVE_GETHOSTNAME
425 #define gethostname rk_gethostname
426 #endif
427 int ROKEN_LIB_FUNCTION gethostname(char *, int);
428 #endif
430 #ifndef HAVE_WRITEV
431 #define writev rk_writev
432 ssize_t ROKEN_LIB_FUNCTION
433 writev(int, const struct iovec *, int);
434 #endif
436 #ifndef HAVE_READV
437 #define readv rk_readv
438 ssize_t ROKEN_LIB_FUNCTION
439 readv(int, const struct iovec *, int);
440 #endif
442 #ifndef HAVE_PIDFILE
443 #define pidfile rk_pidfile
444 void ROKEN_LIB_FUNCTION pidfile (const char*);
445 #endif
447 #ifndef HAVE_BSWAP32
448 #define bswap32 rk_bswap32
449 unsigned int ROKEN_LIB_FUNCTION bswap32(unsigned int);
450 #endif
452 #ifndef HAVE_BSWAP16
453 #define bswap16 rk_bswap16
454 unsigned short ROKEN_LIB_FUNCTION bswap16(unsigned short);
455 #endif
457 #ifndef HAVE_FLOCK
458 #ifndef LOCK_SH
459 #define LOCK_SH 1 /* Shared lock */
460 #endif
461 #ifndef LOCK_EX
462 #define LOCK_EX 2 /* Exclusive lock */
463 #endif
464 #ifndef LOCK_NB
465 #define LOCK_NB 4 /* Don't block when locking */
466 #endif
467 #ifndef LOCK_UN
468 #define LOCK_UN 8 /* Unlock */
469 #endif
471 #define flock(_x,_y) rk_flock(_x,_y)
472 int rk_flock(int fd, int operation);
473 #endif /* HAVE_FLOCK */
475 #ifdef SunOS
476 #define dirfd(x) ((x)->dd_fd)
477 #endif
479 time_t ROKEN_LIB_FUNCTION tm2time (struct tm, int);
481 int ROKEN_LIB_FUNCTION unix_verify_user(char *, char *);
483 int ROKEN_LIB_FUNCTION roken_concat (char *, size_t, ...);
485 size_t ROKEN_LIB_FUNCTION roken_mconcat (char **, size_t, ...);
487 int ROKEN_LIB_FUNCTION roken_vconcat (char *, size_t, va_list);
489 size_t ROKEN_LIB_FUNCTION
490 roken_vmconcat (char **, size_t, va_list);
492 ssize_t ROKEN_LIB_FUNCTION net_write (int, const void *, size_t);
494 ssize_t ROKEN_LIB_FUNCTION net_read (int, void *, size_t);
496 int ROKEN_LIB_FUNCTION issuid(void);
498 #ifndef HAVE_STRUCT_WINSIZE
499 struct winsize {
500 unsigned short ws_row, ws_col;
501 unsigned short ws_xpixel, ws_ypixel;
503 #endif
505 int ROKEN_LIB_FUNCTION get_window_size(int fd, struct winsize *);
507 #ifndef HAVE_VSYSLOG
508 #define vsyslog rk_vsyslog
509 void ROKEN_LIB_FUNCTION vsyslog(int, const char *, va_list);
510 #endif
512 #if !HAVE_DECL_OPTARG
513 extern char *optarg;
514 #endif
515 #if !HAVE_DECL_OPTIND
516 extern int optind;
517 #endif
518 #if !HAVE_DECL_OPTERR
519 extern int opterr;
520 #endif
522 #ifndef HAVE_GETIPNODEBYNAME
523 #define getipnodebyname rk_getipnodebyname
524 struct hostent * ROKEN_LIB_FUNCTION
525 getipnodebyname (const char *, int, int, int *);
526 #endif
528 #ifndef HAVE_GETIPNODEBYADDR
529 #define getipnodebyaddr rk_getipnodebyaddr
530 struct hostent * ROKEN_LIB_FUNCTION
531 getipnodebyaddr (const void *, size_t, int, int *);
532 #endif
534 #ifndef HAVE_FREEHOSTENT
535 #define freehostent rk_freehostent
536 void ROKEN_LIB_FUNCTION
537 freehostent (struct hostent *);
538 #endif
540 #ifndef HAVE_COPYHOSTENT
541 #define copyhostent rk_copyhostent
542 struct hostent * ROKEN_LIB_FUNCTION
543 copyhostent (const struct hostent *);
544 #endif
546 #ifndef HAVE_SOCKLEN_T
547 typedef int socklen_t;
548 #endif
550 #ifndef HAVE_STRUCT_SOCKADDR_STORAGE
552 #ifndef HAVE_SA_FAMILY_T
553 typedef unsigned short sa_family_t;
554 #endif
556 #ifdef HAVE_IPV6
557 #define _SS_MAXSIZE sizeof(struct sockaddr_in6)
558 #else
559 #define _SS_MAXSIZE sizeof(struct sockaddr_in)
560 #endif
562 #define _SS_ALIGNSIZE sizeof(unsigned long)
564 #if HAVE_STRUCT_SOCKADDR_SA_LEN
566 typedef unsigned char roken_sa_family_t;
568 #define _SS_PAD1SIZE ((2 * _SS_ALIGNSIZE - sizeof (roken_sa_family_t) - sizeof(unsigned char)) % _SS_ALIGNSIZE)
569 #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + sizeof(unsigned char) + _SS_PAD1SIZE + _SS_ALIGNSIZE))
571 struct sockaddr_storage {
572 unsigned char ss_len;
573 roken_sa_family_t ss_family;
574 char __ss_pad1[_SS_PAD1SIZE];
575 unsigned long __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1];
578 #else /* !HAVE_STRUCT_SOCKADDR_SA_LEN */
580 typedef unsigned short roken_sa_family_t;
582 #define _SS_PAD1SIZE ((2 * _SS_ALIGNSIZE - sizeof (roken_sa_family_t)) % _SS_ALIGNSIZE)
583 #define _SS_PAD2SIZE (_SS_MAXSIZE - (sizeof (roken_sa_family_t) + _SS_PAD1SIZE + _SS_ALIGNSIZE))
585 struct sockaddr_storage {
586 roken_sa_family_t ss_family;
587 char __ss_pad1[_SS_PAD1SIZE];
588 unsigned long __ss_align[_SS_PAD2SIZE / sizeof(unsigned long) + 1];
591 #endif /* HAVE_STRUCT_SOCKADDR_SA_LEN */
593 #endif /* HAVE_STRUCT_SOCKADDR_STORAGE */
595 #ifndef HAVE_STRUCT_ADDRINFO
596 struct addrinfo {
597 int ai_flags;
598 int ai_family;
599 int ai_socktype;
600 int ai_protocol;
601 size_t ai_addrlen;
602 char *ai_canonname;
603 struct sockaddr *ai_addr;
604 struct addrinfo *ai_next;
606 #endif
608 #ifndef HAVE_GETADDRINFO
609 #define getaddrinfo rk_getaddrinfo
610 int ROKEN_LIB_FUNCTION
611 getaddrinfo(const char *,
612 const char *,
613 const struct addrinfo *,
614 struct addrinfo **);
615 #endif
617 #ifndef HAVE_GETNAMEINFO
618 #define getnameinfo rk_getnameinfo
619 int ROKEN_LIB_FUNCTION
620 getnameinfo(const struct sockaddr *, socklen_t,
621 char *, size_t,
622 char *, size_t,
623 int);
624 #endif
626 #ifndef HAVE_FREEADDRINFO
627 #define freeaddrinfo rk_freeaddrinfo
628 void ROKEN_LIB_FUNCTION
629 freeaddrinfo(struct addrinfo *);
630 #endif
632 #ifndef HAVE_GAI_STRERROR
633 #define gai_strerror rk_gai_strerror
634 const char * ROKEN_LIB_FUNCTION
635 gai_strerror(int);
636 #endif
638 int ROKEN_LIB_FUNCTION
639 getnameinfo_verified(const struct sockaddr *, socklen_t,
640 char *, size_t,
641 char *, size_t,
642 int);
644 int ROKEN_LIB_FUNCTION
645 roken_getaddrinfo_hostspec(const char *, int, struct addrinfo **);
646 int ROKEN_LIB_FUNCTION
647 roken_getaddrinfo_hostspec2(const char *, int, int, struct addrinfo **);
649 #ifndef HAVE_STRFTIME
650 #define strftime rk_strftime
651 size_t ROKEN_LIB_FUNCTION
652 strftime (char *, size_t, const char *, const struct tm *);
653 #endif
655 #ifndef HAVE_STRPTIME
656 #define strptime rk_strptime
657 char * ROKEN_LIB_FUNCTION
658 strptime (const char *, const char *, struct tm *);
659 #endif
661 #ifndef HAVE_EMALLOC
662 #define emalloc rk_emalloc
663 void * ROKEN_LIB_FUNCTION emalloc (size_t);
664 #endif
665 #ifndef HAVE_ECALLOC
666 #define ecalloc rk_ecalloc
667 void * ROKEN_LIB_FUNCTION ecalloc(size_t, size_t);
668 #endif
669 #ifndef HAVE_EREALLOC
670 #define erealloc rk_erealloc
671 void * ROKEN_LIB_FUNCTION erealloc (void *, size_t);
672 #endif
673 #ifndef HAVE_ESTRDUP
674 #define estrdup rk_estrdup
675 char * ROKEN_LIB_FUNCTION estrdup (const char *);
676 #endif
679 * kludges and such
682 int ROKEN_LIB_FUNCTION
683 roken_gethostby_setup(const char*, const char*);
684 struct hostent* ROKEN_LIB_FUNCTION
685 roken_gethostbyname(const char*);
686 struct hostent* ROKEN_LIB_FUNCTION
687 roken_gethostbyaddr(const void*, size_t, int);
689 #ifdef GETSERVBYNAME_PROTO_COMPATIBLE
690 #define roken_getservbyname(x,y) getservbyname(x,y)
691 #else
692 #define roken_getservbyname(x,y) getservbyname((char *)x, (char *)y)
693 #endif
695 #ifdef OPENLOG_PROTO_COMPATIBLE
696 #define roken_openlog(a,b,c) openlog(a,b,c)
697 #else
698 #define roken_openlog(a,b,c) openlog((char *)a,b,c)
699 #endif
701 #ifdef GETSOCKNAME_PROTO_COMPATIBLE
702 #define roken_getsockname(a,b,c) getsockname(a,b,c)
703 #else
704 #define roken_getsockname(a,b,c) getsockname(a, b, (void*)c)
705 #endif
707 #ifndef HAVE_SETPROGNAME
708 #define setprogname rk_setprogname
709 void ROKEN_LIB_FUNCTION setprogname(const char *);
710 #endif
712 #ifndef HAVE_GETPROGNAME
713 #define getprogname rk_getprogname
714 const char * ROKEN_LIB_FUNCTION getprogname(void);
715 #endif
717 #if !defined(HAVE_SETPROGNAME) && !defined(HAVE_GETPROGNAME) && !HAVE_DECL___PROGNAME
718 extern const char *__progname;
719 #endif
721 void ROKEN_LIB_FUNCTION mini_inetd_addrinfo (struct addrinfo*);
722 void ROKEN_LIB_FUNCTION mini_inetd (int);
724 #ifndef HAVE_LOCALTIME_R
725 #define localtime_r rk_localtime_r
726 struct tm * ROKEN_LIB_FUNCTION
727 localtime_r(const time_t *, struct tm *);
728 #endif
730 #if !defined(HAVE_STRSVIS) || defined(NEED_STRSVIS_PROTO)
731 #ifndef HAVE_STRSVIS
732 #define strsvis rk_strsvis
733 #endif
734 int ROKEN_LIB_FUNCTION
735 strsvis(char *, const char *, int, const char *);
736 #endif
738 #if !defined(HAVE_STRUNVIS) || defined(NEED_STRUNVIS_PROTO)
739 #ifndef HAVE_STRUNVIS
740 #define strunvis rk_strunvis
741 #endif
742 int ROKEN_LIB_FUNCTION
743 strunvis(char *, const char *);
744 #endif
746 #if !defined(HAVE_STRVIS) || defined(NEED_STRVIS_PROTO)
747 #ifndef HAVE_STRVIS
748 #define strvis rk_strvis
749 #endif
750 int ROKEN_LIB_FUNCTION
751 strvis(char *, const char *, int);
752 #endif
754 #if !defined(HAVE_STRVISX) || defined(NEED_STRVISX_PROTO)
755 #ifndef HAVE_STRVISX
756 #define strvisx rk_strvisx
757 #endif
758 int ROKEN_LIB_FUNCTION
759 strvisx(char *, const char *, size_t, int);
760 #endif
762 #if !defined(HAVE_SVIS) || defined(NEED_SVIS_PROTO)
763 #ifndef HAVE_SVIS
764 #define svis rk_svis
765 #endif
766 char * ROKEN_LIB_FUNCTION
767 svis(char *, int, int, int, const char *);
768 #endif
770 #if !defined(HAVE_UNVIS) || defined(NEED_UNVIS_PROTO)
771 #ifndef HAVE_UNVIS
772 #define unvis rk_unvis
773 #endif
774 int ROKEN_LIB_FUNCTION
775 unvis(char *, int, int *, int);
776 #endif
778 #if !defined(HAVE_VIS) || defined(NEED_VIS_PROTO)
779 #ifndef HAVE_VIS
780 #define vis rk_vis
781 #endif
782 char * ROKEN_LIB_FUNCTION
783 vis(char *, int, int, int);
784 #endif
786 #if !defined(HAVE_CLOSEFROM)
787 #define closefrom rk_closefrom
788 int ROKEN_LIB_FUNCTION
789 closefrom(int);
790 #endif
792 #if !defined(HAVE_TIMEGM)
793 #define timegm rk_timegm
794 time_t ROKEN_LIB_FUNCTION
795 rk_timegm(struct tm *tm);
796 #endif
798 #ifdef SOCKET_WRAPPER_REPLACE
799 #include <socket_wrapper.h>
800 #endif
802 ROKEN_CPP_END