2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
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.
17 * Portability functions and declarations (header)
22 /* remove assert() macro at compile time if DEBUG is not set. */
28 /* compiler features */
30 #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7))
31 # define PUNUSED(x) __attribute__ ((unused)) x
32 # define UNUSED __attribute__ ((unused))
40 # define PARAMS(args) args
42 # define PARAMS(args) ()
48 #include <sys/types.h>
54 #ifdef HAVE_INTTYPES_H
55 # include <inttypes.h>
56 # define NGIRC_GOT_INTTYPES
60 # define NGIRC_GOT_INTTYPES
72 #ifdef NGIRC_GOT_INTTYPES
73 typedef uint8_t UINT8;
74 typedef uint16_t UINT16;
75 typedef uint32_t UINT32;
77 typedef unsigned char UINT8;
78 typedef unsigned short UINT16;
79 typedef unsigned int UINT32;
85 typedef unsigned char bool;
87 # define false (bool)0
92 # define NULL (void *)0
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 */
110 #define GLOBAL extern
113 /* target constants */
116 # define HOST_OS "unknown"
120 # define HOST_CPU "unknown"
124 # define HOST_VENDOR "unknown"
128 # define SINGLE_USER_OS
131 /* configure options */
133 #ifndef HAVE_socklen_t
134 typedef int socklen_t; /* for Mac OS X, amongst others */
137 #ifndef HAVE_SNPRINTF
138 extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
142 extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
146 extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
150 extern char * strdup PARAMS(( const char *s ));
154 extern char * strndup PARAMS((const char *s, size_t maxlen));
157 #ifndef HAVE_STRTOK_R
158 extern char * strtok_r PARAMS((char *str, const char *delim, char **saveptr));
161 #ifndef HAVE_VSNPRINTF
163 extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
166 #ifndef HAVE_GAI_STRERROR
167 # define gai_strerror(r) "unknown error"
171 # define PACKAGE_NAME PACKAGE
174 #ifndef PACKAGE_VERSION
175 # define PACKAGE_VERSION VERSION
179 # define SYSCONFDIR "/etc"