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