]> arthur.barton.de Git - ngircd-alex.git/blob - src/portab/portab.h
Make the debug loglevel always available
[ngircd-alex.git] / src / portab / portab.h
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * Please read the file COPYING, README and AUTHORS for more information.
10  */
11
12 #ifndef __PORTAB__
13 #define __PORTAB__
14
15 /**
16  * @file
17  * Portability functions and declarations (header)
18  */
19
20 #include "config.h"
21
22 /* remove assert() macro at compile time if DEBUG is not set. */
23
24 #ifndef DEBUG
25 # define NDEBUG
26 #endif
27
28 /* compiler features */
29
30 #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7))
31 # define PUNUSED(x) __attribute__ ((unused)) x
32 # define UNUSED     __attribute__ ((unused))
33 #else
34 # define PUNUSED(x) x
35 # define UNUSED
36 #endif
37
38 #ifndef PARAMS
39 # if PROTOTYPES
40 #  define PARAMS(args) args
41 # else
42 #  define PARAMS(args) ()
43 # endif
44 #endif
45
46 /* datatypes */
47
48 #include <sys/types.h>
49
50 #ifdef HAVE_STDDEF_H
51 # include <stddef.h>
52 #endif
53
54 #ifdef HAVE_INTTYPES_H
55 # include <inttypes.h>
56 # define NGIRC_GOT_INTTYPES
57 #else
58 # ifdef HAVE_STDINT_H
59 #  include <stdint.h>
60 #  define NGIRC_GOT_INTTYPES
61 # endif
62 #endif
63
64 #ifndef PROTOTYPES
65 # ifndef signed
66 #  define signed
67 # endif
68 #endif
69
70 typedef void POINTER;
71
72 #ifdef NGIRC_GOT_INTTYPES
73 typedef uint8_t UINT8;
74 typedef uint16_t UINT16;
75 typedef uint32_t UINT32;
76 #else
77 typedef unsigned char UINT8;
78 typedef unsigned short UINT16;
79 typedef unsigned int UINT32;
80 #endif
81
82 #ifdef HAVE_STDBOOL_H
83 # include <stdbool.h>
84 #else
85 typedef unsigned char bool;
86 # define true (bool)1
87 # define false (bool)0
88 #endif
89
90 #ifndef NULL
91 # ifdef PROTOTYPES
92 #  define NULL (void *)0
93 # else
94 #  define NULL 0L
95 # endif
96 #endif
97
98 #ifdef NeXT
99 # define S_IRUSR 0000400                /* read permission, owner */
100 # define S_IWUSR 0000200                /* write permission, owner */
101 # define S_IRGRP 0000040                /* read permission, group */
102 # define S_IROTH 0000004                /* read permission, other */
103 # define ssize_t int
104 #endif
105
106 #undef GLOBAL
107 #ifdef GLOBAL_INIT
108 #define GLOBAL
109 #else
110 #define GLOBAL extern
111 #endif
112
113 /* SPLint */
114
115 #ifdef S_SPLINT_S
116 # include "splint.h"
117 #endif
118
119 /* target constants  */
120
121 #ifndef HOST_OS
122 # define HOST_OS "unknown"
123 #endif
124
125 #ifndef HOST_CPU
126 # define HOST_CPU "unknown"
127 #endif
128
129 #ifndef HOST_VENDOR
130 # define HOST_VENDOR "unknown"
131 #endif
132
133 #ifdef __HAIKU__
134 # define SINGLE_USER_OS
135 #endif
136
137 /* configure options */
138
139 #ifndef HAVE_socklen_t
140 typedef int socklen_t;                  /* for Mac OS X, amongst others */
141 #endif
142
143 #ifndef HAVE_SNPRINTF
144 extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
145 #endif
146
147 #ifndef HAVE_STRLCAT
148 extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
149 #endif
150
151 #ifndef HAVE_STRLCPY
152 extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
153 #endif
154
155 #ifndef HAVE_STRDUP
156 extern char * strdup PARAMS(( const char *s ));
157 #endif
158
159 #ifndef HAVE_STRNDUP
160 extern char * strndup PARAMS((const char *s, size_t maxlen));
161 #endif
162
163 #ifndef HAVE_STRTOK_R
164 extern char * strtok_r PARAMS((char *str, const char *delim, char **saveptr));
165 #endif
166
167 #ifndef HAVE_VSNPRINTF
168 #include <stdarg.h>
169 extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
170 #endif
171
172 #ifndef HAVE_GAI_STRERROR
173 # define gai_strerror(r) "unknown error"
174 #endif
175
176 #ifndef PACKAGE_NAME
177 # define PACKAGE_NAME PACKAGE
178 #endif
179
180 #ifndef PACKAGE_VERSION
181 # define PACKAGE_VERSION VERSION
182 #endif
183
184 #ifndef SYSCONFDIR
185 # define SYSCONFDIR "/etc"
186 #endif
187
188 #endif
189
190 /* -eof- */