portab.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. * ngIRCd -- The Next Generation IRC Daemon
  3. * Copyright (c)2001-2005 Alexander Barton (alex@barton.de)
  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. * $Id: portab.h,v 1.21 2005/04/16 09:23:01 fw Exp $
  12. *
  13. * Portability functions and declarations (header for libngbportab).
  14. */
  15. #ifndef __PORTAB__
  16. #define __PORTAB__
  17. #include "config.h"
  18. #ifndef DEBUG
  19. # define NDEBUG
  20. #endif
  21. #ifdef HAVE_SYS_TYPES_H
  22. # include <sys/types.h>
  23. #endif
  24. #ifdef HAVE_INTTYPES_H
  25. # include <inttypes.h>
  26. # define NGIRC_GOT_INTTYPES
  27. #else
  28. # ifdef HAVE_STDINT_H
  29. # include <stdint.h>
  30. # define NGIRC_GOT_INTTYPES
  31. # endif
  32. #endif
  33. #ifdef HAVE_STDDEF_H
  34. # include <stddef.h>
  35. #endif
  36. #ifdef HAVE_STDBOOL_H
  37. # include <stdbool.h>
  38. #endif
  39. /* compiler features */
  40. #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
  41. # define PUNUSED(x) __attribute__ ((unused)) x
  42. # define UNUSED __attribute__ ((unused))
  43. #else
  44. # define PUNUSED(x) x
  45. # define UNUSED
  46. #endif
  47. #ifndef PARAMS
  48. # if PROTOTYPES
  49. # define PARAMS(args) args
  50. # else
  51. # define PARAMS(args) ()
  52. # endif
  53. #endif
  54. /* keywords */
  55. #define LOCAL static
  56. /* datatypes */
  57. #ifndef PROTOTYPES
  58. # ifndef signed
  59. # define signed
  60. # endif
  61. #endif
  62. typedef void POINTER;
  63. #ifdef NGIRC_GOT_INTTYPES
  64. typedef uint8_t UINT8;
  65. typedef uint16_t UINT16;
  66. typedef uint32_t UINT32;
  67. #else
  68. typedef unsigned char UINT8;
  69. typedef unsigned short UINT16;
  70. typedef unsigned int UINT32;
  71. #endif
  72. #ifndef HAVE_STDBOOL_H
  73. typedef unsigned char bool;
  74. #define true (bool)1
  75. #define false (bool)0
  76. #endif
  77. #ifndef NULL
  78. #ifdef PROTOTYPES
  79. # define NULL (void *)0
  80. #else
  81. # define NULL 0L
  82. #endif
  83. #endif
  84. #undef GLOBAL
  85. #define GLOBAL
  86. /* SPLint */
  87. #ifdef S_SPLINT_S
  88. #include "splint.h"
  89. #endif
  90. /* target constants */
  91. #ifndef TARGET_OS
  92. #define TARGET_OS "unknown"
  93. #endif
  94. #ifndef TARGET_CPU
  95. #define TARGET_CPU "unknown"
  96. #endif
  97. #ifndef TARGET_VENDOR
  98. #define TARGET_VENDOR "unknown"
  99. #endif
  100. /* configure options */
  101. #ifndef HAVE_socklen_t
  102. typedef int socklen_t; /* for Mac OS X, amongst others */
  103. #endif
  104. #ifndef HAVE_SNPRINTF
  105. extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... ));
  106. #endif
  107. #ifndef HAVE_STRLCAT
  108. extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size ));
  109. #endif
  110. #ifndef HAVE_STRLCPY
  111. extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size ));
  112. #endif
  113. #ifndef HAVE_STRDUP
  114. extern char * strdup PARAMS(( const char *s ));
  115. #endif
  116. #ifndef HAVE_VSNPRINTF
  117. #include <stdarg.h>
  118. extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args ));
  119. #endif
  120. #ifndef PACKAGE_NAME
  121. #define PACKAGE_NAME PACKAGE
  122. #endif
  123. #ifndef PACKAGE_VERSION
  124. #define PACKAGE_VERSION VERSION
  125. #endif
  126. #endif
  127. /* -eof- */