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
|
/*
* Copyright (c) mjh-EDV Beratung, 1996-1999
* mjh-EDV Beratung - 63263 Neu-Isenburg - Rosenstrasse 12
* Tel +49 6102 328279 - Fax +49 6102 328278
* Email info@mjh.teddy-net.com
*
* Author: Jordan Hrycaj <jordan@mjh.teddy-net.com>
*
* $Id: common-stuff.h,v 1.20 2001/01/02 12:25:36 jordan Exp $
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __COMMON_STUFF_H__
#define __COMMON_STUFF_H__
/* ----------------------------------------------------------------------- *
* begin of configurable section *
* ----------------------------------------------------------------------- */
/* All we need here is an independent send/reveive structure provided by
the operating system. */
#ifndef _WIN32 /* will be (re-)defined in the win32 config files */
#define OS_SEND(fd,buf,len,flg) send (fd, buf, len, flg)
#define OS_RECV(fd,buf,len,flg) recv (fd, buf, len, flg)
#endif
/* ----------------------------------------------------------------------- *
* end of configurable section *
* ----------------------------------------------------------------------- */
#ifdef HAVE_CONFIG_H
# include "peks-config.h"
#endif
#ifdef _WIN32
# include "peks-config.w32"
#endif
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif
#ifdef HAVE_UNISTD_H
# include <sys/types.h>
# include <unistd.h>
#else
# ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
# endif
#endif
#ifdef _WIN32
# include "common-stuff.w32"
#endif
/* size_t is defined in types.h */
#include "memalloc.h"
#if STDC_HEADERS
# include <string.h>
# include <stdlib.h>
#else
# ifdef HAVE_STRING_H
# include <string.h>
# endif
# ifdef HAVE_STRINGS_H
# include <strings.h>
# endif
# ifdef HAVE_MEMORY_H
# include <memory.h>
# endif
# ifndef HAVE_STRCHR
# define strchr index
# define strrchr rindex
# endif
# ifndef _WIN32
char *strchr (), *strrchr ();
# endif
# ifdef HAVE_BCOPY
# ifndef HAVE_MEMCPY
# define memcpy(d, s, n) bcopy ((s), (d), (n))
# endif
# ifndef HAVE_MEMMOVE
# define HAVE_MEMMOVE
# define memmove(d, s, n) bcopy ((s), (d), (n))
# endif
# endif
# ifdef HAVE_STDLIB_H
# include <stdlib.h>
# endif
#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include <limits.h>
#ifndef HAVE_STRCASECMP
extern int xstrcasecmp (const char*,const char*);
extern int xstrncasecmp (const char*,const char*,size_t);
# define strcasecmp(s,t) xstrcasecmp(s,t)
# define strncasecmp(s,t,n) xstrncasecmp(s,t,n)
#endif
#ifndef HAVE_MEMMOVE
/* redefine, so we do not bother if some prototypes hangs around */
extern void movemem (unsigned char *trg, unsigned char *src, unsigned len);
#define memmove(x,y,z) movemem (x, y, z)
#endif /* HAVE_MEMMOVE */
#ifdef HAVE_32ALIGN
#if SIZEOF_UNSIGNED_INT == 4
typedef unsigned int u32;
#elif SIZEOF_UNSIGNED_LONG == 4
typedef unsigned long u32;
#else
# error no typedef for u32
#endif
#endif /* HAVE_32ALIGN */
#ifdef HAVE_64ALIGN
#if SIZEOF_UNSIGNED_LONG == 8
typedef unsigned long u64;
#elif SIZEOF_UNSIGNED_LONG_LONG == 8
typedef unsigned long u64;
#else
# error no typedef for u64
#endif
#endif /* HAVE_64ALIGN */
#ifdef HAVE_GETTIMEOFDAY
# ifdef GETTIMEOFDAY_ONE_ARGUMENT
# define gettimeofday2(x,y) gettimeofday(x)
# else
# define gettimeofday2(x,y) gettimeofday(x,y)
# endif
# define HAVE_GETTIMEOFDAY2
#else
# ifdef HAVE_TIMEVAL
extern int gettimeofday2 (struct timeval*, struct timezone*);
# define HAVE_GETTIMEOFDAY2
# endif
#endif
#if 0 /* for extraction, only */
XPUB
XPUB /* win nt/95 compat stuff */
XPUB #ifndef _WIN32
XPUB # define HANDLE int
XPUB # define OPEN_ERROR (-1)
XPUB # define M_HIDDEN 0
XPUB # define M_RDONLY 0
XPUB # define open3(f,m,x) open (f,m,x)
XPUB # define ntconsole(x,y,a,b) /* empty def */
XPUB #endif
XPUB
#endif /* for extraction, only */
#ifndef _WIN32
# define HANDLE int
# define OPEN_ERROR (-1)
# define M_HIDDEN 0
# define M_RDONLY 0
# define open3(f,m,x) open (f,m,x)
#endif
#endif /* __COMMON_STUFF_H__ */
|