151150Sbostic /*-
2*61524Sbostic * Copyright (c) 1991, 1993
3*61524Sbostic * The Regents of the University of California. All rights reserved.
451150Sbostic *
551150Sbostic * %sccs.include.redist.c%
651150Sbostic */
751150Sbostic
851150Sbostic #ifndef lint
9*61524Sbostic static char sccsid[] = "@(#)misc.c 8.1 (Berkeley) 06/05/93";
1051150Sbostic #endif /* not lint */
1151150Sbostic
1251150Sbostic #include <sys/types.h>
1351150Sbostic #include <sys/types.h>
1451150Sbostic #include <sys/disklabel.h>
1551150Sbostic #include <stdlib.h>
1651150Sbostic #include <stdio.h>
1751150Sbostic #include "extern.h"
1851150Sbostic
1951150Sbostic u_int
log2(num)2051150Sbostic log2(num)
2151150Sbostic u_int num;
2251150Sbostic {
2351150Sbostic register u_int i, limit;
2451150Sbostic
2551150Sbostic limit = 1;
2651150Sbostic for (i = 0; limit < num; limit = limit << 1, i++);
2751150Sbostic return (i);
2851150Sbostic }
2951150Sbostic
3051150Sbostic #if __STDC__
3151150Sbostic #include <stdarg.h>
3251150Sbostic #else
3351150Sbostic #include <varargs.h>
3451150Sbostic #endif
3551150Sbostic
3651150Sbostic void
3751150Sbostic #if __STDC__
fatal(const char * fmt,...)3851150Sbostic fatal(const char *fmt, ...)
3951150Sbostic #else
4051150Sbostic fatal(fmt, va_alist)
4151150Sbostic char *fmt;
4251150Sbostic va_dcl
4351150Sbostic #endif
4451150Sbostic {
4551150Sbostic va_list ap;
4651150Sbostic #if __STDC__
4751150Sbostic va_start(ap, fmt);
4851150Sbostic #else
4951150Sbostic va_start(ap);
5051150Sbostic #endif
5151150Sbostic (void)fprintf(stderr, "%s: ", progname);
5251150Sbostic (void)vfprintf(stderr, fmt, ap);
5351150Sbostic va_end(ap);
5451150Sbostic (void)fprintf(stderr, "\n");
5551150Sbostic exit(1);
5651150Sbostic /* NOTREACHED */
5751150Sbostic }
58