Blame


1 d18ca0b8 2002-03-12 alex /*
2 d18ca0b8 2002-03-12 alex * ngIRCd -- The Next Generation IRC Daemon
3 d18ca0b8 2002-03-12 alex * Copyright (c)2001,2002 by 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 c9540015 2003-01-03 alex * $Id: portab.h,v 1.12 2003/01/03 22:03:51 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 4f6f84e7 2002-12-26 alex #ifdef HAVE_SYS_TYPES_H
24 4f6f84e7 2002-12-26 alex #include <sys/types.h>
25 4f6f84e7 2002-12-26 alex #endif
26 d18ca0b8 2002-03-12 alex
27 4f6f84e7 2002-12-26 alex
28 e13cb291 2002-12-26 alex /* compiler features */
29 ba258e65 2002-05-27 alex
30 6725d789 2002-12-12 alex #ifdef __GNUC__
31 6725d789 2002-12-12 alex # define PUNUSED(x) __attribute__ ((unused)) x
32 6725d789 2002-12-12 alex # define UNUSED __attribute__ ((unused))
33 6725d789 2002-12-12 alex #else
34 6725d789 2002-12-12 alex # define PUNUSED(x) x
35 6725d789 2002-12-12 alex # define UNUSED
36 6725d789 2002-12-12 alex #endif
37 ba258e65 2002-05-27 alex
38 ba258e65 2002-05-27 alex #ifndef PARAMS
39 ba258e65 2002-05-27 alex # if PROTOTYPES
40 ba258e65 2002-05-27 alex # define PARAMS(args) args
41 ba258e65 2002-05-27 alex # else
42 ba258e65 2002-05-27 alex # define PARAMS(args) ()
43 ba258e65 2002-05-27 alex # endif
44 ba258e65 2002-05-27 alex #endif
45 ba258e65 2002-05-27 alex
46 ba258e65 2002-05-27 alex
47 e13cb291 2002-12-26 alex /* keywords */
48 d18ca0b8 2002-03-12 alex
49 d18ca0b8 2002-03-12 alex #define EXTERN extern
50 d18ca0b8 2002-03-12 alex #define STATIC static
51 d18ca0b8 2002-03-12 alex #define LOCAL static
52 d18ca0b8 2002-03-12 alex #define CONST const
53 cf9629b9 2002-06-26 alex #define REGISTER register
54 d18ca0b8 2002-03-12 alex
55 d18ca0b8 2002-03-12 alex
56 e13cb291 2002-12-26 alex /* datatypes */
57 d18ca0b8 2002-03-12 alex
58 ba258e65 2002-05-27 alex #ifndef PROTOTYPES
59 ba258e65 2002-05-27 alex # ifndef signed
60 ba258e65 2002-05-27 alex # define signed
61 ba258e65 2002-05-27 alex # endif
62 ba258e65 2002-05-27 alex #endif
63 ba258e65 2002-05-27 alex
64 d18ca0b8 2002-03-12 alex typedef void VOID;
65 d18ca0b8 2002-03-12 alex typedef void POINTER;
66 d18ca0b8 2002-03-12 alex
67 d18ca0b8 2002-03-12 alex typedef signed int INT;
68 d18ca0b8 2002-03-12 alex typedef unsigned int UINT;
69 84022a12 2002-10-09 alex typedef signed long LONG;
70 84022a12 2002-10-09 alex typedef unsigned long ULONG;
71 84022a12 2002-10-09 alex
72 d18ca0b8 2002-03-12 alex typedef signed char INT8;
73 d18ca0b8 2002-03-12 alex typedef unsigned char UINT8;
74 d18ca0b8 2002-03-12 alex typedef signed short INT16;
75 d18ca0b8 2002-03-12 alex typedef unsigned short UINT16;
76 d18ca0b8 2002-03-12 alex typedef signed long INT32;
77 d18ca0b8 2002-03-12 alex typedef unsigned long UINT32;
78 d18ca0b8 2002-03-12 alex
79 84022a12 2002-10-09 alex typedef double DOUBLE;
80 d18ca0b8 2002-03-12 alex typedef float FLOAT;
81 d18ca0b8 2002-03-12 alex
82 d18ca0b8 2002-03-12 alex typedef char CHAR;
83 d18ca0b8 2002-03-12 alex
84 d18ca0b8 2002-03-12 alex typedef UINT8 BOOLEAN;
85 d18ca0b8 2002-03-12 alex
86 d18ca0b8 2002-03-12 alex #undef TRUE
87 d18ca0b8 2002-03-12 alex #define TRUE (BOOLEAN)1
88 d18ca0b8 2002-03-12 alex
89 d18ca0b8 2002-03-12 alex #undef FALSE
90 d18ca0b8 2002-03-12 alex #define FALSE (BOOLEAN)0
91 d18ca0b8 2002-03-12 alex
92 d18ca0b8 2002-03-12 alex #undef NULL
93 ba258e65 2002-05-27 alex #ifdef PROTOTYPES
94 ba258e65 2002-05-27 alex # define NULL (VOID *)0
95 ba258e65 2002-05-27 alex #else
96 ba258e65 2002-05-27 alex # define NULL 0L
97 ba258e65 2002-05-27 alex #endif
98 d18ca0b8 2002-03-12 alex
99 d18ca0b8 2002-03-12 alex #undef GLOBAL
100 d18ca0b8 2002-03-12 alex #define GLOBAL
101 d18ca0b8 2002-03-12 alex
102 d18ca0b8 2002-03-12 alex
103 8d79f267 2002-03-25 alex /* SPLint */
104 8d79f267 2002-03-25 alex
105 8d79f267 2002-03-25 alex
106 8d79f267 2002-03-25 alex #ifdef S_SPLINT_S
107 8d79f267 2002-03-25 alex #include "splint.h"
108 8d79f267 2002-03-25 alex #endif
109 8d79f267 2002-03-25 alex
110 8d79f267 2002-03-25 alex
111 e13cb291 2002-12-26 alex /* target constants */
112 d18ca0b8 2002-03-12 alex
113 e13cb291 2002-12-26 alex #ifndef TARGET_OS
114 e13cb291 2002-12-26 alex #define TARGET_OS "unknown"
115 e13cb291 2002-12-26 alex #endif
116 e13cb291 2002-12-26 alex
117 e13cb291 2002-12-26 alex #ifndef TARGET_CPU
118 e13cb291 2002-12-26 alex #define TARGET_CPU "unknown"
119 e13cb291 2002-12-26 alex #endif
120 e13cb291 2002-12-26 alex
121 e13cb291 2002-12-26 alex #ifndef TARGET_VENDOR
122 e13cb291 2002-12-26 alex #define TARGET_VENDOR "unknown"
123 e13cb291 2002-12-26 alex #endif
124 e13cb291 2002-12-26 alex
125 e13cb291 2002-12-26 alex
126 e13cb291 2002-12-26 alex /* configure options */
127 e13cb291 2002-12-26 alex
128 d18ca0b8 2002-03-12 alex #ifndef HAVE_socklen_t
129 d18ca0b8 2002-03-12 alex #define socklen_t int /* u.a. fuer Mac OS X */
130 d18ca0b8 2002-03-12 alex #endif
131 d18ca0b8 2002-03-12 alex
132 d18ca0b8 2002-03-12 alex #if OS_UNIX_AUX
133 d18ca0b8 2002-03-12 alex #define _POSIX_SOURCE /* muss unter A/UX definiert sein */
134 d18ca0b8 2002-03-12 alex #endif
135 d18ca0b8 2002-03-12 alex
136 e13cb291 2002-12-26 alex #ifndef HAVE_SNPRINTF
137 c9540015 2003-01-03 alex EXTERN INT snprintf PARAMS(( CHAR *str, size_t count, CONST CHAR *fmt, ... ));
138 e13cb291 2002-12-26 alex #endif
139 d18ca0b8 2002-03-12 alex
140 e13cb291 2002-12-26 alex #ifndef HAVE_STRLCAT
141 c9540015 2003-01-03 alex EXTERN size_t strlcat PARAMS(( CHAR *dst, CONST CHAR *src, size_t size ));
142 7049b60a 2002-03-12 alex #endif
143 d18ca0b8 2002-03-12 alex
144 e13cb291 2002-12-26 alex #ifndef HAVE_STRLCPY
145 c9540015 2003-01-03 alex EXTERN size_t strlcpy PARAMS(( CHAR *dst, CONST CHAR *src, size_t size ));
146 7049b60a 2002-03-12 alex #endif
147 d18ca0b8 2002-03-12 alex
148 e13cb291 2002-12-26 alex #ifndef HAVE_VSNPRINTF
149 c9540015 2003-01-03 alex EXTERN INT vsnprintf PARAMS(( CHAR *str, size_t count, CONST CHAR *fmt, va_list args ));
150 d18ca0b8 2002-03-12 alex #endif
151 d18ca0b8 2002-03-12 alex
152 d18ca0b8 2002-03-12 alex
153 7049b60a 2002-03-12 alex #endif
154 7049b60a 2002-03-12 alex
155 7049b60a 2002-03-12 alex
156 d18ca0b8 2002-03-12 alex /* -eof- */