dig.c revision b514e0cd0e7959a98dd59665553c8a3635ada10e
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
07dcadc6e24f4572f2b7d7cae7d47d0f5256d129Andreas Gustafsson * Copyright (C) 2000-2003 Internet Software Consortium.
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence * Permission to use, copy, modify, and distribute this software for any
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence * purpose with or without fee is hereby granted, provided that the above
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence * copyright notice and this permission notice appear in all copies.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews * PERFORMANCE OF THIS SOFTWARE.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/* $Id: dig.c,v 1.201 2005/03/31 02:36:04 marka Exp $ */
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrenceextern ISC_LIST(dig_searchlist_t) search_list;
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence#define ADD_STRING(b, s) { \
4cd765650776027d05fe7fca248478918e02e63bDavid Lawrence if (strlen(s) >= isc_buffer_availablelength(b)) \
extern unsigned int timeout;
extern int sendcount;
extern int ndots;
extern int lookup_counter;
extern int exitcode;
#ifdef DIG_SIGCHASE
static char *argv0;
static int addresscount = 0;
static const char *opcodetext[] = {
static const char *rcodetext[] = {
extern char *progname;
usage(void) {
version(void) {
help(void) {
#ifdef DIG_SIGCHASE
#if DIG_SIGCHASE_TD
stdout);
* 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 (ISC_R_SUCCESS);
static isc_result_t
return (ISC_R_SUCCESS);
return (result);
buf);
return (result);
return (ISC_R_SUCCESS);
#ifdef DIG_SIGCHASE
unsigned int styleflags = 0;
return(ISC_FALSE);
if (nottl)
if (noclass)
if (multiline) {
return(result);
* Callback from dighost.c to print the reply from a server
unsigned int styleflags = 0;
if (nottl)
if (noclass)
if (multiline) {
if (!short_form)
flags = 0;
if (!headers) {
if (headers) {
goto repopulate_buffer;
goto cleanup;
if (!short_form) {
goto buftoosmall;
if (!short_form) {
goto buftoosmall;
goto buftoosmall;
if (!short_form) {
goto buftoosmall;
if (!short_form) {
goto buftoosmall;
if (headers) {
msg,
goto buftoosmall;
msg,
goto buftoosmall;
return (result);
int remaining;
if (printcmd) {
while (i < argc) {
if (first) {
char *ptr;
int end;
end--;
if (end == 0)
end--;
static isc_uint32_t
return (tmp);
#ifdef DIG_SIGCHASE
size_t n;
#define FULLCHECK(A) \
goto invalid_option; \
#define FULLCHECK2(A, B) \
goto invalid_option; \
switch (cmd[0]) {
goto invalid_option;
goto invalid_option;
goto need_value;
if (!state)
goto invalid_option;
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;
if (state) {
goto invalid_option;
goto invalid_option;
goto need_value;
if (!state)
goto invalid_option;
goto invalid_option;
goto invalid_option;
if (state) {
#ifdef DIG_SIGCHASE
goto invalid_option;
if (!is_batchfile)
goto need_value;
if (!state)
goto invalid_option;
if (timeout == 0)
#if DIG_SIGCHASE_TD
if (state) {
goto need_value;
if (!state)
goto invalid_option;
MAXTRIES);
#ifdef DIG_SIGCHASE
goto need_value;
if (!state)
goto invalid_option;
sizeof(trustedkey));
if (n >= sizeof(trustedkey))
goto invalid_option;
goto invalid_option;
if (!is_batchfile)
option);
usage();
static isc_boolean_t
switch (opt) {
if (have_ipv4) {
return (ISC_FALSE);
if (have_ipv6) {
return (ISC_FALSE);
return (ISC_FALSE);
help();
exit(0);
version();
exit(0);
return (ISC_FALSE);
goto invalid_option;
switch (opt) {
srcport = 0;
return (value_from_next);
value);
return (value_from_next);
return (value_from_next);
return (value_from_next);
return (value_from_next);
value);
return (value_from_next);
usage();
usage();
return (value_from_next);
return (value_from_next);
usage();
return (ISC_FALSE);
int rc;
char **rv;
char *option;
int count, i;
for (i = 0; i < count; i++) {
int bargc;
int rc;
char **rv;
#ifndef NOPOSIX
char *homedir;
char *input;
if (!is_batchfile) {
#ifndef NOPOSIX
homedir);
if (n < sizeof(rcfile))
batchfp) != 0) {
bargc++;
(char **)bargv);
lookup);
rc--;
rv++;
rc--;
rv++;
if (open_type_class) {
if (rdtype ==
if (!config_only) {
ISC_TRUE);
goto next_line;
bargc++;
if (firstarg) {
* Callback from dighost.c to allow program-specific shutdown code.
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;
#ifdef DIG_SIGCHASE
cancel_all();
destroy_libs();
return (exitcode);