=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/dig/dig.c,v retrieving revision 1.15 retrieving revision 1.16 diff -c -r1.15 -r1.16 *** src/usr.bin/dig/dig.c 2020/09/14 08:39:12 1.15 --- src/usr.bin/dig/dig.c 2020/09/14 08:40:43 1.16 *************** *** 14,20 **** * PERFORMANCE OF THIS SOFTWARE. */ ! /* $Id: dig.c,v 1.15 2020/09/14 08:39:12 florian Exp $ */ /*! \file */ #include --- 14,20 ---- * PERFORMANCE OF THIS SOFTWARE. */ ! /* $Id: dig.c,v 1.16 2020/09/14 08:40:43 florian Exp $ */ /*! \file */ #include *************** *** 59,69 **** static char domainopt[DNS_NAME_MAXTEXT]; static char sitvalue[256]; ! static isc_boolean_t short_form = ISC_FALSE, printcmd = ISC_TRUE, ! ip6_int = ISC_FALSE, plusquest = ISC_FALSE, pluscomm = ISC_FALSE, ! multiline = ISC_FALSE, nottl = ISC_FALSE, noclass = ISC_FALSE, ! onesoa = ISC_FALSE, use_usec = ISC_FALSE, nocrypto = ISC_FALSE, ! ipv4only = ISC_FALSE, ipv6only = ISC_FALSE; static uint32_t splitwidth = 0xffffffff; /*% rrcomments are neither explicitly enabled nor disabled by default */ --- 59,69 ---- static char domainopt[DNS_NAME_MAXTEXT]; static char sitvalue[256]; ! static int short_form = 0, printcmd = 1, ! ip6_int = 0, plusquest = 0, pluscomm = 0, ! multiline = 0, nottl = 0, noclass = 0, ! onesoa = 0, use_usec = 0, nocrypto = 0, ! ipv4only = 0, ipv6only = 0; static uint32_t splitwidth = 0xffffffff; /*% rrcomments are neither explicitly enabled nor disabled by default */ *************** *** 334,340 **** return (ISC_R_SUCCESS); } ! static isc_boolean_t isdotlocal(dns_message_t *msg) { isc_result_t result; static unsigned char local_ndata[] = { "\005local\0" }; --- 334,340 ---- return (ISC_R_SUCCESS); } ! static int isdotlocal(dns_message_t *msg) { isc_result_t result; static unsigned char local_ndata[] = { "\005local\0" }; *************** *** 349,364 **** dns_name_t *name = NULL; dns_message_currentname(msg, DNS_SECTION_QUESTION, &name); if (dns_name_issubdomain(name, &local)) ! return (ISC_TRUE); } ! return (ISC_FALSE); } /* * Callback from dighost.c to print the reply from a server */ static isc_result_t ! printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { isc_result_t result; dns_messagetextflag_t flags; isc_buffer_t *buf = NULL; --- 349,364 ---- dns_name_t *name = NULL; dns_message_currentname(msg, DNS_SECTION_QUESTION, &name); if (dns_name_issubdomain(name, &local)) ! return (1); } ! return (0); } /* * Callback from dighost.c to print the reply from a server */ static isc_result_t ! printmessage(dig_query_t *query, dns_message_t *msg, int headers) { isc_result_t result; dns_messagetextflag_t flags; isc_buffer_t *buf = NULL; *************** *** 596,602 **** static void printgreeting(int argc, char **argv, dig_lookup_t *lookup) { int i; ! static isc_boolean_t first = ISC_TRUE; char append[MXNAME]; if (printcmd) { --- 596,602 ---- static void printgreeting(int argc, char **argv, dig_lookup_t *lookup) { int i; ! static int first = 1; char append[MXNAME]; if (printcmd) { *************** *** 623,629 **** ";; global options:%s%s\n", short_form ? " +short" : "", printcmd ? " +cmd" : ""); ! first = ISC_FALSE; strlcat(lookup->cmdline, append, sizeof(lookup->cmdline)); } --- 623,629 ---- ";; global options:%s%s\n", short_form ? " +short" : "", printcmd ? " +cmd" : ""); ! first = 0; strlcat(lookup->cmdline, append, sizeof(lookup->cmdline)); } *************** *** 631,637 **** } static void ! plus_option(const char *option, isc_boolean_t is_batchfile, dig_lookup_t *lookup) { isc_result_t result; --- 631,637 ---- } static void ! plus_option(const char *option, int is_batchfile, dig_lookup_t *lookup) { isc_result_t result; *************** *** 640,646 **** const char *errstr; long lval; uint32_t num; ! isc_boolean_t state = ISC_TRUE; size_t n; strlcpy(option_store, option, sizeof(option_store)); --- 640,646 ---- const char *errstr; long lval; uint32_t num; ! int state = 1; size_t n; strlcpy(option_store, option, sizeof(option_store)); *************** *** 653,659 **** value = ptr; if (strncasecmp(cmd, "no", 2)==0) { cmd += 2; ! state = ISC_FALSE; } #define FULLCHECK(A) \ --- 653,659 ---- value = ptr; if (strncasecmp(cmd, "no", 2)==0) { cmd += 2; ! state = 0; } #define FULLCHECK(A) \ *************** *** 751,757 **** case 'l': /* class */ /* keep +cl for backwards compatibility */ FULLCHECK2("cl", "class"); ! noclass = ISC_TF(!state); break; case 'm': /* cmd */ FULLCHECK("cmd"); --- 751,757 ---- case 'l': /* class */ /* keep +cl for backwards compatibility */ FULLCHECK2("cl", "class"); ! noclass = !state; break; case 'm': /* cmd */ FULLCHECK("cmd"); *************** *** 774,780 **** break; case 'r': FULLCHECK("crypto"); ! nocrypto = ISC_TF(!state); break; default: goto invalid_option; --- 774,780 ---- break; case 'r': FULLCHECK("crypto"); ! nocrypto = !state; break; default: goto invalid_option; *************** *** 949,965 **** FULLCHECK("nssearch"); lookup->ns_search_only = state; if (state) { ! lookup->trace_root = ISC_TRUE; ! lookup->recurse = ISC_TRUE; ! lookup->identify = ISC_TRUE; ! lookup->stats = ISC_FALSE; ! lookup->comments = ISC_FALSE; ! lookup->section_additional = ISC_FALSE; ! lookup->section_authority = ISC_FALSE; ! lookup->section_question = ISC_FALSE; lookup->rdtype = dns_rdatatype_ns; ! lookup->rdtypeset = ISC_TRUE; ! short_form = ISC_TRUE; rrcomments = 0; } break; --- 949,965 ---- FULLCHECK("nssearch"); lookup->ns_search_only = state; if (state) { ! lookup->trace_root = 1; ! lookup->recurse = 1; ! lookup->identify = 1; ! lookup->stats = 0; ! lookup->comments = 0; ! lookup->section_additional = 0; ! lookup->section_authority = 0; ! lookup->section_question = 0; lookup->rdtype = dns_rdatatype_ns; ! lookup->rdtypeset = 1; ! short_form = 1; rrcomments = 0; } break; *************** *** 1073,1085 **** FULLCHECK("short"); short_form = state; if (state) { ! printcmd = ISC_FALSE; ! lookup->section_additional = ISC_FALSE; ! lookup->section_answer = ISC_TRUE; ! lookup->section_authority = ISC_FALSE; ! lookup->section_question = ISC_FALSE; ! lookup->comments = ISC_FALSE; ! lookup->stats = ISC_FALSE; rrcomments = -1; } break; --- 1073,1085 ---- FULLCHECK("short"); short_form = state; if (state) { ! printcmd = 0; ! lookup->section_additional = 0; ! lookup->section_answer = 1; ! lookup->section_authority = 0; ! lookup->section_question = 0; ! lookup->comments = 0; ! lookup->stats = 0; rrcomments = -1; } break; *************** *** 1179,1185 **** FULLCHECK("tcp"); if (!is_batchfile) { lookup->tcp_mode = state; ! lookup->tcp_mode_set = ISC_TRUE; } break; case 'i': /* timeout */ --- 1179,1185 ---- FULLCHECK("tcp"); if (!is_batchfile) { lookup->tcp_mode = state; ! lookup->tcp_mode_set = 1; } break; case 'i': /* timeout */ *************** *** 1201,1216 **** lookup->trace = state; lookup->trace_root = state; if (state) { ! lookup->recurse = ISC_FALSE; ! lookup->identify = ISC_TRUE; ! lookup->comments = ISC_FALSE; rrcomments = 0; ! lookup->stats = ISC_FALSE; ! lookup->section_additional = ISC_FALSE; ! lookup->section_authority = ISC_TRUE; ! lookup->section_question = ISC_FALSE; ! lookup->dnssec = ISC_TRUE; ! usesearch = ISC_FALSE; } break; case 'i': /* tries */ --- 1201,1216 ---- lookup->trace = state; lookup->trace_root = state; if (state) { ! lookup->recurse = 0; ! lookup->identify = 1; ! lookup->comments = 0; rrcomments = 0; ! lookup->stats = 0; ! lookup->section_additional = 0; ! lookup->section_authority = 1; ! lookup->section_question = 0; ! lookup->dnssec = 1; ! usesearch = 0; } break; case 'i': /* tries */ *************** *** 1233,1239 **** break; case 't': /* ttlid */ FULLCHECK("ttlid"); ! nottl = ISC_TF(!state); break; default: goto invalid_option; --- 1233,1239 ---- break; case 't': /* ttlid */ FULLCHECK("ttlid"); ! nottl = !state; break; default: goto invalid_option; *************** *** 1243,1249 **** FULLCHECK("vc"); if (!is_batchfile) { lookup->tcp_mode = state; ! lookup->tcp_mode_set = ISC_TRUE; } break; default: --- 1243,1249 ---- FULLCHECK("vc"); if (!is_batchfile) { lookup->tcp_mode = state; ! lookup->tcp_mode_set = 1; } break; default: *************** *** 1257,1275 **** } /*% ! * #ISC_TRUE returned if value was used */ static const char *single_dash_opts = "46dhinuv"; static const char *dash_opts = "46bcdfhikmnptvyx"; ! static isc_boolean_t dash_option(char *option, char *next, dig_lookup_t **lookup, ! isc_boolean_t *open_type_class, isc_boolean_t *need_clone, ! isc_boolean_t config_only, int argc, char **argv, ! isc_boolean_t *firstarg) { char opt, *value, *ptr, *ptr2, *ptr3; isc_result_t result; ! isc_boolean_t value_from_next; isc_textregion_t tr; dns_rdatatype_t rdtype; dns_rdataclass_t rdclass; --- 1257,1275 ---- } /*% ! * #1 returned if value was used */ static const char *single_dash_opts = "46dhinuv"; static const char *dash_opts = "46bcdfhikmnptvyx"; ! static int dash_option(char *option, char *next, dig_lookup_t **lookup, ! int *open_type_class, int *need_clone, ! int config_only, int argc, char **argv, ! int *firstarg) { char opt, *value, *ptr, *ptr2, *ptr3; isc_result_t result; ! int value_from_next; isc_textregion_t tr; dns_rdatatype_t rdtype; dns_rdataclass_t rdclass; *************** *** 1291,1303 **** switch (opt) { case '4': if (have_ipv4) ! have_ipv6 = ISC_FALSE; else fatal("can't find IPv4 networking"); break; case '6': if (have_ipv6) ! have_ipv4 = ISC_FALSE; else fatal("can't find IPv6 networking"); break; --- 1291,1303 ---- switch (opt) { case '4': if (have_ipv4) ! have_ipv6 = 0; else fatal("can't find IPv4 networking"); break; case '6': if (have_ipv6) ! have_ipv4 = 0; else fatal("can't find IPv6 networking"); break; *************** *** 1306,1328 **** if (ptr != &option[1]) { cmd = option; FULLCHECK("debug"); ! debugging = ISC_TRUE; ! return (ISC_FALSE); } else ! debugging = ISC_TRUE; break; case 'h': help(); exit(0); break; case 'i': ! ip6_int = ISC_TRUE; break; case 'n': /* deprecated */ break; case 'u': ! use_usec = ISC_TRUE; break; case 'v': version(); --- 1306,1328 ---- if (ptr != &option[1]) { cmd = option; FULLCHECK("debug"); ! debugging = 1; ! return (0); } else ! debugging = 1; break; case 'h': help(); exit(0); break; case 'i': ! ip6_int = 1; break; case 'n': /* deprecated */ break; case 'u': ! use_usec = 1; break; case 'v': version(); *************** *** 1332,1345 **** if (strlen(option) > 1U) option = &option[1]; else ! return (ISC_FALSE); } opt = option[0]; if (strlen(option) > 1U) { ! value_from_next = ISC_FALSE; value = &option[1]; } else { ! value_from_next = ISC_TRUE; value = next; } if (value == NULL) --- 1332,1345 ---- if (strlen(option) > 1U) option = &option[1]; else ! return (0); } opt = option[0]; if (strlen(option) > 1U) { ! value_from_next = 0; value = &option[1]; } else { ! value_from_next = 1; value = next; } if (value == NULL) *************** *** 1365,1384 **** if (hash != NULL) *hash = '#'; ! specified_source = ISC_TRUE; return (value_from_next); case 'c': if ((*lookup)->rdclassset) { fprintf(stderr, ";; Warning, extra class option\n"); } ! *open_type_class = ISC_FALSE; tr.base = value; tr.length = (unsigned int) strlen(value); result = dns_rdataclass_fromtext(&rdclass, (isc_textregion_t *)&tr); if (result == ISC_R_SUCCESS) { (*lookup)->rdclass = rdclass; ! (*lookup)->rdclassset = ISC_TRUE; } else fprintf(stderr, ";; Warning, ignoring " "invalid class %s\n", --- 1365,1384 ---- if (hash != NULL) *hash = '#'; ! specified_source = 1; return (value_from_next); case 'c': if ((*lookup)->rdclassset) { fprintf(stderr, ";; Warning, extra class option\n"); } ! *open_type_class = 0; tr.base = value; tr.length = (unsigned int) strlen(value); result = dns_rdataclass_fromtext(&rdclass, (isc_textregion_t *)&tr); if (result == ISC_R_SUCCESS) { (*lookup)->rdclass = rdclass; ! (*lookup)->rdclassset = 1; } else fprintf(stderr, ";; Warning, ignoring " "invalid class %s\n", *************** *** 1400,1422 **** if (!config_only) { if (*need_clone) (*lookup) = clone_lookup(default_lookup, ! ISC_TRUE); ! *need_clone = ISC_TRUE; strlcpy((*lookup)->textname, value, sizeof((*lookup)->textname)); ! (*lookup)->trace_root = ISC_TF((*lookup)->trace || ! (*lookup)->ns_search_only); ! (*lookup)->new_search = ISC_TRUE; if (*firstarg) { printgreeting(argc, argv, *lookup); ! *firstarg = ISC_FALSE; } ISC_LIST_APPEND(lookup_list, (*lookup), link); debug("looking up %s", (*lookup)->textname); } return (value_from_next); case 't': ! *open_type_class = ISC_FALSE; if (strncasecmp(value, "ixfr=", 5) == 0) { rdtype = dns_rdatatype_ixfr; result = ISC_R_SUCCESS; --- 1400,1422 ---- if (!config_only) { if (*need_clone) (*lookup) = clone_lookup(default_lookup, ! 1); ! *need_clone = 1; strlcpy((*lookup)->textname, value, sizeof((*lookup)->textname)); ! (*lookup)->trace_root = (*lookup)->trace || ! (*lookup)->ns_search_only; ! (*lookup)->new_search = 1; if (*firstarg) { printgreeting(argc, argv, *lookup); ! *firstarg = 0; } ISC_LIST_APPEND(lookup_list, (*lookup), link); debug("looking up %s", (*lookup)->textname); } return (value_from_next); case 't': ! *open_type_class = 0; if (strncasecmp(value, "ixfr=", 5) == 0) { rdtype = dns_rdatatype_ixfr; result = ISC_R_SUCCESS; *************** *** 1438,1444 **** if (rdtype == dns_rdatatype_ixfr) { uint32_t serial; (*lookup)->rdtype = dns_rdatatype_ixfr; ! (*lookup)->rdtypeset = ISC_TRUE; serial = strtonum(&value[5], 0, MAXSERIAL, &errstr); if (errstr != NULL) --- 1438,1444 ---- if (rdtype == dns_rdatatype_ixfr) { uint32_t serial; (*lookup)->rdtype = dns_rdatatype_ixfr; ! (*lookup)->rdtypeset = 1; serial = strtonum(&value[5], 0, MAXSERIAL, &errstr); if (errstr != NULL) *************** *** 1448,1463 **** (*lookup)->section_question = plusquest; (*lookup)->comments = pluscomm; if (!(*lookup)->tcp_mode_set) ! (*lookup)->tcp_mode = ISC_TRUE; } else { (*lookup)->rdtype = rdtype; if (!config_only) ! (*lookup)->rdtypeset = ISC_TRUE; if (rdtype == dns_rdatatype_axfr) { (*lookup)->section_question = plusquest; (*lookup)->comments = pluscomm; } ! (*lookup)->ixfr_serial = ISC_FALSE; } } else fprintf(stderr, ";; Warning, ignoring " --- 1448,1463 ---- (*lookup)->section_question = plusquest; (*lookup)->comments = pluscomm; if (!(*lookup)->tcp_mode_set) ! (*lookup)->tcp_mode = 1; } else { (*lookup)->rdtype = rdtype; if (!config_only) ! (*lookup)->rdtypeset = 1; if (rdtype == dns_rdatatype_axfr) { (*lookup)->section_question = plusquest; (*lookup)->comments = pluscomm; } ! (*lookup)->ixfr_serial = 0; } } else fprintf(stderr, ";; Warning, ignoring " *************** *** 1486,1509 **** return (value_from_next); case 'x': if (*need_clone) ! *lookup = clone_lookup(default_lookup, ISC_TRUE); ! *need_clone = ISC_TRUE; if (get_reverse(textname, sizeof(textname), value, ! ip6_int, ISC_FALSE) == ISC_R_SUCCESS) { strlcpy((*lookup)->textname, textname, sizeof((*lookup)->textname)); debug("looking up %s", (*lookup)->textname); ! (*lookup)->trace_root = ISC_TF((*lookup)->trace || ! (*lookup)->ns_search_only); (*lookup)->ip6_int = ip6_int; if (!(*lookup)->rdtypeset) (*lookup)->rdtype = dns_rdatatype_ptr; if (!(*lookup)->rdclassset) (*lookup)->rdclass = dns_rdataclass_in; ! (*lookup)->new_search = ISC_TRUE; if (*firstarg) { printgreeting(argc, argv, *lookup); ! *firstarg = ISC_FALSE; } ISC_LIST_APPEND(lookup_list, *lookup, link); } else { --- 1486,1509 ---- return (value_from_next); case 'x': if (*need_clone) ! *lookup = clone_lookup(default_lookup, 1); ! *need_clone = 1; if (get_reverse(textname, sizeof(textname), value, ! ip6_int, 0) == ISC_R_SUCCESS) { strlcpy((*lookup)->textname, textname, sizeof((*lookup)->textname)); debug("looking up %s", (*lookup)->textname); ! (*lookup)->trace_root = (*lookup)->trace || ! (*lookup)->ns_search_only; (*lookup)->ip6_int = ip6_int; if (!(*lookup)->rdtypeset) (*lookup)->rdtype = dns_rdatatype_ptr; if (!(*lookup)->rdclassset) (*lookup)->rdclass = dns_rdataclass_in; ! (*lookup)->new_search = 1; if (*firstarg) { printgreeting(argc, argv, *lookup); ! *firstarg = 0; } ISC_LIST_APPEND(lookup_list, *lookup, link); } else { *************** *** 1517,1523 **** usage(); } /* NOTREACHED */ ! return (ISC_FALSE); } /*% --- 1517,1523 ---- usage(); } /* NOTREACHED */ ! return (0); } /*% *************** *** 1546,1557 **** case '4': if (ipv6only) fatal("only one of -4 and -6 allowed"); ! ipv4only = ISC_TRUE; break; case '6': if (ipv4only) fatal("only one of -4 and -6 allowed"); ! ipv6only = ISC_TRUE; break; } option = &option[1]; --- 1546,1557 ---- case '4': if (ipv6only) fatal("only one of -4 and -6 allowed"); ! ipv4only = 1; break; case '6': if (ipv4only) fatal("only one of -4 and -6 allowed"); ! ipv6only = 1; break; } option = &option[1]; *************** *** 1560,1575 **** } static void ! parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only, int argc, char **argv) { isc_result_t result; isc_textregion_t tr; ! isc_boolean_t firstarg = ISC_TRUE; dig_lookup_t *lookup = NULL; dns_rdatatype_t rdtype; dns_rdataclass_t rdclass; ! isc_boolean_t open_type_class = ISC_TRUE; char batchline[MXNAME]; int bargc; char *bargv[64]; --- 1560,1575 ---- } static void ! parse_args(int is_batchfile, int config_only, int argc, char **argv) { isc_result_t result; isc_textregion_t tr; ! int firstarg = 1; dig_lookup_t *lookup = NULL; dns_rdatatype_t rdtype; dns_rdataclass_t rdclass; ! int open_type_class = 1; char batchline[MXNAME]; int bargc; char *bargv[64]; *************** *** 1577,1583 **** char **rv; char *input; int i; ! isc_boolean_t need_clone = ISC_TRUE; const char *errstr; /* --- 1577,1583 ---- char **rv; char *input; int i; ! int need_clone = 1; const char *errstr; /* *************** *** 1595,1608 **** if (!is_batchfile) { debug("making new lookup"); default_lookup = make_empty_lookup(); ! default_lookup->adflag = ISC_TRUE; default_lookup->edns = 0; } if (is_batchfile && !config_only) { /* Processing '-f batchfile'. */ ! lookup = clone_lookup(default_lookup, ISC_TRUE); ! need_clone = ISC_FALSE; } else lookup = default_lookup; --- 1595,1608 ---- if (!is_batchfile) { debug("making new lookup"); default_lookup = make_empty_lookup(); ! default_lookup->adflag = 1; default_lookup->edns = 0; } if (is_batchfile && !config_only) { /* Processing '-f batchfile'. */ ! lookup = clone_lookup(default_lookup, 1); ! need_clone = 0; } else lookup = default_lookup; *************** *** 1683,1689 **** uint32_t serial; lookup->rdtype = dns_rdatatype_ixfr; ! lookup->rdtypeset = ISC_TRUE; serial = strtonum(&rv[0][5], 0, MAXSERIAL, &errstr); if (errstr != NULL) --- 1683,1689 ---- uint32_t serial; lookup->rdtype = dns_rdatatype_ixfr; ! lookup->rdtypeset = 1; serial = strtonum(&rv[0][5], 0, MAXSERIAL, &errstr); if (errstr != NULL) *************** *** 1695,1711 **** plusquest; lookup->comments = pluscomm; if (!lookup->tcp_mode_set) ! lookup->tcp_mode = ISC_TRUE; } else { lookup->rdtype = rdtype; ! lookup->rdtypeset = ISC_TRUE; if (rdtype == dns_rdatatype_axfr) { lookup->section_question = plusquest; lookup->comments = pluscomm; } ! lookup->ixfr_serial = ISC_FALSE; } continue; } --- 1695,1711 ---- plusquest; lookup->comments = pluscomm; if (!lookup->tcp_mode_set) ! lookup->tcp_mode = 1; } else { lookup->rdtype = rdtype; ! lookup->rdtypeset = 1; if (rdtype == dns_rdatatype_axfr) { lookup->section_question = plusquest; lookup->comments = pluscomm; } ! lookup->ixfr_serial = 0; } continue; } *************** *** 1717,1723 **** "extra class option\n"); } lookup->rdclass = rdclass; ! lookup->rdclassset = ISC_TRUE; continue; } } --- 1717,1723 ---- "extra class option\n"); } lookup->rdclass = rdclass; ! lookup->rdclassset = 1; continue; } } *************** *** 1725,1740 **** if (!config_only) { if (need_clone) lookup = clone_lookup(default_lookup, ! ISC_TRUE); ! need_clone = ISC_TRUE; strlcpy(lookup->textname, rv[0], sizeof(lookup->textname)); ! lookup->trace_root = ISC_TF(lookup->trace || ! lookup->ns_search_only); ! lookup->new_search = ISC_TRUE; if (firstarg) { printgreeting(argc, argv, lookup); ! firstarg = ISC_FALSE; } ISC_LIST_APPEND(lookup_list, lookup, link); debug("looking up %s", lookup->textname); --- 1725,1740 ---- if (!config_only) { if (need_clone) lookup = clone_lookup(default_lookup, ! 1); ! need_clone = 1; strlcpy(lookup->textname, rv[0], sizeof(lookup->textname)); ! lookup->trace_root = lookup->trace || ! lookup->ns_search_only; ! lookup->new_search = 1; if (firstarg) { printgreeting(argc, argv, lookup); ! firstarg = 0; } ISC_LIST_APPEND(lookup_list, lookup, link); debug("looking up %s", lookup->textname); *************** *** 1779,1785 **** for(i = 0; i < bargc; i++) debug("batch argv %d: %s", i, bargv[i]); ! parse_args(ISC_TRUE, ISC_FALSE, bargc, (char **)bargv); return; } return; --- 1779,1785 ---- for(i = 0; i < bargc; i++) debug("batch argv %d: %s", i, bargv[i]); ! parse_args(1, 0, bargc, (char **)bargv); return; } return; *************** *** 1789,1805 **** */ if ((lookup_list.head == NULL) && !config_only) { if (need_clone) ! lookup = clone_lookup(default_lookup, ISC_TRUE); ! need_clone = ISC_TRUE; ! lookup->trace_root = ISC_TF(lookup->trace || ! lookup->ns_search_only); ! lookup->new_search = ISC_TRUE; strlcpy(lookup->textname, ".", sizeof(lookup->textname)); lookup->rdtype = dns_rdatatype_ns; ! lookup->rdtypeset = ISC_TRUE; if (firstarg) { printgreeting(argc, argv, lookup); ! firstarg = ISC_FALSE; } ISC_LIST_APPEND(lookup_list, lookup, link); } --- 1789,1804 ---- */ if ((lookup_list.head == NULL) && !config_only) { if (need_clone) ! lookup = clone_lookup(default_lookup, 1); ! need_clone = 1; ! lookup->trace_root = lookup->trace || lookup->ns_search_only; ! lookup->new_search = 1; strlcpy(lookup->textname, ".", sizeof(lookup->textname)); lookup->rdtype = dns_rdatatype_ns; ! lookup->rdtypeset = 1; if (firstarg) { printgreeting(argc, argv, lookup); ! firstarg = 0; } ISC_LIST_APPEND(lookup_list, lookup, link); } *************** *** 1848,1854 **** for(i = 0; i < bargc; i++) debug("batch argv %d: %s", i, bargv[i]); ! parse_args(ISC_TRUE, ISC_FALSE, bargc, (char **)bargv); start_lookup(); } else { batchname = NULL; --- 1847,1853 ---- for(i = 0; i < bargc; i++) debug("batch argv %d: %s", i, bargv[i]); ! parse_args(1, 0, bargc, (char **)bargv); start_lookup(); } else { batchname = NULL; *************** *** 1891,1897 **** setup_system(ipv4only, ipv6only); } ! void dig_query_setup(isc_boolean_t is_batchfile, isc_boolean_t config_only, int argc, char **argv) { debug("dig_query_setup"); --- 1890,1896 ---- setup_system(ipv4only, ipv6only); } ! void dig_query_setup(int is_batchfile, int config_only, int argc, char **argv) { debug("dig_query_setup"); *************** *** 1909,1915 **** if (domainopt[0] != '\0') { set_search_domain(domainopt); ! usesearch = ISC_TRUE; } } --- 1908,1914 ---- if (domainopt[0] != '\0') { set_search_domain(domainopt); ! usesearch = 1; } } *************** *** 1947,1953 **** return nslookup_main(argc, argv); dig_setup(argc, argv); ! dig_query_setup(ISC_FALSE, ISC_FALSE, argc, argv); dig_startup(); dig_shutdown(); --- 1946,1952 ---- return nslookup_main(argc, argv); dig_setup(argc, argv); ! dig_query_setup(0, 0, argc, argv); dig_startup(); dig_shutdown();