dig.c revision 00f83773169d9020a3ddcdaf88b198a27f571ff8
75b8de87879ad017c9cd2ffc328e5d2391d16e99Evan Hunt * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC")
75b8de87879ad017c9cd2ffc328e5d2391d16e99Evan Hunt * Copyright (C) 2000-2003 Internet Software Consortium.
75b8de87879ad017c9cd2ffc328e5d2391d16e99Evan Hunt * Permission to use, copy, modify, and/or distribute this software for any
75b8de87879ad017c9cd2ffc328e5d2391d16e99Evan Hunt * purpose with or without fee is hereby granted, provided that the above
75b8de87879ad017c9cd2ffc328e5d2391d16e99Evan Hunt * copyright notice and this permission notice appear in all copies.
75b8de87879ad017c9cd2ffc328e5d2391d16e99Evan Hunt * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
75b8de87879ad017c9cd2ffc328e5d2391d16e99Evan Hunt * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
75b8de87879ad017c9cd2ffc328e5d2391d16e99Evan Hunt * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
75b8de87879ad017c9cd2ffc328e5d2391d16e99Evan Hunt * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
75b8de87879ad017c9cd2ffc328e5d2391d16e99Evan Hunt * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
75b8de87879ad017c9cd2ffc328e5d2391d16e99Evan Hunt * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
c6f4972c745f8903aba6dcca41f17a44c473db66Mark Andrews * PERFORMANCE OF THIS SOFTWARE.
75b8de87879ad017c9cd2ffc328e5d2391d16e99Evan Hunt/* $Id: dig.c,v 1.228 2009/01/22 05:06:33 marka Exp $ */
#define ADD_STRING(b, s) { \
return (ISC_R_NOSPACE); \
isc_buffer_putstr(b, s); \
static char *argv0;
static int addresscount = 0;
static const char * const opcodetext[] = {
static const char * const rcodetext[] = {
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) {
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;
if (!state) {
goto need_value;
goto need_value;
if (!state)
goto invalid_option;
if (state) {
goto invalid_option;
goto invalid_option;
goto invalid_option;
goto need_value;
if (!state)
goto invalid_option;
goto invalid_option;
goto invalid_option;
goto invalid_option;
if (state) {
goto invalid_option;
#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);
if (!config_only) {
if (*need_clone)
ISC_TRUE);
if (*firstarg) {
return (value_from_next);
value);
return (value_from_next);
usage();
usage();
digestbits = 0;
digestbits = 0;
digestbits = 0;
digestbits = 0;
digestbits = 0;
digestbits = 0;
return (value_from_next);
digestbits = 0;
return (value_from_next);
if (*need_clone)
if (*firstarg) {
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++;
for(i = 0; i < bargc; i++)
i, bargv[i]);
(char **)bargv);
lookup);
rc--;
rv++;
rc--;
rv++;
if (open_type_class) {
if (rdtype ==
if (!config_only) {
if (need_clone)
ISC_TRUE);
if (firstarg) {
goto next_line;
bargc++;
for(i = 0; i < bargc; i++)
if (need_clone)
if (firstarg) {
if (!need_clone)
* Callback from dighost.c to allow program-specific shutdown code.
dighost_shutdown(void) {
int bargc;
char *input;
bargc++;
for(i = 0; i < bargc; i++)
start_lookup();
setup_libs();
setup_system();
isc_app_run();
#ifdef DIG_SIGCHASE
cancel_all();
destroy_libs();
return (exitcode);