/*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * %sccs.include.redist.c% */ #ifndef lint static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 06/05/93"; #endif /* not lint */ #include #include #include #include #include #include "extern.h" u_int log2(num) u_int num; { register u_int i, limit; limit = 1; for (i = 0; limit < num; limit = limit << 1, i++); return (i); } #if __STDC__ #include #else #include #endif void #if __STDC__ fatal(const char *fmt, ...) #else fatal(fmt, va_alist) char *fmt; va_dcl #endif { va_list ap; #if __STDC__ va_start(ap, fmt); #else va_start(ap); #endif (void)fprintf(stderr, "%s: ", progname); (void)vfprintf(stderr, fmt, ap); va_end(ap); (void)fprintf(stderr, "\n"); exit(1); /* NOTREACHED */ }