summaryrefslogtreecommitdiff
path: root/libbsd/snprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbsd/snprintf.c')
-rw-r--r--libbsd/snprintf.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libbsd/snprintf.c b/libbsd/snprintf.c
new file mode 100644
index 0000000..04bc387
--- /dev/null
+++ b/libbsd/snprintf.c
@@ -0,0 +1,15 @@
+/* snprintf.c - emulate BSD snprintf with sprintf - rick sladkey */
+
+#include <stdio.h>
+#include <stdarg.h>
+
+int snprintf(char *s, int len, char *format, ...)
+{
+ va_list args;
+ int result;
+
+ va_start(args, format);
+ result = vsprintf(s, format, args);
+ va_end(args);
+ return result;
+}