diff options
author | kstailey <kstailey@cvs.openbsd.org> | 1996-11-29 04:53:40 +0000 |
---|---|---|
committer | kstailey <kstailey@cvs.openbsd.org> | 1996-11-29 04:53:40 +0000 |
commit | 7895e964c7eadf8aa2d6eb39fd0b6d13e6c1c7e3 (patch) | |
tree | 8173c39dca637fddc2406b1679ccc1f22be0d503 /sys/kern | |
parent | 5dcbfbb64e3858fa1390055c4d885d154c9461eb (diff) |
back out bitmask_snprintf()
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_prf.c | 79 |
1 files changed, 1 insertions, 78 deletions
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 - * "<x>", 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); -} |