Scenario: command line arguments need to be validated and converted to a socket/TCP addresses. The arguments can be any mix of IPv4 addresses, IPv6 addresses, and host-names.
Currently we're using getaddrinfo. It picks up every error I can think of except one case : a valid IPv4 address followed by some trash.
Example: "127.0.0.1 abc" (argument enclosed in quotes, so C sees a single string.).
Any suggestions on how to get around this? Is there an alternative to getaddrinfo() that detects errors more consistently? Is there some standard validation routine that should be called prior to getaddrinfo?
Or am I stuck cobbling together validations that may be incomplete?