From 7895e964c7eadf8aa2d6eb39fd0b6d13e6c1c7e3 Mon Sep 17 00:00:00 2001 From: kstailey Date: Fri, 29 Nov 1996 04:53:40 +0000 Subject: back out bitmask_snprintf() --- sys/kern/subr_prf.c | 79 +---------------------------------------------------- 1 file changed, 1 insertion(+), 78 deletions(-) (limited to 'sys/kern/subr_prf.c') diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c index 50e8201f436..626522063ea 100644 --- a/sys/kern/subr_prf.c +++ b/sys/kern/subr_prf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_prf.c,v 1.13 1996/11/24 04:29:48 niklas Exp $ */ +/* $OpenBSD: subr_prf.c,v 1.14 1996/11/29 04:53:39 kstailey Exp $ */ /* $NetBSD: subr_prf.c,v 1.25 1996/04/22 01:38:46 christos Exp $ */ /*- @@ -75,12 +75,6 @@ #define TOTTY 0x02 #define TOLOG 0x04 -/* - * This is the size of the buffer that should be passed to ksnprintn(). - * It's the length of a long in base 8, plus NULL. - */ -#define KSNPRINTN_BUFSIZE (sizeof(long) * NBBY / 3 + 2) - struct tty *constty; /* pointer to console "window" tty */ void (*v_putc) __P((int)) = cnputc; /* routine to putc on virtual console */ @@ -699,74 +693,3 @@ ksprintn(ul, base, lenp) *lenp = p - buf; return (p); } - - -/* - * Print a bitmask into the provided buffer, and return a pointer - * to that buffer. - */ -char * -bitmask_snprintf(ul, p, buf, buflen) - u_long ul; - const char *p; - char *buf; - size_t buflen; -{ - char *bp, *q; - size_t left; - register int n; - int ch, tmp; - /* char snbuf[KSNPRINTN_BUFSIZE]; */ - - bp = buf; - bzero(buf, buflen); - - /* - * Always leave room for the trailing NULL. - */ - left = buflen - 1; - - /* - * Print the value into the buffer. Abort if there's not - * enough room. - */ - if (buflen < KSNPRINTN_BUFSIZE) - return (buf); - - for (q = ksprintn(ul, *p++, NULL); /* , snbuf, sizeof(snbuf)); */ - (ch = *q--) != 0;) { - *bp++ = ch; - left--; - } - - /* - * If the value we printed was 0, or if we don't have room for - * "", we're done. - */ - if (ul == 0 || left < 3) - return (buf); - -#define PUTBYTE(b, c, l) \ - *(b)++ = (c); \ - if (--(l) == 0) \ - goto out; - - for (tmp = 0; (n = *p++) != 0;) { - if (ul & (1 << (n - 1))) { - PUTBYTE(bp, tmp ? ',' : '<', left); - for (; (n = *p) > ' '; ++p) { - PUTBYTE(bp, n, left); - } - tmp = 1; - } else - for (; *p > ' '; ++p) - continue; - } - if (tmp) - *bp = '>'; - -#undef PUTBYTE - - out: - return (buf); -} -- cgit v1.2.3