firedns.h: always make ipv6 members available in state struct
[rofl0r-firedns.git] / examples / fdnsmxlist.c
blobab57017e4aa55583db9855713d881c471f60db36
1 #include <stdio.h>
2 #include <string.h>
3 #include "../include/firedns.h"
5 int main(int argc, char **argv) {
6 firedns_state dns, *d = &dns;
7 struct firedns_mxlist *iter;
9 if (argc != 2) {
10 fprintf(stderr,"usage: %s <hostname>\n",argv[0]);
11 return 2;
14 firedns_init(d);
15 firedns_add_servers_from_resolv_conf(d);
17 iter = firedns_resolvemxlist(d, argv[1]);
19 if (iter == NULL)
20 return 1;
22 while (iter != NULL) {
23 printf("%7s (%05d) %s:%d\n",firedns_mx_name[iter->protocol],iter->priority,iter->name,firedns_mx_port[iter->protocol]);
24 iter = iter->next;
27 return 0;