/*
**  USEFUL.H -- various definitions of general interest
**
**	$Header: useful.h,v 2.0 89/12/24 00:56:33 eric Exp $
**
**	Author:
**		Eric Allman
**		University of California, Berkeley
*/

#ifndef _USEFUL_H_
#define _USEFUL_H_

#include <stdio.h>

/* give a stab at the multiple-language dilemma */
#ifdef __STDC__
#define ARGS(x)		x
#define NOARGS		(void)
#define __ANSI_C__
#else
#if defined(c_plusplus) || defined(__cplusplus)
#define ARGS(x)		x
#define NOARGS		()
#define __ANSI_C__
#else
#define ARGS(x)		()
#define NOARGS		()
#endif
#endif

#ifndef VOID
#ifdef __ANSI_C__
#define VOID		void
#else
#define VOID		int
#endif
#endif

#ifndef TRUE
#define TRUE		1
#define FALSE		0
#endif

#ifndef BOOL
#define BOOL		char
#endif

#ifndef STATIC
#ifndef NODEBUG
#define STATIC
#else
#define STATIC		static
#endif
#endif

#ifndef EXTERN
#define EXTERN		extern
#endif

#ifndef CONST
#ifdef __ANSI_C__
#define CONST		const
#else
#define CONST
#endif
#endif

#ifndef NULL
#define NULL		0
#endif

#ifndef CHARNULL
#define CHARNULL	((char *) NULL)
#endif

#define FILENULL	((FILE *) NULL)

#ifdef __ANSI_C__
#define ARBPTR		void *
#else
#define ARBPTR		char *
#endif
#define __		(ARBPTR)
#define ARBNULL		(__ NULL)

#ifdef lint
#define VERSIONID(v)
#else
#define VERSIONID(v)	static char _Version[] = v;
#endif

#define BITSET(b, w)	(((b) & (w)) != 0)

#ifdef __STDC__
#include <string.h>
#else
extern char	*strchr ARGS((char *, char));
extern char	*strrchr ARGS((char *, char));
#endif

extern ARBPTR	ckalloc ARGS((unsigned int));

#define MAXINPUTLINE	200		/* maximum string input line */
#define MAXWORDLEN	100		/* maximum word (token) length */

#ifndef BSD
#define bcopy(f,t,l) memcpy(t,f,l)
#define bcmp(s,t,l) memcmp(s,t,l)
#endif

#endif /* _USEFUL_H_ */
