getaddrinfo / freeaddrinfo
removed typos in comments
removed unused code
added -v option, ouput header