bmake-ify sd
[unleashed.git] / bin / pax / dprintf.c
blob165d5f60bfcafe7280322029be181eea6eb66dcf
1 #include <stdio.h>
2 #include <stdarg.h>
3 #include <stdlib.h>
5 int
6 dprintf(int fd, const char *fmt, ...)
8 char *s = NULL;
9 va_list ap;
10 int ret;
12 va_start(ap, fmt);
13 ret = vasprintf(&s, fmt, ap);
14 va_end(ap);
15 if (ret < 0)
16 return ret;
17 ret = write(fd, s, ret);
18 free(s);
19 return ret;