2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2012 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 #ifdef HAVE_SYS_TYPES_H
27 # include <sys/types.h>
30 #ifdef HAVE_INTTYPES_H
31 # include <inttypes.h>
32 # define NGIRC_GOT_INTTYPES
36 # define NGIRC_GOT_INTTYPES
48 /* compiler features */
50 #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7))
51 # define PUNUSED(x) __attribute__ ((unused)) x
52 # define UNUSED __attribute__ ((unused))
60 # define PARAMS(args) args
62 # define PARAMS(args) ()
77 #ifdef NGIRC_GOT_INTTYPES
78 typedef uint8_t UINT8;
79 typedef uint16_t UINT16;
80 typedef uint32_t UINT32;
82 typedef unsigned char UINT8;
83 typedef unsigned short UINT16;
84 typedef unsigned int UINT32;
87 #ifndef HAVE_STDBOOL_H
88 typedef unsigned char bool;
95 # define NULL (void *)0
102 #define S_IRUSR 0000400 /* read permission, owner */
103 #define S_IWUSR 0000200 /* write permission, owner */
104 #define S_IRGRP 0000040 /* read permission, group */
105 #define S_IROTH 0000004 /* read permission, other */
120 /* target constants */
123 #define HOST_OS "unknown"
127 #define HOST_CPU "unknown"
131 #define HOST_VENDOR "unknown"
135 #define SINGLE_USER_OS
138 /* configure options */
140 #ifndef HAVE_socklen_t
141 typedef int socklen_t; /* for Mac OS X, amongst others */
144 #ifndef HAVE_SNPRINTF
145 extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
149 extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
153 extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
157 extern char * strdup PARAMS(( const char *s ));
161 extern char * strndup PARAMS((const char *s, size_t maxlen));
164 #ifndef HAVE_STRTOK_R
165 extern char * strtok_r PARAMS((char *str, const char *delim, char **saveptr));
168 #ifndef HAVE_VSNPRINTF
170 extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
173 #ifndef HAVE_GAI_STRERROR
174 #define gai_strerror(r) "unknown error"
178 #define PACKAGE_NAME PACKAGE
181 #ifndef PACKAGE_VERSION
182 #define PACKAGE_VERSION VERSION