summaryrefslogtreecommitdiffstats
path: root/src/bluetooth.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bluetooth.c')
-rw-r--r--src/bluetooth.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/src/bluetooth.c b/src/bluetooth.c
index 110d65cd..484b263b 100644
--- a/src/bluetooth.c
+++ b/src/bluetooth.c
@@ -33,9 +33,10 @@
#endif
#include <stdio.h>
+#include <errno.h>
+#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
-#include <errno.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
@@ -105,6 +106,54 @@ int str2ba(const char *str, bdaddr_t *ba)
return 0;
}
+int baprintf(const char *format, ...)
+{
+ va_list ap;
+ int len;
+
+ va_start(ap, format);
+ len = vprintf(format, ap);
+ va_end(ap);
+
+ return len;
+}
+
+int bafprintf(FILE *stream, const char *format, ...)
+{
+ va_list ap;
+ int len;
+
+ va_start(ap, format);
+ len = vfprintf(stream, format, ap);
+ va_end(ap);
+
+ return len;
+}
+
+int basprintf(char *str, const char *format, ...)
+{
+ va_list ap;
+ int len;
+
+ va_start(ap, format);
+ len = vsnprintf(str, (~0U) >> 1, format, ap);
+ va_end(ap);
+
+ return len;
+}
+
+int basnprintf(char *str, size_t size, const char *format, ...)
+{
+ va_list ap;
+ int len;
+
+ va_start(ap, format);
+ len = vsnprintf(str, size, format, ap);
+ va_end(ap);
+
+ return len;
+}
+
/* Bluetooth error codes to Unix errno mapping */
int bt_error(uint16_t code)
{