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)
26 /* compiler features */
28 #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7))
29 # define PUNUSED(x) __attribute__ ((unused)) x
30 # define UNUSED __attribute__ ((unused))
38 # define PARAMS(args) args
40 # define PARAMS(args) ()
46 #include <sys/types.h>
52 #ifdef HAVE_INTTYPES_H
53 # include <inttypes.h>
54 # define NGIRC_GOT_INTTYPES
58 # define NGIRC_GOT_INTTYPES
70 #ifdef NGIRC_GOT_INTTYPES
71 typedef uint8_t UINT8;
72 typedef uint16_t UINT16;
73 typedef uint32_t UINT32;
75 typedef unsigned char UINT8;
76 typedef unsigned short UINT16;
77 typedef unsigned int UINT32;
83 typedef unsigned char bool;
85 # define false (bool)0
90 # define NULL (void *)0
97 # define S_IRUSR 0000400 /* read permission, owner */
98 # define S_IWUSR 0000200 /* write permission, owner */
99 # define S_IRGRP 0000040 /* read permission, group */
100 # define S_IROTH 0000004 /* read permission, other */
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