summaryrefslogtreecommitdiff
path: root/sys/kern/subr_prf.c
diff options
context:
space:
mode:
authorArchie Cobbs <archie@FreeBSD.org>1999-06-07 18:26:26 +0000
committerArchie Cobbs <archie@FreeBSD.org>1999-06-07 18:26:26 +0000
commit05292ba2349557db5970f9d620c48015915db988 (patch)
treea6d5f43d1af11da71b8c8f546c5da329fa92af21 /sys/kern/subr_prf.c
parent39fbb9465ec0c7062cfc9da8cbcfa6aab6a11eeb (diff)
downloadsrc-test2-05292ba2349557db5970f9d620c48015915db988.tar.gz
src-test2-05292ba2349557db5970f9d620c48015915db988.zip
Notes
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r--sys/kern/subr_prf.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index 4666a256dafe..f271208acd16 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)subr_prf.c 8.3 (Berkeley) 1/21/94
- * $Id: subr_prf.c,v 1.52 1999/06/01 18:20:29 jlemon Exp $
+ * $Id: subr_prf.c,v 1.53 1999/06/06 02:41:55 archie Exp $
*/
#include <sys/param.h>
@@ -60,21 +60,21 @@
#define TOTTY 0x02
#define TOLOG 0x04
-/* Max number conversion buffer length: a long in base 8, plus NUL byte */
-#define MAXNBUF (sizeof(long) * NBBY / 3 + 2)
-
-struct tty *constty; /* pointer to console "window" tty */
+/* Max number conversion buffer length: a long in base 2, plus NUL byte. */
+#define MAXNBUF (sizeof(long) * NBBY + 1)
struct putchar_arg {
- int flags;
- struct tty *tty;
+ int flags;
+ struct tty *tty;
};
struct snprintf_arg {
- char *str;
- size_t remain;
+ char *str;
+ size_t remain;
};
+struct tty *constty; /* pointer to console "window" tty */
+
static void (*v_putc)(int) = cnputc; /* routine to putc on virtual console */
static void logpri __P((int level));
static void msglogchar(int c, void *dummyarg);
@@ -217,8 +217,8 @@ static void
logpri(level)
int level;
{
- register char *p;
char nbuf[MAXNBUF];
+ register char *p;
msglogchar('<', NULL);
for (p = ksprintn(nbuf, (u_long)level, 10, NULL); *p;)
@@ -386,25 +386,26 @@ snprintf_func(int ch, void *arg)
}
/*
- * Put a number (base <= 16) in a buffer in reverse order; return an
- * optional length and a pointer to the NULL terminated (preceded?)
- * buffer. The buffer pointed to by "buf" must have length >= MAXNBUF.
+ * Put a NUL-terminated ASCII number (base <= 16) in a buffer in reverse
+ * order; return an optional length and a pointer to the last character
+ * written in the buffer (i.e., the first character of the string).
+ * The buffer pointed to by `nbuf' must have length >= MAXNBUF.
*/
static char *
-ksprintn(buf, ul, base, lenp)
- char *buf;
+ksprintn(nbuf, ul, base, lenp)
+ char *nbuf;
register u_long ul;
register int base, *lenp;
-{ /* A long in base 8, plus NULL. */
+{
register char *p;
- p = buf;
+ p = nbuf;
*p = '\0';
do {
*++p = hex2ascii(ul % base);
} while (ul /= base);
if (lenp)
- *lenp = p - buf;
+ *lenp = p - nbuf;
return (p);
}