Date: Wed, 12 Jul 2000 18:00:16 -0400 From: "Thomas M. Sommers" <tms2@mail.ptd.net> To: Dag-Erling Smorgrav <des@flood.ping.uio.no> Cc: Mike Pritchard <mpp@mppsystems.com>, Alfred Perlstein <bright@wintelcom.net>, arch@FreeBSD.ORG Subject: Re: kernel printf %i? Message-ID: <396CEA70.2C7A69B3@mail.ptd.net> References: <5lzonpbc53.fsf@assaris.sics.se> <57067.963303670@axl.ops.uunet.co.za> <20000711013227.P25571@fw.wintelcom.net> <20000711041415.A16480@mppsystems.com> <xzpsntfg623.fsf@flood.ping.uio.no>
next in thread | previous in thread | raw e-mail | index | archive | help
Dag-Erling Smorgrav wrote: > > Speaking of printf(), there are two things I'd like to see added: > > - in libc, a *dprintf() family similar to *fprintf() except that they > write to a file descriptor instead of a FILE *. How about something like this: #include <stdarg.h> #include <stdio.h> int dprintf(int fd, const char *format, ...) { char *buf; int err; int len; va_list args; va_start(args, format); len = vasprintf(&buf, format, args); va_end(args); err = write(fd, buf, len); free(buf); return err; } -- I do not approve of anything that tampers with natural ignorance. Ignorance is like a delicate exotic fruit; touch it and the bloom is gone. -- Lady Bracknell To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?396CEA70.2C7A69B3>