pax: avoid implicit function declaration warnings
[unleashed.git] / bin / pax / dprintf.c
blob9364d3f992acc32ee13767d100dc67caf8db31fa
1 #include <stdio.h>
2 #include <stdarg.h>
3 #include <stdlib.h>
4 #include <unistd.h>
6 int
7 dprintf(int fd, const char *fmt, ...)
9 char *s = NULL;
10 va_list ap;
11 int ret;
13 va_start(ap, fmt);
14 ret = vasprintf(&s, fmt, ap);
15 va_end(ap);
16 if (ret < 0)
17 return ret;
18 ret = write(fd, s, ret);
19 free(s);
20 return ret;