2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
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 */
121 /* target constants */
124 #define TARGET_OS "unknown"
128 #define TARGET_CPU "unknown"
131 #ifndef TARGET_VENDOR
132 #define TARGET_VENDOR "unknown"
136 /* configure options */
138 #ifndef HAVE_socklen_t
139 typedef int socklen_t; /* for Mac OS X, amongst others */
142 #ifndef HAVE_SNPRINTF
143 extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
147 extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
151 extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
155 extern char * strdup PARAMS(( const char *s ));
158 #ifndef HAVE_STRTOK_R
159 extern char * strtok_r PARAMS((char *str, const char *delim, char **saveptr));
162 #ifndef HAVE_VSNPRINTF
164 extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
167 #ifndef HAVE_GAI_STRERROR
168 #define gai_strerror(r) "unknown error"
172 #define PACKAGE_NAME PACKAGE
175 #ifndef PACKAGE_VERSION
176 #define PACKAGE_VERSION VERSION