/*======================================================================
                    C O M M O N . H 
                    doc: Mon Feb 24 16:37:23 1992
                    dlm: Fri Jul 23 16:02:44 1993
                    (c) 1992 ant@julia
                    uE-Info: 84 6 T 0 0 72 2 2 8 ofnI
======================================================================*/

#ifndef ITIMER_REAL
#include	<sys/time.h>
#endif

#ifndef TRUE				/* standard stuff */
#define	FALSE	0
#define	TRUE	1
#endif

#define	IN	0			/* stdin fd */
#define	OUT	1			/* stdout fd */
#define	ERR	2			/* stderr fd */

#define	FOREVER	while(TRUE)
#define	EXPORT

#ifdef bool_t
struct hInfo {				/* hostinfo */
	struct hInfo 	*next;
	struct in_addr	addr;		/* hostaddr */
	CLIENT	*clnt;			/* rpc client */
	char 	name[MAXHOSTNAMELEN];	/* hostname */
	int	sock;			/* receive socket */
	XDR	xdrs;			/* receive xdr stream */
	int  	done;			/* # of lines done in total */
	int	fDone;			/* # of lines done this frame */
	int	wid;			/* worker id */
	int 	pid;			/* worker pid */
	char	rUser[32];		/* remote user name */
	char	rwd[MAXPATHLEN];	/* remote working dir */
	char	rVersion[8];		/* remote version */
	char	broken;			/* set if xmit error */
	tbPrm	request;		/* last request sent */
	int	reTrys;			/* # of comm retrys */
} ;

typedef struct hInfo hInfo;
#endif

#ifdef CALLTOUT
static struct timeval
	now = {0,0},			/* immediate return */
	callTOut = {CALLTOUT,0},	/* not so immediate return */
	resend = {RESEND,0};		/* resend traceblock msg */
#endif

#ifdef NOSYSLOG_QUIRK
#	define	OPENLOG(prog)	noSyslogOpen(prog)
#	define	SYSLOG		noSyslog
#	define	CLOSELOG()
#else
#	ifdef LOG_DAEMON
#		define	OPENLOG(prog)	openlog(prog,LOG_PID,LOG_DAEMON)
#	else	
#		define	OPENLOG(prog)	openlog(prog,LOG_PID)
#	endif
#	define	SYSLOG		syslog
#	define	CLOSELOG	closelog
#endif

#ifndef _P_tmpdir
#	define _P_tmpdir	"/tmp/"
#endif

#ifndef FD_ZERO				/* A/UX */
#	define	FD_ZERO(ssp)		*(ssp) = 0
#	define FD_SET(fd,ssp)  		*(ssp) |= (1 << fd)
#	define	FD_ISSET(fd,ssp) 	(*(ssp) & (1 << fd))
#	define	fd_set			int
#endif

#ifndef CLSET_TIMEOUT			/* A/UX */
#	define CLSET_TIMEOUT       1   
#	define clnt_control(cl,rq,in) \
		 ((*(cl)->cl_ops->cl_control)(cl,rq,in))
#endif

