[BusyBox] LEAF and ticker

Alex Holden alex at linuxhacker.org
Sun Feb 3 17:08:03 UTC 2002


Serge Caron wrote:

> It is with tongue in cheek that I submit this busybox applet, ticker, for
> which we have been budgeting 3Kb since the early release of the Linux Router
> Project. It is about time this ticker got a lick.


With tongue also held firmly in cheek I humbly submit a version which I 
found to be 96 bytes smaller :)

#include <stdio.h>
#include <unistd.h>

int main(void)
{
	int i;
	char c[] = {'.', 'o', ':', 'O', ':', 'o'};

	switch(fork()) {
		case -1:
			return -1;
		case 0:
			setbuf(stdout, 0);
			putchar(' ');
			while(1) {
				for(i = 0; i < sizeof(c); i++) {
					putchar('\b');
					putchar(c[i]);
					sleep(1);
				}
			}
	}
	return 0;
}

[cue frantic attempts to beat me by another 100 bytes]

-- 
------------ Alex Holden - http://www.linuxhacker.org ------------
If it doesn't work, you're not hitting it with a big enough hammer




More information about the busybox mailing list