1164Seric /* 2*33781Sbostic * Copyright (c) 1988 Regents of the University of California. 3*33781Sbostic * All rights reserved. 4*33781Sbostic * 5*33781Sbostic * Redistribution and use in source and binary forms are permitted 6*33781Sbostic * provided that this notice is preserved and that due credit is given 7*33781Sbostic * to the University of California at Berkeley. The name of the University 8*33781Sbostic * may not be used to endorse or promote products derived from this 9*33781Sbostic * software without specific prior written permission. This software 10*33781Sbostic * is provided ``as is'' without express or implied warranty. 11*33781Sbostic * 12*33781Sbostic * @(#)useful.h 4.3 (Berkeley) 03/24/88 13*33781Sbostic */ 14164Seric 154148Seric # ifndef makedev 1611723Seric # include <sys/types.h> 174148Seric # endif 184148Seric 194148Seric /* support for bool type */ 204148Seric typedef char bool; 21164Seric # define TRUE 1 22164Seric # define FALSE 0 23164Seric 24164Seric # ifndef NULL 25164Seric # define NULL 0 26164Seric # endif NULL 272975Seric 284148Seric /* bit hacking */ 297113Seric # define bitset(bit, word) (((word) & (bit)) != 0) 304086Seric 3110120Seric /* some simple functions */ 3210120Seric # ifndef max 3310120Seric # define max(a, b) ((a) > (b) ? (a) : (b)) 3410120Seric # define min(a, b) ((a) < (b) ? (a) : (b)) 3510120Seric # endif max 3610120Seric 375196Seric /* assertions */ 385196Seric # ifndef NASSERT 395196Seric # define ASSERT(expr, msg, parm)\ 405196Seric if (!(expr))\ 415196Seric {\ 425196Seric fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\ 435196Seric fprintf(stderr, msg, parm);\ 445196Seric } 455196Seric # else NASSERT 465196Seric # define ASSERT(expr, msg, parm) 475196Seric # endif NASSERT 485196Seric 495196Seric /* sccs id's */ 505196Seric # ifndef lint 515196Seric # define SCCSID(arg) static char SccsId[] = "arg"; 525196Seric # else lint 535196Seric # define SCCSID(arg) 545196Seric # endif lint 555196Seric 564086Seric /* define the types of some common functions */ 575183Seric extern char *strcpy(), *strncpy(); 585183Seric extern char *strcat(), *strncat(); 594086Seric extern char *malloc(); 604086Seric extern char *index(), *rindex(); 614086Seric extern int errno; 624835Seric extern time_t time(); 634086Seric extern char *ctime(); 644086Seric # ifndef V6 654086Seric extern char *getenv(); 666281Seric # endif V6 676281Seric # ifndef VMUNIX 6811724Seric typedef unsigned short u_short; 6911724Seric typedef long u_long; 7011724Seric typedef char u_char; 7111724Seric typedef int void; 726281Seric # endif VMUNIX 73