xref: /csrg-svn/usr.sbin/sendmail/src/useful.h (revision 56794)
1164Seric /*
233781Sbostic  * Copyright (c) 1988 Regents of the University of California.
333781Sbostic  * All rights reserved.
433781Sbostic  *
542830Sbostic  * %sccs.include.redist.c%
633781Sbostic  *
7*56794Seric  *	@(#)useful.h	4.7 (Berkeley) 11/14/92
833781Sbostic  */
9164Seric 
1011723Seric # include <sys/types.h>
114148Seric 
124148Seric /* support for bool type */
134148Seric typedef char	bool;
14164Seric # define TRUE	1
15164Seric # define FALSE	0
16164Seric 
17164Seric # ifndef NULL
18164Seric # define NULL	0
19*56794Seric # endif /* NULL */
202975Seric 
214148Seric /* bit hacking */
227113Seric # define bitset(bit, word)	(((word) & (bit)) != 0)
234086Seric 
2410120Seric /* some simple functions */
2510120Seric # ifndef max
2610120Seric # define max(a, b)	((a) > (b) ? (a) : (b))
2710120Seric # define min(a, b)	((a) < (b) ? (a) : (b))
2810120Seric # endif max
2910120Seric 
305196Seric /* assertions */
315196Seric # ifndef NASSERT
325196Seric # define ASSERT(expr, msg, parm)\
335196Seric 	if (!(expr))\
345196Seric 	{\
355196Seric 		fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\
365196Seric 		fprintf(stderr, msg, parm);\
375196Seric 	}
38*56794Seric # else /* NASSERT */
395196Seric # define ASSERT(expr, msg, parm)
40*56794Seric # endif /* NASSERT */
415196Seric 
425196Seric /* sccs id's */
435196Seric # ifndef lint
445196Seric # define SCCSID(arg)	static char SccsId[] = "arg";
45*56794Seric # else /* lint */
465196Seric # define SCCSID(arg)
475196Seric # endif lint
48