Added better platform definitions and ignore SIGPIPE on POSIX platforms.