1164Seric /* 2164Seric ** USEFUL.H -- Some useful stuff. 3402Seric ** 4*11723Seric ** @(#)useful.h 3.12 03/26/83 5164Seric */ 6164Seric 74148Seric # ifndef makedev 8*11723Seric # include <sys/types.h> 94148Seric # endif 104148Seric 114148Seric /* support for bool type */ 124148Seric typedef char bool; 13164Seric # define TRUE 1 14164Seric # define FALSE 0 15164Seric 16164Seric # ifndef NULL 17164Seric # define NULL 0 18164Seric # endif NULL 192975Seric 204148Seric /* bit hacking */ 217113Seric # define bitset(bit, word) (((word) & (bit)) != 0) 224086Seric 2310120Seric /* some simple functions */ 2410120Seric # ifndef max 2510120Seric # define max(a, b) ((a) > (b) ? (a) : (b)) 2610120Seric # define min(a, b) ((a) < (b) ? (a) : (b)) 2710120Seric # endif max 2810120Seric 295196Seric /* assertions */ 305196Seric # ifndef NASSERT 315196Seric # define ASSERT(expr, msg, parm)\ 325196Seric if (!(expr))\ 335196Seric {\ 345196Seric fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\ 355196Seric fprintf(stderr, msg, parm);\ 365196Seric } 375196Seric # else NASSERT 385196Seric # define ASSERT(expr, msg, parm) 395196Seric # endif NASSERT 405196Seric 415196Seric /* sccs id's */ 425196Seric # ifndef lint 435196Seric # define SCCSID(arg) static char SccsId[] = "arg"; 445196Seric # else lint 455196Seric # define SCCSID(arg) 465196Seric # endif lint 475196Seric 484086Seric /* define the types of some common functions */ 495183Seric extern char *strcpy(), *strncpy(); 505183Seric extern char *strcat(), *strncat(); 514086Seric extern char *malloc(); 524086Seric extern char *index(), *rindex(); 534086Seric extern int errno; 544086Seric extern char *sprintf(); 554835Seric extern time_t time(); 564086Seric extern char *ctime(); 574086Seric # ifndef V6 584086Seric extern char *getenv(); 596281Seric # endif V6 606281Seric # ifndef VMUNIX 614438Seric typedef char *u_short; 624438Seric typedef long u_long; 634438Seric typedef char u_char; 644438Seric typedef int void; 656281Seric # endif VMUNIX 66