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