3 * Author: Matthias Andree
5 * Created on 3. Februar 2013, 15:03
6 * A short file to call getaddrinfo with the same arguments as checkalias.
18 int main(int argc, char** argv) {
19 struct addrinfo hints;
22 if (argc != 2 || 0 == strcmp("-h", argv[1])) {
23 fprintf(stderr, "Usage: %s hostname\n", argv[0]);
27 memset(&hints, 0, sizeof hints);
28 hints.ai_family=AF_UNSPEC;
29 hints.ai_protocol=PF_UNSPEC;
30 hints.ai_socktype=SOCK_STREAM;
31 hints.ai_flags=AI_CANONNAME;
33 int result = getaddrinfo(argv[1], NULL, &hints, &res);
35 fprintf(stderr, "getaddrinfo(\"%s\", ...AI_CANONNAME...) failed: %d (%s)\n", argv[1], result, gai_strerror(result));
40 return (EXIT_SUCCESS);