dprintf
Shaun Jackman
sjackman@gmail.com
Thu Sep 29 19:29:00 GMT 2005
2005/9/29, Jeff Johnston <jjohnstn@redhat.com>:
> Shaun Jackman wrote:
> > I'm attempting to compile busybox using newlib. busybox uses glibc's
> > dprintf in a number of places. Could/should dprintf be implemented in
> > newlib?
> >
> > Cheers,
> > Shaun
>
> There is dprintf.c in libc/misc
>
> -- Jeff J.
The debugging printf, __dprintf, in libc/misc is somewhat different
than the dprintf that glibc implements and busybox expects. I've
included an implementation of the GNU dprintf in this mail.
Cheers,
Shaun
int vasprintf(char **strp, const char *format, va_list ap);
int vdprintf(int fd, const char *format, va_list ap)
{
char *p;
int n = vasprintf(&p, format, ap);
if (n == -1) return -1;
n = write(fd, p, n);
free(p);
return n;
}
int dprintf(int fd, const char *format, ...)
{
va_list ap;
int n;
va_start(ap, format);
n = vdprintf(fd, format, ap);
va_end(ap);
return n;
}
More information about the Newlib
mailing list