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.22 2005/07/31 20:13:11 alex 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) ()
78 #ifdef NGIRC_GOT_INTTYPES
79 typedef uint8_t UINT8;
80 typedef uint16_t UINT16;
81 typedef uint32_t UINT32;
83 typedef unsigned char UINT8;
84 typedef unsigned short UINT16;
85 typedef unsigned int UINT32;
88 #ifndef HAVE_STDBOOL_H
89 typedef unsigned char bool;
96 # define NULL (void *)0
103 #define S_IRUSR 0000400 /* read permission, owner */
104 #define S_IWUSR 0000200 /* write permission, owner */
105 #define S_IRGRP 0000040 /* read permission, group */
106 #define S_IROTH 0000004 /* read permission, other */
122 /* target constants */
125 #define TARGET_OS "unknown"
129 #define TARGET_CPU "unknown"
132 #ifndef TARGET_VENDOR
133 #define TARGET_VENDOR "unknown"
137 /* configure options */
139 #ifndef HAVE_socklen_t
140 typedef int socklen_t; /* for Mac OS X, amongst others */
143 #ifndef HAVE_SNPRINTF
144 extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
148 extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
152 extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
156 extern char * strdup PARAMS(( const char *s ));
159 #ifndef HAVE_STRTOK_R
160 extern char * strtok_r PARAMS((char *str, const char *delim, char **saveptr));
163 #ifndef HAVE_VSNPRINTF
165 extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
169 #define PACKAGE_NAME PACKAGE
172 #ifndef PACKAGE_VERSION
173 #define PACKAGE_VERSION VERSION