|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1988 Regents of the University of California. ! 3: * All rights reserved. ! 4: * ! 5: * Redistribution and use in source and binary forms are permitted provided ! 6: * that: (1) source distributions retain this entire copyright notice and ! 7: * comment, and (2) distributions including binaries display the following ! 8: * acknowledgement: ``This product includes software developed by the ! 9: * University of California, Berkeley and its contributors'' in the ! 10: * documentation or other materials provided with the distribution and in ! 11: * all advertising materials mentioning features or use of this software. ! 12: * Neither the name of the University nor the names of its contributors may ! 13: * be used to endorse or promote products derived from this software without ! 14: * specific prior written permission. ! 15: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 16: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 17: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 18: * ! 19: * @(#)useful.h 4.6 (Berkeley) 6/1/90 ! 20: */ ! 21: ! 22: # include <sys/types.h> ! 23: ! 24: /* support for bool type */ ! 25: typedef char bool; ! 26: # define TRUE 1 ! 27: # define FALSE 0 ! 28: ! 29: # ifndef NULL ! 30: # define NULL 0 ! 31: # endif NULL ! 32: ! 33: /* bit hacking */ ! 34: # define bitset(bit, word) (((word) & (bit)) != 0) ! 35: ! 36: /* some simple functions */ ! 37: # ifndef max ! 38: # define max(a, b) ((a) > (b) ? (a) : (b)) ! 39: # define min(a, b) ((a) < (b) ? (a) : (b)) ! 40: # endif max ! 41: ! 42: /* assertions */ ! 43: # ifndef NASSERT ! 44: # define ASSERT(expr, msg, parm)\ ! 45: if (!(expr))\ ! 46: {\ ! 47: fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\ ! 48: fprintf(stderr, msg, parm);\ ! 49: } ! 50: # else NASSERT ! 51: # define ASSERT(expr, msg, parm) ! 52: # endif NASSERT ! 53: ! 54: /* sccs id's */ ! 55: # ifndef lint ! 56: # define SCCSID(arg) static char SccsId[] = "arg"; ! 57: # else lint ! 58: # define SCCSID(arg) ! 59: # endif lint ! 60: ! 61: /* define the types of some common functions */ ! 62: extern char *strcpy(), *strncpy(); ! 63: extern char *strcat(), *strncat(); ! 64: extern char *malloc(); ! 65: extern char *index(), *rindex(); ! 66: extern int errno; ! 67: extern time_t time(); ! 68: extern char *ctime(); ! 69: extern char *getenv();
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.