From owner-freebsd-arch Wed Jul 12 15: 0:53 2000 Delivered-To: freebsd-arch@freebsd.org Received: from mail.ptd.net (mail1.ha-net.ptd.net [207.44.96.65]) by hub.freebsd.org (Postfix) with SMTP id 6887037B5BA for ; Wed, 12 Jul 2000 15:00:46 -0700 (PDT) (envelope-from tms2@mail.ptd.net) Received: (qmail 24195 invoked from network); 12 Jul 2000 22:00:50 -0000 Received: from du211008.cli.ptd.net (HELO mail.ptd.net) (204.186.211.8) by mail.ptd.net with SMTP; 12 Jul 2000 22:00:50 -0000 Message-ID: <396CEA70.2C7A69B3@mail.ptd.net> Date: Wed, 12 Jul 2000 18:00:16 -0400 From: "Thomas M. Sommers" Organization: None X-Mailer: Mozilla 4.72 [en] (X11; I; FreeBSD 4.0-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: Dag-Erling Smorgrav Cc: Mike Pritchard , Alfred Perlstein , arch@FreeBSD.ORG Subject: Re: kernel printf %i? References: <5lzonpbc53.fsf@assaris.sics.se> <57067.963303670@axl.ops.uunet.co.za> <20000711013227.P25571@fw.wintelcom.net> <20000711041415.A16480@mppsystems.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 #include 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