2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2005 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.
11 * $Id: portab.h,v 1.21 2005/04/16 09:23:01 fw Exp $
13 * Portability functions and declarations (header for libngbportab).
27 #ifdef HAVE_SYS_TYPES_H
28 # include <sys/types.h>
31 #ifdef HAVE_INTTYPES_H
32 # include <inttypes.h>
33 # define NGIRC_GOT_INTTYPES
37 # define NGIRC_GOT_INTTYPES
49 /* compiler features */
51 #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
52 # define PUNUSED(x) __attribute__ ((unused)) x
53 # define UNUSED __attribute__ ((unused))
61 # define PARAMS(args) args
63 # define PARAMS(args) ()
81 #ifdef NGIRC_GOT_INTTYPES
82 typedef uint8_t UINT8;
83 typedef uint16_t UINT16;
84 typedef uint32_t UINT32;
86 typedef unsigned char UINT8;
87 typedef unsigned short UINT16;
88 typedef unsigned int UINT32;
91 #ifndef HAVE_STDBOOL_H
92 typedef unsigned char bool;
99 # define NULL (void *)0
117 /* target constants */
120 #define TARGET_OS "unknown"
124 #define TARGET_CPU "unknown"
127 #ifndef TARGET_VENDOR
128 #define TARGET_VENDOR "unknown"
132 /* configure options */
134 #ifndef HAVE_socklen_t
135 typedef int socklen_t; /* for Mac OS X, amongst others */
138 #ifndef HAVE_SNPRINTF
139 extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
143 extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
147 extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
151 extern char * strdup PARAMS(( const char *s ));
154 #ifndef HAVE_VSNPRINTF
156 extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
160 #define PACKAGE_NAME PACKAGE
163 #ifndef PACKAGE_VERSION
164 #define PACKAGE_VERSION VERSION