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.
Merge pull request #1796 from ethomson/fix_inet_pton

Fix p_inet_pton on windows