=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/dig/host.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- src/usr.bin/dig/host.c 2020/09/14 08:37:09 1.15 +++ src/usr.bin/dig/host.c 2020/09/14 08:40:43 1.16 @@ -39,13 +39,13 @@ #include "dig.h" -static isc_boolean_t short_form = ISC_TRUE, listed_server = ISC_FALSE; -static isc_boolean_t default_lookups = ISC_TRUE; +static int short_form = 1, listed_server = 0; +static int default_lookups = 1; static int seen_error = -1; -static isc_boolean_t list_addresses = ISC_TRUE; +static int list_addresses = 1; static dns_rdatatype_t list_type = dns_rdatatype_a; -static isc_boolean_t printed_server = ISC_FALSE; -static isc_boolean_t ipv4only = ISC_FALSE, ipv6only = ISC_FALSE; +static int printed_server = 0; +static int ipv4only = 0, ipv6only = 0; static const char *opcodetext[] = { "QUERY", @@ -199,7 +199,7 @@ } static isc_result_t printsection(dns_message_t *msg, dns_section_t sectionid, - const char *section_name, isc_boolean_t headers, + const char *section_name, int headers, dig_query_t *query) { dns_name_t *name, *print_name; @@ -210,13 +210,13 @@ isc_region_t r; dns_name_t empty_name; char tbuf[4096]; - isc_boolean_t first; - isc_boolean_t no_rdata; + int first; + int no_rdata; if (sectionid == DNS_SECTION_QUESTION) - no_rdata = ISC_TRUE; + no_rdata = 1; else - no_rdata = ISC_FALSE; + no_rdata = 0; if (headers) printf(";; %s SECTION:\n", section_name); @@ -234,7 +234,7 @@ dns_message_currentname(msg, sectionid, &name); isc_buffer_init(&target, tbuf, sizeof(tbuf)); - first = ISC_TRUE; + first = 1; print_name = name; for (rdataset = ISC_LIST_HEAD(name->list); @@ -253,7 +253,7 @@ if (!short_form) { result = dns_rdataset_totext(rdataset, print_name, - ISC_FALSE, + 0, no_rdata, &target); if (result != ISC_R_SUCCESS) @@ -312,7 +312,7 @@ static isc_result_t printrdata(dns_message_t *msg, dns_rdataset_t *rdataset, dns_name_t *owner, - const char *set_name, isc_boolean_t headers) + const char *set_name, int headers) { isc_buffer_t target; isc_result_t result; @@ -325,7 +325,7 @@ isc_buffer_init(&target, tbuf, sizeof(tbuf)); - result = dns_rdataset_totext(rdataset, owner, ISC_FALSE, ISC_FALSE, + result = dns_rdataset_totext(rdataset, owner, 0, 0, &target); if (result != ISC_R_SUCCESS) return (result); @@ -362,8 +362,8 @@ } static isc_result_t -printmessage(dig_query_t *query, dns_message_t *msg, isc_boolean_t headers) { - isc_boolean_t did_flag = ISC_FALSE; +printmessage(dig_query_t *query, dns_message_t *msg, int headers) { + int did_flag = 0; dns_rdataset_t *opt, *tsig = NULL; dns_name_t *tsigname; isc_result_t result = ISC_R_SUCCESS; @@ -386,7 +386,7 @@ sizeof(sockstr)); printf("Address: %s\n", sockstr); printf("Aliases: \n\n"); - printed_server = ISC_TRUE; + printed_server = 1; } if (msg->rcode != 0) { @@ -419,22 +419,22 @@ dns_name_copy(query->lookup->name, name, NULL); chase_cnamechain(msg, name); dns_name_format(name, namestr, sizeof(namestr)); - lookup = clone_lookup(query->lookup, ISC_FALSE); + lookup = clone_lookup(query->lookup, 0); if (lookup != NULL) { strlcpy(lookup->textname, namestr, sizeof(lookup->textname)); lookup->rdtype = dns_rdatatype_aaaa; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = 1; lookup->origin = NULL; lookup->retries = tries; ISC_LIST_APPEND(lookup_list, lookup, link); } - lookup = clone_lookup(query->lookup, ISC_FALSE); + lookup = clone_lookup(query->lookup, 0); if (lookup != NULL) { strlcpy(lookup->textname, namestr, sizeof(lookup->textname)); lookup->rdtype = dns_rdatatype_mx; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = 1; lookup->origin = NULL; lookup->retries = tries; ISC_LIST_APPEND(lookup_list, lookup, link); @@ -448,31 +448,31 @@ printf(";; flags: "); if ((msg->flags & DNS_MESSAGEFLAG_QR) != 0) { printf("qr"); - did_flag = ISC_TRUE; + did_flag = 1; } if ((msg->flags & DNS_MESSAGEFLAG_AA) != 0) { printf("%saa", did_flag ? " " : ""); - did_flag = ISC_TRUE; + did_flag = 1; } if ((msg->flags & DNS_MESSAGEFLAG_TC) != 0) { printf("%stc", did_flag ? " " : ""); - did_flag = ISC_TRUE; + did_flag = 1; } if ((msg->flags & DNS_MESSAGEFLAG_RD) != 0) { printf("%srd", did_flag ? " " : ""); - did_flag = ISC_TRUE; + did_flag = 1; } if ((msg->flags & DNS_MESSAGEFLAG_RA) != 0) { printf("%sra", did_flag ? " " : ""); - did_flag = ISC_TRUE; + did_flag = 1; } if ((msg->flags & DNS_MESSAGEFLAG_AD) != 0) { printf("%sad", did_flag ? " " : ""); - did_flag = ISC_TRUE; + did_flag = 1; } if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0) { printf("%scd", did_flag ? " " : ""); - did_flag = ISC_TRUE; + did_flag = 1; POST(did_flag); } printf("; QUERY: %u, ANSWER: %u, " @@ -495,7 +495,7 @@ !short_form) { printf("\n"); result = printsection(msg, DNS_SECTION_QUESTION, "QUESTION", - ISC_TRUE, query); + 1, query); if (result != ISC_R_SUCCESS) return (result); } @@ -503,7 +503,7 @@ if (!short_form) printf("\n"); result = printsection(msg, DNS_SECTION_ANSWER, "ANSWER", - ISC_TF(!short_form), query); + !short_form, query); if (result != ISC_R_SUCCESS) return (result); } @@ -512,7 +512,7 @@ !short_form) { printf("\n"); result = printsection(msg, DNS_SECTION_AUTHORITY, "AUTHORITY", - ISC_TRUE, query); + 1, query); if (result != ISC_R_SUCCESS) return (result); } @@ -520,14 +520,14 @@ !short_form) { printf("\n"); result = printsection(msg, DNS_SECTION_ADDITIONAL, - "ADDITIONAL", ISC_TRUE, query); + "ADDITIONAL", 1, query); if (result != ISC_R_SUCCESS) return (result); } if ((tsig != NULL) && !short_form) { printf("\n"); result = printrdata(msg, tsig, tsigname, - "PSEUDOSECTION TSIG", ISC_TRUE); + "PSEUDOSECTION TSIG", 1); if (result != ISC_R_SUCCESS) return (result); } @@ -564,12 +564,12 @@ case '4': if (ipv6only) fatal("only one of -4 and -6 allowed"); - ipv4only = ISC_TRUE; + ipv4only = 1; break; case '6': if (ipv4only) fatal("only one of -4 and -6 allowed"); - ipv6only = ISC_TRUE; + ipv6only = 1; break; case 'a': break; case 'c': break; @@ -589,8 +589,8 @@ case 'C': break; case 'D': if (debugging) - debugtiming = ISC_TRUE; - debugging = ISC_TRUE; + debugtiming = 1; + debugging = 1; break; case 'N': break; case 'R': break; @@ -619,23 +619,23 @@ lookup = make_empty_lookup(); - lookup->servfail_stops = ISC_FALSE; - lookup->comments = ISC_FALSE; + lookup->servfail_stops = 0; + lookup->comments = 0; while ((c = getopt(argc, argv, optstring)) != -1) { switch (c) { case 'l': - lookup->tcp_mode = ISC_TRUE; + lookup->tcp_mode = 1; lookup->rdtype = dns_rdatatype_axfr; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = 1; fatalexit = 3; break; case 'v': case 'd': - short_form = ISC_FALSE; + short_form = 0; break; case 'r': - lookup->recurse = ISC_FALSE; + lookup->recurse = 0; break; case 't': if (strncasecmp(optarg, "ixfr=", 5) == 0) { @@ -658,20 +658,20 @@ if (!lookup->rdtypeset || lookup->rdtype != dns_rdatatype_axfr) lookup->rdtype = rdtype; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = 1; if (rdtype == dns_rdatatype_axfr) { /* -l -t any -v */ list_type = dns_rdatatype_any; - short_form = ISC_FALSE; - lookup->tcp_mode = ISC_TRUE; + short_form = 0; + lookup->tcp_mode = 1; } else if (rdtype == dns_rdatatype_ixfr) { lookup->ixfr_serial = serial; - lookup->tcp_mode = ISC_TRUE; + lookup->tcp_mode = 1; list_type = rdtype; } else list_type = rdtype; - list_addresses = ISC_FALSE; - default_lookups = ISC_FALSE; + list_addresses = 0; + default_lookups = 0; break; case 'c': tr.base = optarg; @@ -684,22 +684,22 @@ fatal("invalid class: %s\n", optarg); } else { lookup->rdclass = rdclass; - lookup->rdclassset = ISC_TRUE; + lookup->rdclassset = 1; } - default_lookups = ISC_FALSE; + default_lookups = 0; break; case 'a': if (!lookup->rdtypeset || lookup->rdtype != dns_rdatatype_axfr) lookup->rdtype = dns_rdatatype_any; list_type = dns_rdatatype_any; - list_addresses = ISC_FALSE; - lookup->rdtypeset = ISC_TRUE; - short_form = ISC_FALSE; - default_lookups = ISC_FALSE; + list_addresses = 0; + lookup->rdtypeset = 1; + short_form = 0; + default_lookups = 0; break; case 'i': - lookup->ip6_int = ISC_TRUE; + lookup->ip6_int = 1; break; case 'n': /* deprecated */ @@ -730,18 +730,18 @@ tries = 2; break; case 'T': - lookup->tcp_mode = ISC_TRUE; + lookup->tcp_mode = 1; break; case 'C': debug("showing all SOAs"); lookup->rdtype = dns_rdatatype_ns; - lookup->rdtypeset = ISC_TRUE; + lookup->rdtypeset = 1; lookup->rdclass = dns_rdataclass_in; - lookup->rdclassset = ISC_TRUE; - lookup->ns_search_only = ISC_TRUE; - lookup->trace_root = ISC_TRUE; - lookup->identify_previous_line = ISC_TRUE; - default_lookups = ISC_FALSE; + lookup->rdclassset = 1; + lookup->ns_search_only = 1; + lookup->trace_root = 1; + lookup->identify_previous_line = 1; + default_lookups = 0; break; case 'N': debug("setting NDOTS to %s", optarg); @@ -759,7 +759,7 @@ /* Handled by pre_parse_args(). */ break; case 's': - lookup->servfail_stops = ISC_TRUE; + lookup->servfail_stops = 1; break; default: show_usage(); @@ -783,22 +783,22 @@ fatal("couldn't get address for '%s': %s", argv[1], isc_result_totext(res)); debug("server is %s", *argv + 1); - listed_server = ISC_TRUE; + listed_server = 1; } else - check_ra = ISC_TRUE; + check_ra = 1; - lookup->pending = ISC_FALSE; + lookup->pending = 0; if (get_reverse(store, sizeof(store), hostname, - lookup->ip6_int, ISC_TRUE) == ISC_R_SUCCESS) { + lookup->ip6_int, 1) == ISC_R_SUCCESS) { strlcpy(lookup->textname, store, sizeof(lookup->textname)); lookup->rdtype = dns_rdatatype_ptr; - lookup->rdtypeset = ISC_TRUE; - default_lookups = ISC_FALSE; + lookup->rdtypeset = 1; + default_lookups = 0; } else { strlcpy(lookup->textname, hostname, sizeof(lookup->textname)); - usesearch = ISC_TRUE; + usesearch = 1; } - lookup->new_search = ISC_TRUE; + lookup->new_search = 1; ISC_LIST_APPEND(lookup_list, lookup, link); }