1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375
|
/*
* irc_std.h: header to define things used in all the programs ircii
* comes with
*
* hacked together from various other files by matthew green
* copyright(c) 1993
*
* See the copyright file, or do a help ircii copyright
*
* @(#)$Id: irc_std.h,v 1.2 2001/08/28 19:10:17 edwards Exp $
*/
#ifndef __irc_std_h
#define __irc_std_h
#include "defs.h"
/*
* Everybody needs these ANSI headers...
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdarg.h>
/*
* Everybody needs these POSIX headers...
*/
#include <unistd.h>
#include <signal.h>
#include <limits.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/param.h>
/*
* Everybody needs these INET headers...
*/
#include <sys/stat.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/resource.h>
#include <sys/socket.h>
#ifdef WINNT
#include <cygwin/in.h>
#else
#include <netinet/in.h>
#endif
#include <arpa/inet.h>
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#if defined(HAVE_ENDIAN_H)
#include <endian.h>
#elif defined(HAVE_SYS_ENDIAN_H)
#include <sys/endian.h>
#elif defined(HAVE_MACHINE_ENDIAN_H)
#include <machine/endian.h>
#elif defined(HAVE_PPC_ENDIAN_H)
#include <ppc/endian.h>
#elif defined(__PPC__)
#include <ppc/endian.h>
#endif
/*
* Some systems define tputs, etc in this header
*/
#ifdef HAVE_TERMCAP_H
#include <termcap.h>
#endif
#ifdef USING_CURSES
#ifdef HPUX
#define _XOPEN_SOURCE_EXTENDED
#endif
#include <curses.h>
#endif
#ifdef USING_NCURSES
#include <ncurses.h>
#endif
#if !defined(HAVE_TERMCAP_H) && !defined(USING_CURSES) && !defined(HAVE_TERMINFO) && !defined(HAVE_TERM_H)
int tputs(const unsigned char *, int, int (*)(int));
#endif
/*
* Deal with brokenness in <time.h> and <sys/time.h>
*/
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
/*
* Deal with brokenness in <fcntl.h> and <sys/fcntl.h>
*/
#ifdef HAVE_SYS_FCNTL_H
# include <sys/fcntl.h>
#else
# ifdef HAVE_FCNTL_H
# include <fcntl.h>
# endif
#endif
/*
* Deal with brokenness figuring out struct direct
*/
#if HAVE_DIRENT_H
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
#else
# define dirent direct
# define NAMLEN(dirent) (dirent)->d_namlen
# if HAVE_SYS_NDIR_H
# include <sys/ndir.h>
# endif
# if HAVE_SYS_DIR_H
# include <sys/dir.h>
# endif
# if HAVE_NDIR_H
# include <ndir.h>
# endif
#endif
/*
* First try to figure out if we can use GNU CC special features...
*/
#ifndef __GNUC__
# define __inline /* delete gcc keyword */
# define __A(x)
# define __N
# define __inline__
#else
# if (__GNUC__ >= 2) && (__GNUC_MINOR__ >= 7)
# define __A(x) __attribute__ ((format (printf, x, x + 1)))
# define __N __attribute__ ((noreturn))
# else
# define __A(x)
# define __N
# define __inline
# endif
#endif
/*
* Figure out how to make alloca work
* I took this from the autoconf documentation
*/
#if defined(__GNUC__) && !defined(HAVE_ALLOCA_H)
# define alloca __builtin_alloca
#else
# if HAVE_ALLOCA_H
# include <alloca.h>
# else
# ifdef _AIX
#pragma alloca
# else
# ifndef alloca
char *alloca();
# endif
# endif
# endif
#endif
# include <errno.h>
extern int errno;
/*
* Some systems (AIX) have sys/select.h, but dont include it from sys/types.h
* Some systems (Solaris) have sys/select.h, but include it from sys/types.h
* and dont want you to do it again. Some systems dont have sys/select.h
* Configure has this all figured out for us already.
*/
#if defined(HAVE_SYS_SELECT_H) && defined(NEED_SYS_SELECT_H)
#include <sys/select.h>
#endif
#ifdef SCO
#include <fcntl.h>
#include <strings.h>
#endif
#ifndef WINNT
#ifndef NBBY
# define NBBY 8 /* number of bits in a byte */
#endif /* NBBY */
#ifndef NFDBITS
# define NFDBITS (sizeof(long) * NBBY) /* bits per mask */
#endif /* NFDBITS */
#ifndef FD_SETSIZE
#define FD_SETSIZE 256
#endif
#endif
#ifndef howmany
#define howmany(x, y) (((x) + ((y) - 1)) / (y))
#endif
#ifdef HAVE_SYS_SYSLIMITS_H
# include <sys/syslimits.h>
#endif
#include <limits.h>
typedef RETSIGTYPE sigfunc (int);
sigfunc *my_signal (int, sigfunc *, int);
#define SIGNAL_HANDLER(x) \
RETSIGTYPE x (int unused)
#include <stdlib.h>
#define index strchr
#ifndef MAXPATHLEN
#ifndef PATHSIZE
#define PATHSIZE 1024
#endif
#define MAXPATHLEN PATHSIZE
#endif
/*
* Dont trust anyone else's NULLs.
*/
#ifdef NULL
#undef NULL
#endif
#define NULL (void *) 0
#ifndef HAVE_STRERROR
#ifndef SYS_ERRLIST_DECLARED
extern char *sys_errlist[];
#endif
#define strerror(x) (char *)sys_errlist[x]
#endif
#if !defined(HAVE_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
extern int gettimeofday(struct timeval *tv, struct timezone *tz);
#endif
/* we need an unsigned 32 bit integer for dcc, how lame */
#ifdef UNSIGNED_LONG32
typedef unsigned long u_32int_t;
#else
# ifdef UNSIGNED_INT32
typedef unsigned int u_32int_t;
# else
typedef unsigned long u_32int_t;
# endif /* UNSIGNED_INT32 */
#endif /* UNSIGNED_LONG32 */
#define BUILT_IN_COMMAND(x) \
void x (char *command, char *args, char *subargs, char *helparg, unsigned int numeric)
#define BUILT_IN_FUNCTION(x) \
char * x (char *fn, char *input)
#if defined(_AIX)
int getpeername (int s, struct sockaddr *, int *);
int getsockname (int s, struct sockaddr *, int *);
int socket (int, int, int);
int bind (int, struct sockaddr *, int);
int listen (int, int);
int accept (int, struct sockaddr *, int *);
int recv (int, void *, int, unsigned int);
int send (int, void *, int, unsigned int);
int gettimeofday (struct timeval *, struct timezone *);
int gethostname (char *, int);
int setsockopt (int, int, int, void *, int);
int setitimer (int, struct itimerval *, struct itimerval *);
int ioctl (int, int, ...);
#endif
#ifdef __EMX__
#define strcasecmp stricmp
#define strncasecmp strnicmp
#endif
#ifndef HAVE_MEMMOVE
void *memmove(char *, const char *, register size_t);
#endif
#if defined(_SYS_SIGLIST_DECLARED) && !defined(SYS_SIGLIST_DECLARED)
#define sys_siglist _sys_siglist
#endif
#ifndef PATH_MAX
#define PATH_MAX 255
#endif
#ifdef THREAD
#include <pthread.h>
#if defined(MUTEX_INITIALIZER) && !defined(PTHREAD_MUTEX_INITIALIZER)
#define PTHREAD_MUTEX_INITIALIZER MUTEX_INITIALIZER
#endif
#endif
#if !defined(__BYTE_ORDER)
#if defined(BYTE_ORDER)
#define __BYTE_ORDER BYTE_ORDER
#else
#if defined(WORDS_BIGENDIAN)
#define __BYTE_ORDER 1
#else
#define __BYTE_ORDER 0
#endif
#endif
#endif
#if !defined(__BIG_ENDIAN)
#if defined(BIG_ENDIAN)
#define __BIG_ENDIAN BIG_ENDIAN
#else
#define __BIG_ENDIAN 1
#endif
#endif
#if defined(WORDS_BIGENDIAN)
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN 1
#endif
#ifndef __BYTE_ORDER
#define __BYTE_ORDER 1
#endif
#endif
#if __BYTE_ORDER == __BIG_ENDIAN
#define BSWAP16(c) (((c & 0xff) << 8) | ((c >> 8) & 0xff))
#define BSWAP32(c) (((c >> 24) & 0xff) | ((c & 0xff0000) >> 8) | ((c & 0xff00) << 8) | (c << 24))
#else
#define BSWAP16(c) c
#define BSWAP32(c) c
#endif
#ifndef O_BINARY
#define O_BINARY 0
#endif
#ifndef O_TEXT
#define O_TEXT 1
#endif
#endif /* __irc_std_h */
|