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.
11 * Portability functions and declarations (header for libngbportab).
25 #ifdef HAVE_SYS_TYPES_H
26 # include <sys/types.h>
29 #ifdef HAVE_INTTYPES_H
30 # include <inttypes.h>
31 # define NGIRC_GOT_INTTYPES
35 # define NGIRC_GOT_INTTYPES
47 /* compiler features */
49 #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7))
50 # define PUNUSED(x) __attribute__ ((unused)) x
51 # define UNUSED __attribute__ ((unused))
59 # define PARAMS(args) args
61 # define PARAMS(args) ()
76 #ifdef NGIRC_GOT_INTTYPES
77 typedef uint8_t UINT8;
78 typedef uint16_t UINT16;
79 typedef uint32_t UINT32;
81 typedef unsigned char UINT8;
82 typedef unsigned short UINT16;
83 typedef unsigned int UINT32;
86 #ifndef HAVE_STDBOOL_H
87 typedef unsigned char bool;
94 # define NULL (void *)0
101 #define S_IRUSR 0000400 /* read permission, owner */
102 #define S_IWUSR 0000200 /* write permission, owner */
103 #define S_IRGRP 0000040 /* read permission, group */
104 #define S_IROTH 0000004 /* read permission, other */
120 /* target constants */
123 #define TARGET_OS "unknown"
127 #define TARGET_CPU "unknown"
130 #ifndef TARGET_VENDOR
131 #define TARGET_VENDOR "unknown"
135 /* configure options */
137 #ifndef HAVE_socklen_t
138 typedef int socklen_t; /* for Mac OS X, amongst others */
141 #ifndef HAVE_SNPRINTF
142 extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
146 extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
150 extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
154 extern char * strdup PARAMS(( const char *s ));
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 ));
167 #define PACKAGE_NAME PACKAGE
170 #ifndef PACKAGE_VERSION
171 #define PACKAGE_VERSION VERSION