summaryrefslogtreecommitdiffstats
path: root/src/bluetooth.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-03-27 14:37:59 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-03-27 14:37:59 +0000
commit9280b803576dc54bfc7f51c8e5154d1f29692991 (patch)
treeccb68150325d139414204095879928923ae35c2d /src/bluetooth.c
parent8bd7ef87e49b68c3090448f337454a1704f5e048 (diff)
Add ba*printf() functions
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)
{