The link is what you want. That said, you should nonetheless ensure that you are closing all of your sockets, files, etc. in your code.

Also,
Code:
buf[LINELEN] = '\0';	/* insure line null-terminated	*/
fgets() will null terminate the buffer. That will chop off the last byte if the buffer actually filled.