summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_prf.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-02-04 10:00:34 +0000
committerphk <phk@FreeBSD.org>2003-02-04 10:00:34 +0000
commit1abb95308bcc72d0a245f8d4c0f779f3cbe67d90 (patch)
treefb8cff7ecb9b71f302d44196666e92ebcf102acc /sys/kern/subr_prf.c
parent99ddf819f9950cb17e81c2e37fb3e4fe0f574c5a (diff)
downloadFreeBSD-src-1abb95308bcc72d0a245f8d4c0f779f3cbe67d90.zip
FreeBSD-src-1abb95308bcc72d0a245f8d4c0f779f3cbe67d90.tar.gz
Add vsnrprintf() which is just like vsnprintf() but takes a "radix"
argument for the kernel-special %r format.
Diffstat (limited to 'sys/kern/subr_prf.c')
-rw-r--r--sys/kern/subr_prf.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/kern/subr_prf.c b/sys/kern/subr_prf.c
index 56f0c2e..abe059bf7 100644
--- a/sys/kern/subr_prf.c
+++ b/sys/kern/subr_prf.c
@@ -416,6 +416,23 @@ vsnprintf(char *str, size_t size, const char *format, va_list ap)
return (retval);
}
+/*
+ * Kernel version which takes radix argument vsnprintf(3).
+ */
+int
+vsnrprintf(char *str, size_t size, int radix, const char *format, va_list ap)
+{
+ struct snprintf_arg info;
+ int retval;
+
+ info.str = str;
+ info.remain = size;
+ retval = kvprintf(format, snprintf_func, &info, radix, ap);
+ if (info.remain >= 1)
+ *info.str++ = '\0';
+ return (retval);
+}
+
static void
snprintf_func(int ch, void *arg)
{
OpenPOWER on IntegriCloud