dig.c revision 1a69a1a78cfaa86f3b68bbc965232b7876d4da2a
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * Copyright (C) 2000 Internet Software Consortium.
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * Permission to use, copy, modify, and distribute this software for any
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * purpose with or without fee is hereby granted, provided that the above
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * copyright notice and this permission notice appear in all copies.
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
8635140fb4734dae6ae5f42e1db9778749ef024aKrzysztof Kosiński * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
8635140fb4734dae6ae5f42e1db9778749ef024aKrzysztof Kosiński * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
36a048753a41b465ae130b361fb3b68c605e3e86kiirala * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
8635140fb4734dae6ae5f42e1db9778749ef024aKrzysztof Kosiński * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
7bda77e763c0af49270427593108b66455dfd125Krzysztof Kosinskiextern ISC_LIST(dig_lookup_t) lookup_list;
36a048753a41b465ae130b361fb3b68c605e3e86kiiralaextern isc_boolean_t tcp_mode, have_ipv6, show_details,
36a048753a41b465ae130b361fb3b68c605e3e86kiiralaextern unsigned int timeout;
36a048753a41b465ae130b361fb3b68c605e3e86kiiralastatic char *opcodetext[] = {
36a048753a41b465ae130b361fb3b68c605e3e86kiirala "RESERVED3",
36a048753a41b465ae130b361fb3b68c605e3e86kiiralastatic char *rcodetext[] = {
36a048753a41b465ae130b361fb3b68c605e3e86kiirala "NXDOMAIN",
36a048753a41b465ae130b361fb3b68c605e3e86kiirala "RESERVED11",
36a048753a41b465ae130b361fb3b68c605e3e86kiirala "RESERVED12",
36a048753a41b465ae130b361fb3b68c605e3e86kiirala "RESERVED13",
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free "RESERVED14",
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free "RESERVED15",
712a383b4aa88de4041f1d6247719e2c3a5800d8Jon A. Cruz"Usage: dig [@server] [domain] [q-type] [q-class] {q-opt} {d-opt}\n"
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński"where: server,\n"
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński" domain are in the Domain Name System\n"
8635140fb4734dae6ae5f42e1db9778749ef024aKrzysztof Kosiński" q-class is one of (in,chaos,...) [default: in]\n"
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński" q-type is one of (a,any,mx,ns,soa,hinfo,axfr,txt,...) [default:a]\n"
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński" q-opt is one of:\n"
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński" -x dot-notation (shortcut for in-addr lookups)\n"
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński" -f filename (batch mode)\n"
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński" -p port (specify port number)\n"
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński" -t type (specify query type)\n"
1cf2607271f83cc4b20ccace552395d793055c90Krzysztof Kosiński" -c class (specify query class)\n"
712a383b4aa88de4041f1d6247719e2c3a5800d8Jon A. Cruz" d-opt is of the form +keyword[=value], where keyword is:\n"
712a383b4aa88de4041f1d6247719e2c3a5800d8Jon A. Cruz" +[no]vc (TCP mode)\n"
dff9bb0d25ad38c515c32e2c76a20e747c8eed10Krzysztof Kosiński" +[no]tcp (TCP mode, alternate syntax)\n"
7059798b454ecd2386eb02769ad8d9c6d9d5f98eKrzysztof Kosiński" +time=### (Set query timeout) [5]\n"
9f6f7e74a1ded383518676e0ecb2ccc5caa73d25tavmjong-free" +tries=### (Set number of UDP attempts) [3]\n"
9f6f7e74a1ded383518676e0ecb2ccc5caa73d25tavmjong-free" +domain=### (Set default domainname)\n"
9f6f7e74a1ded383518676e0ecb2ccc5caa73d25tavmjong-free" +[no]search (Set whether to use searchlist)\n"
9f6f7e74a1ded383518676e0ecb2ccc5caa73d25tavmjong-free" +[no]recursive (Recursive mode)\n"
9f6f7e74a1ded383518676e0ecb2ccc5caa73d25tavmjong-free" +[no]details (Show details of all requests)\n"
36a048753a41b465ae130b361fb3b68c605e3e86kiirala" +twiddle (Intentionally form bad requests)\n"
36a048753a41b465ae130b361fb3b68c605e3e86kiirala" +ndots=### (Set NDOTS value)\n"
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free" +[no]comments (Control display of comment lines)\n"
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free" +[no]question (Control display of question)\n"
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free" +[no]answer (Control display of answer)\n"
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free" +[no]authority (Control display of authority)\n"
7c89b734639fa72a5d2ffdc9cf1f7ab22eff67f1tavmjong-free" +[no]additional (Control display of additional)\n"
9f6f7e74a1ded383518676e0ecb2ccc5caa73d25tavmjong-free" +[no]short (Disable everything except short\n"
9f6f7e74a1ded383518676e0ecb2ccc5caa73d25tavmjong-free" form of answer)\n"
36a048753a41b465ae130b361fb3b68c605e3e86kiirala" Additional d-opts subject to removal before release:\n"
36a048753a41b465ae130b361fb3b68c605e3e86kiirala" +[no]nssearch (Search all authorative nameservers)\n"
36a048753a41b465ae130b361fb3b68c605e3e86kiirala" +[no]identify (ID responders in short answers)\n"
d9a7c806ee7f408ddb61ff4f233c9d96111ee2b5johanengelen" Available but not yet completed:\n"
d9a7c806ee7f408ddb61ff4f233c9d96111ee2b5johanengelen" +[no]trace (Trace delegation down from root)\n"
if (still_working)
if (tcp_mode) {
isc_buffer_usedregion(b, &r);
isc_buffer_free(&b);
static isc_result_t
isc_region_t r;
return (ISC_R_SUCCESS);
return (result);
if (!short_form) {
&target);
return (result);
#ifdef USEINITALWS
if (first) {
rdataset);
if (no_rdata)
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
isc_region_t r;
if (headers)
&target);
return (result);
return (ISC_R_SUCCESS);
if (headers) {
return (result);
return (result);
return (result);
return (result);
return (result);
return (result);
char *ptr;
int end;
end--;
if (end == 0)
end--;
int bargc;
&& (!is_batchfile)) {
&& (!is_batchfile)) {
&& (!is_batchfile)) {
&& (!is_batchfile)) {
if (timeout <= 0)
if (tries <= 0)
if (timeout <= 0)
if (!forcecomment)
if (!forcecomment)
if (!forcecomment)
#ifdef TWIDDLE
if (have_host) {
MXRD);
MXRD);
argv++;
argc--;
if (have_host) {
MXRD);
MXRD);
argv++;
argc--;
argv++;
argc--;
argv++;
argc--;
show_usage();
exit (0);
show_usage();
sizeof(struct dig_lookup));
adrs[i]);
argv++;
argc--;
if (have_host) {
MXRD);
sizeof(struct dig_lookup));
bargc++;
bargc--;