Fix p_inet_pton on windows

`p_inet_pton` on Windows should set `errno` properly for callers.
Rewrite `p_inet_pton` to handle error cases correctly and add
test cases to exercise this function.