summaryrefslogtreecommitdiff
path: root/kern
diff options
context:
space:
mode:
Diffstat (limited to 'kern')
-rw-r--r--kern/printf.c10
-rw-r--r--kern/printf.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/kern/printf.c b/kern/printf.c
index af59d5a..ea78d48 100644
--- a/kern/printf.c
+++ b/kern/printf.c
@@ -615,6 +615,16 @@ vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
return cookie.index;
}
+int
+snprintf(char *buf, size_t size, const char *fmt, ...)
+{
+ int written;
+ va_list listp;
+ va_start(listp, fmt);
+ written = vsnprintf(buf, size, fmt, listp);
+ va_end(listp);
+ return written;
+}
void safe_gets(str, maxlen)
char *str;
diff --git a/kern/printf.h b/kern/printf.h
index 8b4e760..0f8b328 100644
--- a/kern/printf.h
+++ b/kern/printf.h
@@ -40,6 +40,7 @@ extern void printnum (unsigned long u, int base,
vm_offset_t putc_arg);
extern int sprintf (char *buf, const char *fmt, ...);
+extern int snprintf (char *buf, size_t size, const char *fmt, ...);
extern int vsnprintf (char *buf, size_t size, const char *fmt, va_list args);
extern int printf (const char *fmt, ...);