dig.c revision d2792acfafe148fca2f97ff97ef0a8082218e28a
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * Copyright (C) 2000 Internet Software Consortium.
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * Permission to use, copy, modify, and distribute this software for any
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * purpose with or without fee is hereby granted, provided that the above
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * copyright notice and this permission notice appear in all copies.
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
e419f613d8591885df608cb73065921be07dd12eBob Halley/* $Id: dig.c,v 1.109 2000/10/02 16:43:24 mws Exp $ */
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley#define ADD_STRING(b, s) { \
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley if (strlen(s) >= isc_buffer_availablelength(b)) \
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halleyextern unsigned int timeout;
e419f613d8591885df608cb73065921be07dd12eBob Halleyisc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE,
e419f613d8591885df608cb73065921be07dd12eBob Halleystatic const char *opcodetext[] = {
e419f613d8591885df608cb73065921be07dd12eBob Halley "RESERVED3",
e419f613d8591885df608cb73065921be07dd12eBob Halley "RESERVED6",
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley "RESERVED7",
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley "RESERVED8",
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley "RESERVED9",
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley "RESERVED10",
e419f613d8591885df608cb73065921be07dd12eBob Halley "RESERVED11",
e419f613d8591885df608cb73065921be07dd12eBob Halley "RESERVED12",
e419f613d8591885df608cb73065921be07dd12eBob Halley "RESERVED13",
e419f613d8591885df608cb73065921be07dd12eBob Halley "RESERVED14",
e419f613d8591885df608cb73065921be07dd12eBob Halley "RESERVED15"
e419f613d8591885df608cb73065921be07dd12eBob Halleystatic const char *rcodetext[] = {
e419f613d8591885df608cb73065921be07dd12eBob Halley "RESERVED11",
e419f613d8591885df608cb73065921be07dd12eBob Halley "RESERVED12",
e419f613d8591885df608cb73065921be07dd12eBob Halley "RESERVED13",
e419f613d8591885df608cb73065921be07dd12eBob Halley "RESERVED14",
e419f613d8591885df608cb73065921be07dd12eBob Halley "RESERVED15",
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley"Usage: dig [@global-server] [domain] [q-type] [q-class] {q-opt}\n"
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley" {global-d-opt} host [@local-server] {local-d-opt}\n"
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley" [ host [@local-server] {local-d-opt} [...]]\n"
e419f613d8591885df608cb73065921be07dd12eBob Halley"Where: domain are in the Domain Name System\n"
e419f613d8591885df608cb73065921be07dd12eBob Halley" q-class is one of (in,hs,ch,...) [default: in]\n"
e419f613d8591885df608cb73065921be07dd12eBob Halley" q-type is one of (a,any,mx,ns,soa,hinfo,axfr,txt,...) [default:a]\n"
e419f613d8591885df608cb73065921be07dd12eBob Halley" (Use ixfr=version for type ixfr)\n"
e419f613d8591885df608cb73065921be07dd12eBob Halley" q-opt is one of:\n"
e419f613d8591885df608cb73065921be07dd12eBob Halley" -x dot-notation (shortcut for in-addr lookups)\n"
e419f613d8591885df608cb73065921be07dd12eBob Halley" -n (nibble form for reverse IPv6 lookups)\n"
bf43fdafa3bff9e84cb03f1a19aca74514d2516eBob Halley" -f filename (batch mode)\n"
, stderr);
* Callback from dighost.c to print the received message.
if (!validated)
* Callback from dighost.c to print that it is trying a server.
static isc_result_t
return (result);
return (result);
return (ISC_R_SUCCESS);
static isc_result_t
return (ISC_R_SUCCESS);
return (result);
buf);
return (result);
return (ISC_R_SUCCESS);
* Callback from dighost.c to print the reply from a server
flags = 0;
if (!headers) {
if (headers) {
if (!short_form) {
goto question_again;
if (!short_form) {
goto answer_again;
if (!short_form) {
goto authority_again;
if (!short_form) {
goto additional_again;
if (headers) {
msg,
msg,
return (result);
if (printcmd) {
while (i < argc) {
if (first) {
char *ptr;
int end;
end--;
if (end == 0)
end--;
goto invalid_option;
goto invalid_option;
goto need_value;
if (!state)
goto invalid_option;
goto invalid_option;
goto need_value;
if (!state)
goto invalid_option;
goto invalid_option;
goto need_value;
if (!state)
goto invalid_option;
goto need_value;
if (!state)
goto invalid_option;
if (ndots < 0)
ndots = 0;
if (state) {
goto invalid_option;
goto invalid_option;
goto need_value;
if (!state)
goto invalid_option;
goto invalid_option;
if (state) {
goto invalid_option;
if (!is_batchfile)
goto need_value;
if (!state)
goto invalid_option;
if (timeout <= 0)
if (state) {
goto need_value;
if (!state)
goto invalid_option;
goto invalid_option;
goto invalid_option;
if (!is_batchfile)
option);
show_usage();
static isc_boolean_t
return (ISC_FALSE);
show_usage();
exit(0);
return (ISC_FALSE);
return (ISC_FALSE);
return (ISC_FALSE);
goto invalid_option;
return (value_from_next);
value);
return (value_from_next);
return (value_from_next);
return (value_from_next);
return (value_from_next);
return (value_from_next);
value);
return (value_from_next);
show_usage();
show_usage();
return (value_from_next);
show_usage();
adrs[i]);
MXNAME);
MXNAME);
isc_buffer_t b;
show_usage();
name);
show_usage();
isc_buffer_putuint8(&b, 0);
show_usage();
return (value_from_next);
show_usage();
return (ISC_FALSE);
int bargc;
int rc;
char **rv;
#ifndef NOPOSIX
char *homedir;
char *input;
if (!is_batchfile) {
#ifndef NOPOSIX
batchfp) != 0) {
bargc++;
(char **)bargv);
lookup);
rc--;
rv++;
rc--;
rv++;
if (open_type_class) {
if (!config_only) {
ISC_TRUE);
if (firstarg) {
goto next_line;
bargc++;
* Callback from dighost.c to allow program-specific shutdown code. Here,
dighost_shutdown(void) {
int bargc;
char *input;
bargc++;
start_lookup();
setup_libs();
setup_system();
isc_app_run();
while (s != NULL) {
s, default_lookup);
s2 = s;
if (isc_mem_debugging != 0)
cancel_all();
destroy_libs();
return (exitcode);