/
driver3.2@242/autoconf/
driver3.2@242/doc/LPC/
driver3.2@242/hosts/
driver3.2@242/hosts/amiga/NetIncl/
driver3.2@242/hosts/amiga/NetIncl/netinet/
driver3.2@242/hosts/amiga/NetIncl/sys/
driver3.2@242/hosts/atari/
driver3.2@242/hosts/fcrypt/
driver3.2@242/mudlib/
driver3.2@242/mudlib/sys/
driver3.2@242/util/
driver3.2@242/util/indent/hosts/next/
driver3.2@242/util/make_docs/
#ifndef PORT_H
#define PORT_H

#include "machine.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif

/* p_int : an integer that has the same size as a pointer */
#if SIZEOF_INT == SIZEOF_P_INT
typedef int		p_int;
typedef unsigned int	p_uint;
#else
#if SIZEOF_LONG == SIZEOF_P_INT
typedef long		p_int;
typedef unsigned long	p_uint;
#endif
#if SIZEOF_LONG < SIZEOF_P_INT
typedef long long		p_int;
typedef unsigned long long	p_uint;
#endif
#endif

/* ph_int : an integer that has half the size of a pointer */
#if SIZEOF_P_INT == SIZEOF_INT * 2
typedef int		ph_int;
typedef unsigned int	ph_uint;
#else
#if SIZEOF_P_INT == 4
/* short is assumed to be always 2 bytes. */
typedef short		ph_int;
typedef unsigned short	ph_uint;
#endif
#endif

/* mp_int : an integer that has at least the size of a pointer */
#if SIZEOF_INT >= SIZEOF_P_INT
typedef int		mp_int;
typedef unsigned int	mp_uint;
#else
typedef p_int	mp_int
typedef p_unit	mp_uint
#endif

/* int32 : an integer with 32 bits */
#if SIZEOF_INT == 4
typedef int		int32;
typedef unsigned int	uint32;
#else
#if SIZEOF_LONG == 4
typedef long		int32;
typedef unsigned long	uint32;
#endif
#endif

#ifdef FREE_RETURNS_VOID
#define FREE_RETURN_TYPE void
#define FREE_RETURN return;
#else
#define FREE_RETURN_TYPE int
#define FREE_RETURN return 1;
#endif

#define EXTRACT_UCHAR(p) (*(unsigned char *)(p))

#if defined(atarist) || defined(AMIGA)
#ifndef NO_IP_DEMON
#define NO_IP_DEMON
#endif
#endif

#if defined(M_UNIX) || defined(linux) || defined(solaris) || \
    defined(_POSIX_VERSION)
#ifndef POSIX
#define POSIX
#endif
#endif

#ifdef HAVE_GETRUSAGE
#if !defined(solaris)
#define RUSAGE_TIME(t) ( (t).tv_sec * 1000 + (t).tv_usec / 1000 )
#else 
#define RUSAGE_TIME(t) ( (t).tv_sec * 1000 + (t).tv_nsec / 1000000 )
#endif
#else /* !HAVE_GETRUSAGE */
#undef RUSAGE_RESTRICTED
#define RUSAGE_RESTRICTED
#ifdef POSIX

#define RUSAGE_SELF     0
struct rusage {
    long ru_utime, ru_stime;
};
#define RUSAGE_TIME(t) ( (t) * 1000 / sysconf(_SC_CLK_TCK) )

#endif /* POSIX */
#endif /* HAVE_GETRUSAGE */

#ifndef HAVE_MEMCPY
/* The following 'implementation' is suitable for throwing away a value,
   but not to using it; the cast to return int is likely to show a warning
   if the value is used by accident.
 */
#define memcpy(b, a, s) (*((int (*)())(&bcopy)))(a, b, s)
#endif

#ifndef HAVE_BZERO
#define bzero(str, i) memset(str, '\0', i)
#endif

#if !defined(HAVE_CRYPT) && defined(HAVE__CRYPT)
#define crypt(pass, salt) _crypt(pass, salt)
#endif

#ifndef HAVE_STRCHR
#define strchr index
#endif
#ifndef HAVE_STRRCHR
#define strchr rindex
#endif

#if defined(AMIGA)
#include "hosts/amiga/ixfile.h"
#else
#define ixstat stat
#define ixopen ((int(*)PROT((char *, int)))open)
#define ixopen3 open
#endif

#endif /* PORT_H */