Kragen's .signature puzzle

Written 1999-07-08.

You probably came here because you were curious about this program I wrote:

main(int c,char**v){char a[]="ks\0Okjs!\0\0\0\0\0\0\0",*p,*t=strchr
(*++v,64),*o=a+4;int s=socket(2,2,0);*(short*)a=2;p=t;while(*p)(*p++&48)
-48?*o++=atoi(p):0;connect(s,a,16);write(s,*v,t-*v);write(s,"\n",1);while
((c=read(s,a,16))>0)write(1,a,c);}

Here I have a line-by-line explanation and how to run it.

By the way, to make it work properly under Linux, the part that says socket(2,2,0) should be changed to say socket(2,1,0). It won't work on Win32 systems; I suppose someone could try to make it work. It probably won't work on non-Unix systems in general, and it probably won't work on systems where the characters it uses have different numeric values (i.e. use highly nonstandard character sets -- the only systems I know of like this are IBM mainframes, and they don't run Unix anyway.)

If you typed it in (perverse thou!) there are some things you should be aware of:

You should probably just cut and paste it.

By the way, I would never write code like this for anything useful -- of course! I just did it because it was fun.


Kragen's home page