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.
13 #include <sys/types.h>
14 #include <sys/socket.h>
20 int main(int argc, char** argv) {
21 struct addrinfo hints;
24 if (argc != 2 || 0 == strcmp("-h", argv[1])) {
25 fprintf(stderr, "Usage: %s hostname\n", argv[0]);
29 memset(&hints, 0, sizeof hints);
30 hints.ai_family=AF_UNSPEC;
31 hints.ai_protocol=PF_UNSPEC;
32 hints.ai_socktype=SOCK_STREAM;
33 hints.ai_flags=AI_CANONNAME;
35 int result = getaddrinfo(argv[1], NULL, &hints, &res);
37 fprintf(stderr, "getaddrinfo(\"%s\", ...AI_CANONNAME...) failed: %d (%s)\n", argv[1], result, gai_strerror(result));
42 return (EXIT_SUCCESS);