Blame


1 d18ca0b8 2002-03-12 alex /*
2 d18ca0b8 2002-03-12 alex * ngIRCd -- The Next Generation IRC Daemon
3 ca8ab38c 2005-04-09 alex * Copyright (c)2001-2005 Alexander Barton (alex@barton.de)
4 d18ca0b8 2002-03-12 alex *
5 e13cb291 2002-12-26 alex * This program is free software; you can redistribute it and/or modify
6 e13cb291 2002-12-26 alex * it under the terms of the GNU General Public License as published by
7 e13cb291 2002-12-26 alex * the Free Software Foundation; either version 2 of the License, or
8 e13cb291 2002-12-26 alex * (at your option) any later version.
9 e13cb291 2002-12-26 alex * Please read the file COPYING, README and AUTHORS for more information.
10 d18ca0b8 2002-03-12 alex *
11 77f54693 2005-07-31 alex * $Id: portab.h,v 1.22 2005/07/31 20:13:11 alex Exp $
12 d18ca0b8 2002-03-12 alex *
13 e13cb291 2002-12-26 alex * Portability functions and declarations (header for libngbportab).
14 d18ca0b8 2002-03-12 alex */
15 d18ca0b8 2002-03-12 alex
16 d18ca0b8 2002-03-12 alex
17 d18ca0b8 2002-03-12 alex #ifndef __PORTAB__
18 d18ca0b8 2002-03-12 alex #define __PORTAB__
19 d18ca0b8 2002-03-12 alex
20 d18ca0b8 2002-03-12 alex
21 d18ca0b8 2002-03-12 alex #include "config.h"
22 d18ca0b8 2002-03-12 alex
23 4d0b03b4 2005-03-30 alex #ifndef DEBUG
24 4d0b03b4 2005-03-30 alex # define NDEBUG
25 4d0b03b4 2005-03-30 alex #endif
26 4d0b03b4 2005-03-30 alex
27 4f6f84e7 2002-12-26 alex #ifdef HAVE_SYS_TYPES_H
28 c53903eb 2004-01-17 alex # include <sys/types.h>
29 4f6f84e7 2002-12-26 alex #endif
30 d18ca0b8 2002-03-12 alex
31 8adff592 2005-03-19 fw #ifdef HAVE_INTTYPES_H
32 8adff592 2005-03-19 fw # include <inttypes.h>
33 8adff592 2005-03-19 fw # define NGIRC_GOT_INTTYPES
34 8adff592 2005-03-19 fw #else
35 8adff592 2005-03-19 fw # ifdef HAVE_STDINT_H
36 8adff592 2005-03-19 fw # include <stdint.h>
37 8adff592 2005-03-19 fw # define NGIRC_GOT_INTTYPES
38 8adff592 2005-03-19 fw # endif
39 8adff592 2005-03-19 fw #endif
40 4f6f84e7 2002-12-26 alex
41 8adff592 2005-03-19 fw #ifdef HAVE_STDDEF_H
42 8adff592 2005-03-19 fw # include <stddef.h>
43 8adff592 2005-03-19 fw #endif
44 8adff592 2005-03-19 fw
45 8adff592 2005-03-19 fw #ifdef HAVE_STDBOOL_H
46 8adff592 2005-03-19 fw # include <stdbool.h>
47 8adff592 2005-03-19 fw #endif
48 8adff592 2005-03-19 fw
49 e13cb291 2002-12-26 alex /* compiler features */
50 ba258e65 2002-05-27 alex
51 f697923c 2004-03-15 alex #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
52 6725d789 2002-12-12 alex # define PUNUSED(x) __attribute__ ((unused)) x
53 6725d789 2002-12-12 alex # define UNUSED __attribute__ ((unused))
54 6725d789 2002-12-12 alex #else
55 6725d789 2002-12-12 alex # define PUNUSED(x) x
56 6725d789 2002-12-12 alex # define UNUSED
57 6725d789 2002-12-12 alex #endif
58 ba258e65 2002-05-27 alex
59 ba258e65 2002-05-27 alex #ifndef PARAMS
60 ba258e65 2002-05-27 alex # if PROTOTYPES
61 ba258e65 2002-05-27 alex # define PARAMS(args) args
62 ba258e65 2002-05-27 alex # else
63 ba258e65 2002-05-27 alex # define PARAMS(args) ()
64 ba258e65 2002-05-27 alex # endif
65 ba258e65 2002-05-27 alex #endif
66 ba258e65 2002-05-27 alex
67 ba258e65 2002-05-27 alex
68 e13cb291 2002-12-26 alex /* datatypes */
69 d18ca0b8 2002-03-12 alex
70 ba258e65 2002-05-27 alex #ifndef PROTOTYPES
71 ba258e65 2002-05-27 alex # ifndef signed
72 ba258e65 2002-05-27 alex # define signed
73 ba258e65 2002-05-27 alex # endif
74 ba258e65 2002-05-27 alex #endif
75 ba258e65 2002-05-27 alex
76 d18ca0b8 2002-03-12 alex typedef void POINTER;
77 d18ca0b8 2002-03-12 alex
78 8adff592 2005-03-19 fw #ifdef NGIRC_GOT_INTTYPES
79 8adff592 2005-03-19 fw typedef uint8_t UINT8;
80 8adff592 2005-03-19 fw typedef uint16_t UINT16;
81 8adff592 2005-03-19 fw typedef uint32_t UINT32;
82 8adff592 2005-03-19 fw #else
83 d18ca0b8 2002-03-12 alex typedef unsigned char UINT8;
84 d18ca0b8 2002-03-12 alex typedef unsigned short UINT16;
85 8adff592 2005-03-19 fw typedef unsigned int UINT32;
86 8adff592 2005-03-19 fw #endif
87 d18ca0b8 2002-03-12 alex
88 8adff592 2005-03-19 fw #ifndef HAVE_STDBOOL_H
89 8adff592 2005-03-19 fw typedef unsigned char bool;
90 8adff592 2005-03-19 fw #define true (bool)1
91 8adff592 2005-03-19 fw #define false (bool)0
92 8adff592 2005-03-19 fw #endif
93 d18ca0b8 2002-03-12 alex
94 8adff592 2005-03-19 fw #ifndef NULL
95 ba258e65 2002-05-27 alex #ifdef PROTOTYPES
96 8adff592 2005-03-19 fw # define NULL (void *)0
97 ba258e65 2002-05-27 alex #else
98 ba258e65 2002-05-27 alex # define NULL 0L
99 ba258e65 2002-05-27 alex #endif
100 8adff592 2005-03-19 fw #endif
101 d18ca0b8 2002-03-12 alex
102 d18ca0b8 2002-03-12 alex #undef GLOBAL
103 d18ca0b8 2002-03-12 alex #define GLOBAL
104 d18ca0b8 2002-03-12 alex
105 d18ca0b8 2002-03-12 alex
106 8d79f267 2002-03-25 alex /* SPLint */
107 8d79f267 2002-03-25 alex
108 8d79f267 2002-03-25 alex
109 8d79f267 2002-03-25 alex #ifdef S_SPLINT_S
110 8d79f267 2002-03-25 alex #include "splint.h"
111 8d79f267 2002-03-25 alex #endif
112 8d79f267 2002-03-25 alex
113 8d79f267 2002-03-25 alex
114 e13cb291 2002-12-26 alex /* target constants */
115 d18ca0b8 2002-03-12 alex
116 e13cb291 2002-12-26 alex #ifndef TARGET_OS
117 e13cb291 2002-12-26 alex #define TARGET_OS "unknown"
118 e13cb291 2002-12-26 alex #endif
119 e13cb291 2002-12-26 alex
120 e13cb291 2002-12-26 alex #ifndef TARGET_CPU
121 e13cb291 2002-12-26 alex #define TARGET_CPU "unknown"
122 e13cb291 2002-12-26 alex #endif
123 e13cb291 2002-12-26 alex
124 e13cb291 2002-12-26 alex #ifndef TARGET_VENDOR
125 e13cb291 2002-12-26 alex #define TARGET_VENDOR "unknown"
126 e13cb291 2002-12-26 alex #endif
127 e13cb291 2002-12-26 alex
128 e13cb291 2002-12-26 alex
129 e13cb291 2002-12-26 alex /* configure options */
130 e13cb291 2002-12-26 alex
131 d18ca0b8 2002-03-12 alex #ifndef HAVE_socklen_t
132 ca8ab38c 2005-04-09 alex typedef int socklen_t; /* for Mac OS X, amongst others */
133 d18ca0b8 2002-03-12 alex #endif
134 d18ca0b8 2002-03-12 alex
135 e13cb291 2002-12-26 alex #ifndef HAVE_SNPRINTF
136 8adff592 2005-03-19 fw extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
137 e13cb291 2002-12-26 alex #endif
138 d18ca0b8 2002-03-12 alex
139 e13cb291 2002-12-26 alex #ifndef HAVE_STRLCAT
140 8adff592 2005-03-19 fw extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
141 7049b60a 2002-03-12 alex #endif
142 d18ca0b8 2002-03-12 alex
143 e13cb291 2002-12-26 alex #ifndef HAVE_STRLCPY
144 8adff592 2005-03-19 fw extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
145 7049b60a 2002-03-12 alex #endif
146 d18ca0b8 2002-03-12 alex
147 77faf14b 2005-04-16 fw #ifndef HAVE_STRDUP
148 77faf14b 2005-04-16 fw extern char * strdup PARAMS(( const char *s ));
149 77faf14b 2005-04-16 fw #endif
150 77faf14b 2005-04-16 fw
151 e13cb291 2002-12-26 alex #ifndef HAVE_VSNPRINTF
152 f5345597 2003-03-17 alex #include <stdarg.h>
153 8adff592 2005-03-19 fw extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
154 d18ca0b8 2002-03-12 alex #endif
155 d18ca0b8 2002-03-12 alex
156 016e547d 2003-03-31 alex #ifndef PACKAGE_NAME
157 016e547d 2003-03-31 alex #define PACKAGE_NAME PACKAGE
158 016e547d 2003-03-31 alex #endif
159 d18ca0b8 2002-03-12 alex
160 016e547d 2003-03-31 alex #ifndef PACKAGE_VERSION
161 016e547d 2003-03-31 alex #define PACKAGE_VERSION VERSION
162 7049b60a 2002-03-12 alex #endif
163 7049b60a 2002-03-12 alex
164 7049b60a 2002-03-12 alex
165 016e547d 2003-03-31 alex #endif
166 016e547d 2003-03-31 alex
167 016e547d 2003-03-31 alex
168 d18ca0b8 2002-03-12 alex /* -eof- */