Kragen's third C .signature puzzle

Last updated 1999-07-12.

Here's the program:

char a[99]="  KJ";main(int c,char**v){int s=socket(2,1,0);char*p,*t=strchr(*++v
,'@'),*o=a+4;*(short*)a=2;p=t;while(*p)(*p++&48)-48?*o++=atoi(p):0;connect(s,a,
16);strncpy(a,v[1],7);a[7]=':';a[8]=32;if(fork())while((c=read(0,a+9,90))>0)(
write(s,a,c+9)>0)||exit(0);else while((c=read(s,a,99))>0)write(1,a,c);}

Here I have a line-by-line explanation and how to run it. It works with another tiny program.

By the way, to make it work properly under Linux, the part that says socket(2,1,0) should be changed, but I don't know how. The second argument should be the Linux value of SOCK_DGRAM.

It might run on non-Unix systems, but I've only tested it on Solaris.


Kragen's home page