|
|
1.1 ! root 1: /* ! 2: ** USEFUL.H -- Some useful stuff. ! 3: ** ! 4: ** @(#)useful.h 4.1 7/25/83 ! 5: */ ! 6: ! 7: # ifndef makedev ! 8: # include <sys/types.h> ! 9: # endif ! 10: ! 11: /* support for bool type */ ! 12: typedef char bool; ! 13: # define TRUE 1 ! 14: # define FALSE 0 ! 15: ! 16: # ifndef NULL ! 17: # define NULL 0 ! 18: # endif NULL ! 19: ! 20: /* bit hacking */ ! 21: # define bitset(bit, word) (((word) & (bit)) != 0) ! 22: ! 23: /* some simple functions */ ! 24: # ifndef max ! 25: # define max(a, b) ((a) > (b) ? (a) : (b)) ! 26: # define min(a, b) ((a) < (b) ? (a) : (b)) ! 27: # endif max ! 28: ! 29: /* assertions */ ! 30: # ifndef NASSERT ! 31: # define ASSERT(expr, msg, parm)\ ! 32: if (!(expr))\ ! 33: {\ ! 34: fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\ ! 35: fprintf(stderr, msg, parm);\ ! 36: } ! 37: # else NASSERT ! 38: # define ASSERT(expr, msg, parm) ! 39: # endif NASSERT ! 40: ! 41: /* sccs id's */ ! 42: # ifndef lint ! 43: # define SCCSID(arg) static char SccsId[] = "arg"; ! 44: # else lint ! 45: # define SCCSID(arg) ! 46: # endif lint ! 47: ! 48: /* define the types of some common functions */ ! 49: extern char *strcpy(), *strncpy(); ! 50: extern char *strcat(), *strncat(); ! 51: extern char *malloc(); ! 52: extern char *index(), *rindex(); ! 53: extern int errno; ! 54: extern char *sprintf(); ! 55: extern time_t time(); ! 56: extern char *ctime(); ! 57: # ifndef V6 ! 58: extern char *getenv(); ! 59: # endif V6 ! 60: # ifndef VMUNIX ! 61: typedef unsigned short u_short; ! 62: typedef long u_long; ! 63: typedef char u_char; ! 64: typedef int void; ! 65: # endif VMUNIX
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.