kernelthread.com

DigiFONT

Introduction

Here's a piece of code that does something (relatively speaking) interesting. There are a few "features" in this code that make it harder for someone to figure out what it does just by looking at it. This is not to discount that there are people who like nothing more than to look at such things.

In this C program, the function names, the variable names, the initialized data, the loops - all adhere to a theme, which is simply the character '_', which is supplemented by '|', and then some more. As would be clear from looking at output samples from running this program, it takes an integer argument, like 8086 say, and prints the integer in a banner format. This makes the code actually useful too - for example, as a CGI program printing out web-page counters for the benefit of text-only browsers (there are some as of this writing).

Source

typedef int/* ___*/_______; typedef char ________; extern putchar(), printf (________/*_ _____*/*,...); _______ (*__________) ()=putchar; _______(* _________) (________ *,...)=/*___ */printf;/*__ */_/*______*/ (_______ _/*_________*/ ,________*/*_ */*__,_______ ___){_______ ____, ____________; ________/*_*/ *___________ ;________ *_____[ ][10]={{ "__|______ ", "__|__ ", "__|______ ", "__|______ ", "__|_ _ ", "__|______ ", "___|__ ", "__|_____ ", "__|______ ", "__|_____ "},{ "_|| __ |", "_|/_ |", "_||_____ |", "||_____ |", "|| | | |", "_|| ____|", "__|/ / ", "||____ |", "_|| __ |", "_|| _ |"},{ "_|| | | |", "__|| |", "______|/ /", "___|___| |", "|| |__| |", "_|| |____ ", "_|/ /___ ", "_____|| |", "_|| |__| |", "_|| |_| |"},{ "_|| | | |", "__|| |", "____|/ / ", "__||___ |", "||____ |", "_||____ |", "_|| _ |", "____|/ / ", "__|| __ | ", "_||___ |"},{ "_|| |__| |", "__|| |", "__|/ /___ ", "__|____| |", "_____| | |", "__|____| |", "_|| |_| |", "___|/ / ", "_|| |__| |", "__|___| |"},{ "_||______|", "__||_|", "_||______|", "||______|", "_____| |_|", "_||______|", "_||_____|", "__|/_/ ", "_||______|", "_||_____|"}}; for(;_<6;_++) {for(___=____ =0;1[__][___] ;___++,____=0) {for(;_[_____] [1[__][___]- '0'][____]!='|' ;____++); ____________ =____-1;for(; ____________>0; ____________ --)__________ (' ');_________ ("%s",_[_____] [1[__][___]- '0']+____+1);} __________(10) ;}__________(10 );}main( _______ __, ________* *___,_______ ____){_(0,___, 0);}/*AmitS*/

Download

digifont.c