1164Seric /* 233781Sbostic * Copyright (c) 1988 Regents of the University of California. 333781Sbostic * All rights reserved. 433781Sbostic * 5*42830Sbostic * %sccs.include.redist.c% 633781Sbostic * 7*42830Sbostic * @(#)useful.h 4.6 (Berkeley) 06/01/90 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 19164Seric # 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 } 385196Seric # else NASSERT 395196Seric # define ASSERT(expr, msg, parm) 405196Seric # endif NASSERT 415196Seric 425196Seric /* sccs id's */ 435196Seric # ifndef lint 445196Seric # define SCCSID(arg) static char SccsId[] = "arg"; 455196Seric # else lint 465196Seric # define SCCSID(arg) 475196Seric # endif lint 485196Seric 494086Seric /* define the types of some common functions */ 505183Seric extern char *strcpy(), *strncpy(); 515183Seric extern char *strcat(), *strncat(); 524086Seric extern char *malloc(); 534086Seric extern char *index(), *rindex(); 544086Seric extern int errno; 554835Seric extern time_t time(); 564086Seric extern char *ctime(); 574086Seric extern char *getenv(); 58