e576be50 |
1 | /* |
2 | * dtest.c |
3 | * - simple test program, not part of the library |
4 | */ |
5 | /* |
6 | * This file is part of adns, which is Copyright (C) 1997, 1998 Ian Jackson |
7 | * |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation; either version 2, or (at your option) |
11 | * any later version. |
12 | * |
13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. |
17 | * |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program; if not, write to the Free Software Foundation, |
20 | * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 | */ |
964344fc |
22 | |
23 | #include <stdio.h> |
350d37d9 |
24 | #include <unistd.h> |
964344fc |
25 | |
26 | #include "adns.h" |
27 | |
28 | int main(void) { |
29 | adns_state ads; |
350d37d9 |
30 | adns_query qu; |
4353a5c4 |
31 | adns_answer *ans; |
964344fc |
32 | int r; |
33 | |
4353a5c4 |
34 | r= adns_init(&ads,adns_if_debug|adns_if_noautosys,0); |
964344fc |
35 | if (r) { perror("init"); exit(2); } |
350d37d9 |
36 | |
b36c93ff |
37 | r= adns_submit(ads,"anarres.relativity.greenend.org.uk",adns_r_a,0,0,&qu); |
350d37d9 |
38 | if (r) { perror("submit"); exit(2); } |
4353a5c4 |
39 | |
40 | r= adns_wait(ads,&qu,&ans,0); |
41 | if (r) { perror("wait"); exit(2); } |
42 | |
4353a5c4 |
43 | fprintf(stderr,"answer status %d type %d rrs %d cname %s\n", |
44 | ans->status,ans->type,ans->nrrs, |
45 | ans->cname ? ans->cname : "-"); |
350d37d9 |
46 | |
964344fc |
47 | exit(0); |
48 | } |