]> arthur.barton.de Git - ngircd-alex.git/blob - src/portab/portab.h
Added "portabtest" binary to .gitignore file in src/portabtest/.
[ngircd-alex.git] / src / portab / portab.h
1 /*
2  * ngIRCd -- The Next Generation IRC Daemon
3  * Copyright (c)2001-2005 Alexander Barton (alex@barton.de)
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  * $Id: portab.h,v 1.22 2005/07/31 20:13:11 alex Exp $
12  *
13  * Portability functions and declarations (header for libngbportab).
14  */
15
16
17 #ifndef __PORTAB__
18 #define __PORTAB__
19
20
21 #include "config.h"
22
23 #ifndef DEBUG
24 # define NDEBUG
25 #endif
26
27 #ifdef HAVE_SYS_TYPES_H
28 # include <sys/types.h>
29 #endif
30
31 #ifdef HAVE_INTTYPES_H
32 # include <inttypes.h>
33 # define NGIRC_GOT_INTTYPES
34 #else
35 # ifdef HAVE_STDINT_H
36 #  include <stdint.h>
37 #  define NGIRC_GOT_INTTYPES
38 # endif
39 #endif
40
41 #ifdef HAVE_STDDEF_H
42 # include <stddef.h>
43 #endif
44
45 #ifdef HAVE_STDBOOL_H
46 # include <stdbool.h>
47 #endif
48
49 /* compiler features */
50
51 #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
52 # define PUNUSED(x) __attribute__ ((unused)) x
53 # define UNUSED     __attribute__ ((unused))
54 #else
55 # define PUNUSED(x) x
56 # define UNUSED
57 #endif
58
59 #ifndef PARAMS
60 # if PROTOTYPES
61 #  define PARAMS(args) args
62 # else
63 #  define PARAMS(args) ()
64 # endif
65 #endif
66
67
68 /* datatypes */
69
70 #ifndef PROTOTYPES
71 # ifndef signed
72 #  define signed
73 # endif
74 #endif
75
76 typedef void POINTER;
77
78 #ifdef NGIRC_GOT_INTTYPES
79 typedef uint8_t UINT8;
80 typedef uint16_t UINT16;
81 typedef uint32_t UINT32;
82 #else
83 typedef unsigned char UINT8;
84 typedef unsigned short UINT16;
85 typedef unsigned int UINT32;
86 #endif
87
88 #ifndef HAVE_STDBOOL_H
89 typedef unsigned char bool;
90 #define true (bool)1
91 #define false (bool)0
92 #endif
93
94 #ifndef NULL
95 #ifdef PROTOTYPES
96 # define NULL (void *)0
97 #else
98 # define NULL 0L
99 #endif
100 #endif
101
102 #undef GLOBAL
103 #define GLOBAL
104
105
106 /* SPLint */
107
108
109 #ifdef S_SPLINT_S
110 #include "splint.h"
111 #endif
112
113
114 /* target constants  */
115
116 #ifndef TARGET_OS
117 #define TARGET_OS "unknown"
118 #endif
119
120 #ifndef TARGET_CPU
121 #define TARGET_CPU "unknown"
122 #endif
123
124 #ifndef TARGET_VENDOR
125 #define TARGET_VENDOR "unknown"
126 #endif
127
128
129 /* configure options */
130
131 #ifndef HAVE_socklen_t
132 typedef int socklen_t;                  /* for Mac OS X, amongst others */
133 #endif
134
135 #ifndef HAVE_SNPRINTF
136 extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
137 #endif
138
139 #ifndef HAVE_STRLCAT
140 extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
141 #endif
142
143 #ifndef HAVE_STRLCPY
144 extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
145 #endif
146
147 #ifndef HAVE_STRDUP
148 extern char * strdup PARAMS(( const char *s ));
149 #endif
150
151 #ifndef HAVE_VSNPRINTF
152 #include <stdarg.h>
153 extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
154 #endif
155
156 #ifndef PACKAGE_NAME
157 #define PACKAGE_NAME PACKAGE
158 #endif
159
160 #ifndef PACKAGE_VERSION
161 #define PACKAGE_VERSION VERSION
162 #endif
163
164
165 #endif
166
167
168 /* -eof- */