libknc.c: implement more complicated SIGPIPE handling.

Turns out the Linux doesn't have O_NOSIGPIPE or SOCK_NOSIGPIPE and so
we must implement this the hard way to get the correct behaviour on it.
libknc: whitespace fixes.
libknc: make inclusion of config.h conditional.