Small patch to "clear" to add flush
JoSH Lehan
krellan at gmail.com
Wed Dec 26 20:37:19 UTC 2007
Hello.
I have made a small one-line patch to the "clear" applet, to ensure
that output gets flushed.
It's a workaround for that well-known bug in glibc:
http://sources.redhat.com/bugzilla/show_bug.cgi?id=3400
Also, I changed the clear string to output 7 characters, not 6, just
to be correct with respect to the traditional terminal codes.
Here's the patch:
diff -urN busybox-1.8.2-OLD/console-tools/clear.c
busybox-1.8.2/console-tools/clear.c
--- busybox-1.8.2-OLD/console-tools/clear.c 2007-11-09 17:40:49.000000000 -0800
+++ busybox-1.8.2/console-tools/clear.c 2007-12-20 15:51:30.000000000 -0800
@@ -15,5 +15,5 @@
int clear_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int clear_main(int argc, char **argv)
{
- return printf("\033[H\033[J") != 6;
+ return ((printf("\033[H\033[2J") != 7) || fflush(NULL));
}
Comments/suggestions?
Josh
More information about the busybox
mailing list