3 * - useful general-purpose resolver client program
4 * make queries and print answers
8 * Copyright (C) 1997-1999 Ian Jackson <ian@davenant.greenend.org.uk>
10 * It is part of adns, which is
11 * Copyright (C) 1997-1999 Ian Jackson <ian@davenant.greenend.org.uk>
12 * Copyright (C) 1999 Tony Finch <dot@dotat.at>
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2, or (at your option)
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software Foundation,
26 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
34 struct query_node
*next
, *back
;
35 struct perqueryflags_remember pqfr
;
40 static struct { struct query_node
*head
, *tail
; } outstanding
;
42 static unsigned long idcounter
;
44 void domain_do(const char *domain
) {
45 struct query_node
*qun
;
50 if (signal(SIGPIPE
,SIG_IGN
) == SIG_ERR
) sysfail("ignore SIGPIPE",errno
);
52 adns_if_noautosys
|adns_if_nosigpipe
|
53 (ov_env ?
0 : adns_if_noenv
) |
56 if (r
) sysfail("adns_init",r
);
59 qun
= malloc(sizeof(*qun
));
62 qun
->id
= xstrsave(ov_id
);
64 sprintf(idbuf
,"%lu",idcounter
++);
65 idcounter
&= 0x0fffffffflu
;
66 qun
->id
= xstrsave(idbuf
);
69 r
= adns_submit(ads
, domain
,
70 ov_type
== adns_r_none ? adns_r_addr
: ov_type
,
71 (ov_search ? adns_qf_search
: 0) |
72 (ov_tcp ? adns_qf_usevc
: 0) |
73 (ov_pqfr
.show_owner ? adns_qf_owner
: 0) |
74 (ov_qc_query ? adns_qf_quoteok_query
: 0) |
75 (ov_qc_anshost ? adns_qf_quoteok_anshost
: 0) |
76 (ov_qc_cname ?
0 : adns_qf_quoteok_cname
) |
80 if (r
) sysfail("adns_submit",r
);
82 LIST_LINK_TAIL(outstanding
,qun
);
85 void of_asynch_id(const struct optioninfo
*oi
, const char *arg
) { abort(); }
86 void of_cancel_id(const struct optioninfo
*oi
, const char *arg
) { abort(); }