main.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * main.h
  3. * include file to include most other include files
  4. *
  5. */
  6. #ifndef _EGG_MAIN_H
  7. #define _EGG_MAIN_H
  8. #ifdef HAVE_CONFIG_H
  9. # include "config.h"
  10. #endif
  11. #include "pack/conf.h"
  12. #include "salt.h"
  13. #include "lush.h" /* We seem to need this everywhere... */
  14. #if (((TCL_MAJOR_VERSION == 7) && (TCL_MINOR_VERSION >= 5)) || (TCL_MAJOR_VERSION > 7))
  15. # define USE_TCL_EVENTS
  16. # define USE_TCL_FINDEXEC
  17. # define USE_TCL_PACKAGE
  18. # define USE_TCL_VARARGS
  19. #endif
  20. #if (TCL_MAJOR_VERSION >= 8)
  21. # define USE_TCL_OBJ
  22. #endif
  23. #if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 1)) || (TCL_MAJOR_VERSION > 8))
  24. # define USE_TCL_BYTE_ARRAYS
  25. # define USE_TCL_ENCODING
  26. #endif
  27. #if (((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION >= 4)) || (TCL_MAJOR_VERSION > 8))
  28. # ifdef CONST
  29. # define EGG_CONST CONST
  30. # else
  31. # define EGG_CONST
  32. # endif
  33. #else
  34. # define EGG_CONST
  35. #endif
  36. /* UGH! Why couldn't Tcl pick a standard? */
  37. #if defined(USE_TCL_VARARGS) && (defined(__STDC__) || defined(HAS_STDARG))
  38. # ifdef HAVE_STDARG_H
  39. # include <stdarg.h>
  40. # else
  41. # ifdef HAVE_STD_ARGS_H
  42. # include <std_args.h>
  43. # endif
  44. # endif
  45. # define EGG_VARARGS(type, name) (type name, ...)
  46. # define EGG_VARARGS_DEF(type, name) (type name, ...)
  47. # define EGG_VARARGS_START(type, name, list) (va_start(list, name), name)
  48. #else
  49. # include <varargs.h>
  50. # define EGG_VARARGS(type, name) ()
  51. # define EGG_VARARGS_DEF(type, name) (va_alist) va_dcl
  52. # define EGG_VARARGS_START(type, name, list) (va_start(list), va_arg(list,type))
  53. #endif
  54. #include <stdio.h>
  55. #include <stdlib.h>
  56. #include <string.h>
  57. #ifdef HAVE_STRINGS_H
  58. # include <strings.h>
  59. #endif
  60. #include <sys/types.h>
  61. #include "lush.h"
  62. #include "lang.h"
  63. #include "eggdrop.h"
  64. #include "flags.h"
  65. #ifdef HAVE_ZLIB_H
  66. # include <zlib.h>
  67. #endif /* HAVE_ZLIB_H */
  68. #ifndef MAKING_MODS
  69. # include "proto.h"
  70. #endif
  71. #include "cmdt.h"
  72. #include "tclegg.h"
  73. #include "tclhash.h"
  74. #include "chan.h"
  75. #include "users.h"
  76. #include "compat/compat.h"
  77. /* For pre Tcl7.5p1 versions */
  78. #ifndef HAVE_TCL_FREE
  79. # define Tcl_Free(x) n_free(x, "", 0)
  80. #endif
  81. /* For pre7.6 Tcl versions */
  82. #ifndef TCL_PATCH_LEVEL
  83. # define TCL_PATCH_LEVEL Tcl_GetVar(interp, "tcl_patchLevel", TCL_GLOBAL_ONLY)
  84. #endif
  85. #ifndef MAKING_MODS
  86. extern struct dcc_table DCC_CHAT, DCC_BOT, DCC_LOST, DCC_BOT_NEW,
  87. DCC_RELAY, DCC_RELAYING, DCC_FORK_RELAY, DCC_PRE_RELAY, DCC_CHAT_PASS,
  88. DCC_FORK_BOT, DCC_SOCKET, DCC_TELNET_ID, DCC_TELNET_NEW, DCC_TELNET_PW,
  89. DCC_TELNET, DCC_IDENT, DCC_IDENTWAIT, DCC_DNSWAIT;
  90. #endif
  91. #define iptolong(a) (0xffffffff & \
  92. (long) (htonl((unsigned long) a)))
  93. #define fixcolon(x) do { \
  94. if ((x)[0] == ':') \
  95. (x)++; \
  96. else \
  97. (x) = newsplit(&(x)); \
  98. } while (0)
  99. /* This macro copies (_len - 1) bytes from _source to _target. The
  100. * target string is NULL-terminated.
  101. */
  102. #define strncpyz(_target, _source, _len) do { \
  103. strncpy((_target), (_source), (_len) - 1); \
  104. (_target)[(_len) - 1] = 0; \
  105. } while (0)
  106. #ifdef BORGCUBES
  107. /* For net.c */
  108. # define O_NONBLOCK 00000004 /* POSIX non-blocking I/O */
  109. #endif /* BORGUBES */
  110. #ifdef strncpy
  111. #undef strncpy
  112. #endif
  113. #endif /* _EGG_MAIN_H */