[BACK]Return to portab.h CVS log [TXT][DIR] Up to [local] / ircnowd / src / portab

Annotation of ircnowd/src/portab/portab.h, Revision 1.1.1.1

1.1       tomglok     1: /*
                      2:  * ngIRCd -- The Next Generation IRC Daemon
                      3:  * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
                      4:  *
                      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.
                     10:  */
                     11:
                     12: #ifndef __PORTAB__
                     13: #define __PORTAB__
                     14:
                     15: /**
                     16:  * @file
                     17:  * Portability functions and declarations (header)
                     18:  */
                     19:
                     20: #include "config.h"
                     21:
                     22: #ifndef DEBUG
                     23: # define NDEBUG
                     24: #endif
                     25:
                     26: /* compiler features */
                     27:
                     28: #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 7))
                     29: # define PUNUSED(x) __attribute__ ((unused)) x
                     30: # define UNUSED     __attribute__ ((unused))
                     31: #else
                     32: # define PUNUSED(x) x
                     33: # define UNUSED
                     34: #endif
                     35:
                     36: #ifndef PARAMS
                     37: # if PROTOTYPES
                     38: #  define PARAMS(args) args
                     39: # else
                     40: #  define PARAMS(args) ()
                     41: # endif
                     42: #endif
                     43:
                     44: /* datatypes */
                     45:
                     46: #include <sys/types.h>
                     47:
                     48: #ifdef HAVE_STDDEF_H
                     49: # include <stddef.h>
                     50: #endif
                     51:
                     52: #ifdef HAVE_INTTYPES_H
                     53: # include <inttypes.h>
                     54: # define NGIRC_GOT_INTTYPES
                     55: #else
                     56: # ifdef HAVE_STDINT_H
                     57: #  include <stdint.h>
                     58: #  define NGIRC_GOT_INTTYPES
                     59: # endif
                     60: #endif
                     61:
                     62: #ifndef PROTOTYPES
                     63: # ifndef signed
                     64: #  define signed
                     65: # endif
                     66: #endif
                     67:
                     68: typedef void POINTER;
                     69:
                     70: #ifdef NGIRC_GOT_INTTYPES
                     71: typedef uint8_t UINT8;
                     72: typedef uint16_t UINT16;
                     73: typedef uint32_t UINT32;
                     74: #else
                     75: typedef unsigned char UINT8;
                     76: typedef unsigned short UINT16;
                     77: typedef unsigned int UINT32;
                     78: #endif
                     79:
                     80: #ifdef HAVE_STDBOOL_H
                     81: # include <stdbool.h>
                     82: #else
                     83: typedef unsigned char bool;
                     84: # define true (bool)1
                     85: # define false (bool)0
                     86: #endif
                     87:
                     88: #ifndef NULL
                     89: # ifdef PROTOTYPES
                     90: #  define NULL (void *)0
                     91: # else
                     92: #  define NULL 0L
                     93: # endif
                     94: #endif
                     95:
                     96: #ifdef NeXT
                     97: # define S_IRUSR 0000400               /* read permission, owner */
                     98: # define S_IWUSR 0000200               /* write permission, owner */
                     99: # define S_IRGRP 0000040               /* read permission, group */
                    100: # define S_IROTH 0000004               /* read permission, other */
                    101: # define ssize_t int
                    102: #endif
                    103:
                    104: #undef GLOBAL
                    105: #ifdef GLOBAL_INIT
                    106: #define GLOBAL
                    107: #else
                    108: #define GLOBAL extern
                    109: #endif
                    110:
                    111: /* SPLint */
                    112:
                    113: #ifdef S_SPLINT_S
                    114: # include "splint.h"
                    115: #endif
                    116:
                    117: /* target constants  */
                    118:
                    119: #ifndef HOST_OS
                    120: # define HOST_OS "unknown"
                    121: #endif
                    122:
                    123: #ifndef HOST_CPU
                    124: # define HOST_CPU "unknown"
                    125: #endif
                    126:
                    127: #ifndef HOST_VENDOR
                    128: # define HOST_VENDOR "unknown"
                    129: #endif
                    130:
                    131: #ifdef __HAIKU__
                    132: # define SINGLE_USER_OS
                    133: #endif
                    134:
                    135: /* configure options */
                    136:
                    137: #ifndef HAVE_socklen_t
                    138: typedef int socklen_t;                 /* for Mac OS X, amongst others */
                    139: #endif
                    140:
                    141: #ifndef HAVE_SNPRINTF
                    142: extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
                    143: #endif
                    144:
                    145: #ifndef HAVE_STRLCAT
                    146: extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
                    147: #endif
                    148:
                    149: #ifndef HAVE_STRLCPY
                    150: extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
                    151: #endif
                    152:
                    153: #ifndef HAVE_STRDUP
                    154: extern char * strdup PARAMS(( const char *s ));
                    155: #endif
                    156:
                    157: #ifndef HAVE_STRNDUP
                    158: extern char * strndup PARAMS((const char *s, size_t maxlen));
                    159: #endif
                    160:
                    161: #ifndef HAVE_STRTOK_R
                    162: extern char * strtok_r PARAMS((char *str, const char *delim, char **saveptr));
                    163: #endif
                    164:
                    165: #ifndef HAVE_VSNPRINTF
                    166: #include <stdarg.h>
                    167: extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
                    168: #endif
                    169:
                    170: #ifndef HAVE_GAI_STRERROR
                    171: # define gai_strerror(r) "unknown error"
                    172: #endif
                    173:
                    174: #ifndef PACKAGE_NAME
                    175: # define PACKAGE_NAME PACKAGE
                    176: #endif
                    177:
                    178: #ifndef PACKAGE_VERSION
                    179: # define PACKAGE_VERSION VERSION
                    180: #endif
                    181:
                    182: #ifndef SYSCONFDIR
                    183: # define SYSCONFDIR "/etc"
                    184: #endif
                    185:
                    186: #endif
                    187:
                    188: /* -eof- */

CVSweb