TODO [was: Re: [PATCH] do not use gnuism 'dprintf' in watch.c]

Bernhard Fischer rep.nop at aon.at
Fri May 19 06:21:28 PDT 2006


On Thu, May 18, 2006 at 09:00:46PM -0400, Rich Felker wrote:
>no comments..
>
>rich
>

IMHO we should clean these dprintf stuff up some more:

crond.c implements a (superfluous?)
static void fdprintf(int fd, const char *ctl, ...)
we have
int vdprintf(int d, const char *format, va_list ap)
in libbb/vdprintf.c

Other users of "dprintf" on trunk currently include

coreutils/watch.c (dprintf)
coreutils/tail.c  (dprintf)
coreutils/sort.c://dprintf(2,"debug cruft
miscutils/crond.c (fdprintf impl!)
shell/ash.c       (dprintf)
sysklogd/syslogd.c (vdprintf)
TODO (note to do away with vdprintf())

Anyone up to or willing to tackle these?

>Index: coreutils/watch.c
>===================================================================
>--- coreutils/watch.c	(revision 15108)
>+++ coreutils/watch.c	(working copy)
>@@ -86,8 +86,7 @@
> 
> 	while (1) {
> 		time(&t);
>-		/* Use dprintf to avoid fflush()ing stdout. */
>-		if (dprintf(1, "\033[H\033[J%-*s%s\n", header_len, header, ctime(&t)) < 0) {
>+		if (printf("\033[H\033[J%-*s%s\n", header_len, header, ctime(&t)) < 0 || fflush(stdout) < 0) {
> 			bb_perror_msg_and_die("printf");
> 		}
> 

>_______________________________________________
>busybox mailing list
>busybox at busybox.net
>http://busybox.net/cgi-bin/mailman/listinfo/busybox


More information about the busybox mailing list