4 * Copyright (C) 2004-2007, 2009 Internet Systems Consortium, Inc. ("ISC")
5 * Copyright (C) 2000-2003 Internet Software Consortium.
7 * Permission to use, copy, modify, and/or distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
12 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
13 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
14 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
16 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
20 /* Id: host.c,v 1.120 2009/09/29 15:06:05 fdupont Exp */
33 #include <idn/result.h>
35 #include <idn/resconf.h>
40 #include <isc/commandline.h>
41 #include <isc/netaddr.h>
42 #include <isc/print.h>
43 #include <isc/string.h>
46 #include <isc/stdlib.h>
48 #include <dns/byaddr.h>
49 #include <dns/fixedname.h>
50 #include <dns/message.h>
52 #include <dns/rdata.h>
53 #include <dns/rdataclass.h>
54 #include <dns/rdataset.h>
55 #include <dns/rdatatype.h>
56 #include <dns/rdatastruct.h>
60 static isc_boolean_t short_form
= ISC_TRUE
, listed_server
= ISC_FALSE
;
61 static isc_boolean_t default_lookups
= ISC_TRUE
;
62 static int seen_error
= -1;
63 static isc_boolean_t list_addresses
= ISC_TRUE
;
64 static dns_rdatatype_t list_type
= dns_rdatatype_a
;
65 static isc_boolean_t printed_server
= ISC_FALSE
;
67 static const char *opcodetext
[] = {
86 static const char *rcodetext
[] = {
111 struct rtype rtypes
[] = {
112 { 1, "has address" },
113 { 2, "name server" },
114 { 5, "is an alias for" },
115 { 11, "has well known services" },
116 { 12, "domain name pointer" },
117 { 13, "host information" },
118 { 15, "mail is handled by" },
119 { 16, "descriptive text" },
120 { 19, "x25 address" },
121 { 20, "ISDN address" },
122 { 24, "has signature" },
124 { 28, "has IPv6 address" },
130 rcode_totext(dns_rcode_t rcode
)
132 static char buf
[sizeof("?65535")];
134 const char *consttext
;
138 if (rcode
>= (sizeof(rcodetext
)/sizeof(rcodetext
[0]))) {
139 snprintf(buf
, sizeof(buf
), "?%u", rcode
);
140 totext
.deconsttext
= buf
;
142 totext
.consttext
= rcodetext
[rcode
];
143 return totext
.deconsttext
;
146 ISC_PLATFORM_NORETURN_PRE
static void
147 show_usage(void) ISC_PLATFORM_NORETURN_POST
;
152 "Usage: host [-aCdlriTwv] [-c class] [-N ndots] [-t type] [-W time]\n"
153 " [-R number] [-m flag] hostname [server]\n"
154 " -a is equivalent to -v -t ANY\n"
155 " -c specifies query class for non-IN data\n"
156 " -C compares SOA records on authoritative nameservers\n"
157 " -d is equivalent to -v\n"
158 " -l lists all hosts in a domain, using AXFR\n"
159 " -i IP6.INT reverse lookups\n"
160 " -N changes the number of dots allowed before root lookup is done\n"
161 " -r disables recursive processing\n"
162 " -R specifies number of retries for UDP packets\n"
163 " -s a SERVFAIL response should stop query\n"
164 " -t specifies the query type\n"
165 " -T enables TCP/IP mode\n"
166 " -v enables verbose output\n"
167 " -w specifies to wait forever for a reply\n"
168 " -W specifies how long to wait for a reply\n"
169 " -4 use IPv4 query transport only\n"
170 " -6 use IPv6 query transport only\n"
171 " -m set memory debugging flag (trace|record|usage)\n", stderr
);
176 dighost_shutdown(void) {
181 received(int bytes
, isc_sockaddr_t
*from
, dig_query_t
*query
) {
186 char fromtext
[ISC_SOCKADDR_FORMATSIZE
];
187 isc_sockaddr_format(from
, fromtext
, sizeof(fromtext
));
189 diff
= (int) isc_time_microdiff(&now
, &query
->time_sent
);
190 printf("Received %u bytes from %s in %d ms\n",
191 bytes
, fromtext
, diff
/1000);
196 trying(char *frm
, dig_lookup_t
*lookup
) {
200 printf("Trying \"%s\"\n", frm
);
204 say_message(dns_name_t
*name
, const char *msg
, dns_rdata_t
*rdata
,
207 isc_buffer_t
*b
= NULL
;
208 char namestr
[DNS_NAME_FORMATSIZE
];
211 unsigned int bufsize
= BUFSIZ
;
213 dns_name_format(name
, namestr
, sizeof(namestr
));
215 result
= isc_buffer_allocate(mctx
, &b
, bufsize
);
216 check_result(result
, "isc_buffer_allocate");
217 result
= dns_rdata_totext(rdata
, NULL
, b
);
218 if (result
== ISC_R_NOSPACE
) {
223 check_result(result
, "dns_rdata_totext");
224 isc_buffer_usedregion(b
, &r
);
225 if (query
->lookup
->identify_previous_line
) {
226 printf("Nameserver %s:\n\t",
229 printf("%s %s %.*s", namestr
,
230 msg
, (int)r
.length
, (char *)r
.base
);
231 if (query
->lookup
->identify
) {
232 printf(" on server %s", query
->servname
);
238 /* Just for compatibility : not use in host program */
240 printrdataset(dns_name_t
*owner_name
, dns_rdataset_t
*rdataset
,
241 isc_buffer_t
*target
)
250 printsection(dns_message_t
*msg
, dns_section_t sectionid
,
251 const char *section_name
, isc_boolean_t headers
,
254 dns_name_t
*name
, *print_name
;
255 dns_rdataset_t
*rdataset
;
256 dns_rdata_t rdata
= DNS_RDATA_INIT
;
258 isc_result_t result
, loopresult
;
260 dns_name_t empty_name
;
263 isc_boolean_t no_rdata
;
265 if (sectionid
== DNS_SECTION_QUESTION
)
268 no_rdata
= ISC_FALSE
;
271 printf(";; %s SECTION:\n", section_name
);
273 dns_name_init(&empty_name
, NULL
);
275 result
= dns_message_firstname(msg
, sectionid
);
276 if (result
== ISC_R_NOMORE
)
277 return (ISC_R_SUCCESS
);
278 else if (result
!= ISC_R_SUCCESS
)
283 dns_message_currentname(msg
, sectionid
, &name
);
285 isc_buffer_init(&target
, t
, sizeof(t
));
289 for (rdataset
= ISC_LIST_HEAD(name
->list
);
291 rdataset
= ISC_LIST_NEXT(rdataset
, link
)) {
292 if (query
->lookup
->rdtype
== dns_rdatatype_axfr
&&
293 !((!list_addresses
&&
294 (list_type
== dns_rdatatype_any
||
295 rdataset
->type
== list_type
)) ||
297 (rdataset
->type
== dns_rdatatype_a
||
298 rdataset
->type
== dns_rdatatype_aaaa
||
299 rdataset
->type
== dns_rdatatype_ns
||
300 rdataset
->type
== dns_rdatatype_ptr
))))
303 result
= dns_rdataset_totext(rdataset
,
308 if (result
!= ISC_R_SUCCESS
)
312 print_name
= &empty_name
;
316 UNUSED(first
); /* Shut up compiler. */
319 loopresult
= dns_rdataset_first(rdataset
);
320 while (loopresult
== ISC_R_SUCCESS
) {
323 char typebuf
[DNS_RDATATYPE_FORMATSIZE
];
324 char typebuf2
[DNS_RDATATYPE_FORMATSIZE
326 dns_rdataset_current(rdataset
, &rdata
);
328 for (t
= rtypes
; t
->text
!= NULL
; t
++) {
329 if (t
->type
== rdata
.type
) {
335 dns_rdatatype_format(rdata
.type
,
338 snprintf(typebuf2
, sizeof(typebuf2
),
339 "has %s record", typebuf
);
342 say_message(print_name
, rtt
,
344 dns_rdata_reset(&rdata
);
346 dns_rdataset_next(rdataset
);
351 isc_buffer_usedregion(&target
, &r
);
353 printf(";%.*s", (int)r
.length
,
356 printf("%.*s", (int)r
.length
, (char *)r
.base
);
359 result
= dns_message_nextname(msg
, sectionid
);
360 if (result
== ISC_R_NOMORE
)
362 else if (result
!= ISC_R_SUCCESS
)
366 return (ISC_R_SUCCESS
);
370 printrdata(dns_message_t
*msg
, dns_rdataset_t
*rdataset
, dns_name_t
*owner
,
371 const char *set_name
, isc_boolean_t headers
)
380 printf(";; %s SECTION:\n", set_name
);
382 isc_buffer_init(&target
, t
, sizeof(t
));
384 result
= dns_rdataset_totext(rdataset
, owner
, ISC_FALSE
, ISC_FALSE
,
386 if (result
!= ISC_R_SUCCESS
)
388 isc_buffer_usedregion(&target
, &r
);
389 printf("%.*s", (int)r
.length
, (char *)r
.base
);
391 return (ISC_R_SUCCESS
);
395 chase_cnamechain(dns_message_t
*msg
, dns_name_t
*qname
) {
397 dns_rdataset_t
*rdataset
;
398 dns_rdata_cname_t cname
;
399 dns_rdata_t rdata
= DNS_RDATA_INIT
;
400 unsigned int i
= msg
->counts
[DNS_SECTION_ANSWER
];
404 result
= dns_message_findname(msg
, DNS_SECTION_ANSWER
, qname
,
405 dns_rdatatype_cname
, 0, NULL
,
407 if (result
!= ISC_R_SUCCESS
)
409 result
= dns_rdataset_first(rdataset
);
410 check_result(result
, "dns_rdataset_first");
411 dns_rdata_reset(&rdata
);
412 dns_rdataset_current(rdataset
, &rdata
);
413 result
= dns_rdata_tostruct(&rdata
, &cname
, NULL
);
414 check_result(result
, "dns_rdata_tostruct");
415 dns_name_copy(&cname
.cname
, qname
, NULL
);
416 dns_rdata_freestruct(&cname
);
421 printmessage(dig_query_t
*query
, dns_message_t
*msg
, isc_boolean_t headers
) {
422 isc_boolean_t did_flag
= ISC_FALSE
;
423 dns_rdataset_t
*opt
, *tsig
= NULL
;
424 dns_name_t
*tsigname
;
425 isc_result_t result
= ISC_R_SUCCESS
;
431 * We get called multiple times.
432 * Preserve any existing error status.
434 force_error
= (seen_error
== 1) ? 1 : 0;
436 if (listed_server
&& !printed_server
) {
437 char sockstr
[ISC_SOCKADDR_FORMATSIZE
];
439 printf("Using domain server:\n");
440 printf("Name: %s\n", query
->userarg
);
441 isc_sockaddr_format(&query
->sockaddr
, sockstr
,
443 printf("Address: %s\n", sockstr
);
444 printf("Aliases: \n\n");
445 printed_server
= ISC_TRUE
;
448 if (msg
->rcode
!= 0) {
449 char namestr
[DNS_NAME_FORMATSIZE
];
450 dns_name_format(query
->lookup
->name
, namestr
, sizeof(namestr
));
451 printf("Host %s not found: %d(%s)\n",
452 (msg
->rcode
!= dns_rcode_nxdomain
) ? namestr
:
453 query
->lookup
->textname
, msg
->rcode
,
454 rcode_totext(msg
->rcode
));
455 return (ISC_R_SUCCESS
);
458 if (default_lookups
&& query
->lookup
->rdtype
== dns_rdatatype_a
) {
459 char namestr
[DNS_NAME_FORMATSIZE
];
460 dig_lookup_t
*lookup
;
461 dns_fixedname_t fixed
;
464 /* Add AAAA and MX lookups. */
465 dns_fixedname_init(&fixed
);
466 name
= dns_fixedname_name(&fixed
);
467 dns_name_copy(query
->lookup
->name
, name
, NULL
);
468 chase_cnamechain(msg
, name
);
469 dns_name_format(name
, namestr
, sizeof(namestr
));
470 lookup
= clone_lookup(query
->lookup
, ISC_FALSE
);
471 if (lookup
!= NULL
) {
472 strncpy(lookup
->textname
, namestr
,
473 sizeof(lookup
->textname
));
474 lookup
->textname
[sizeof(lookup
->textname
)-1] = 0;
475 lookup
->rdtype
= dns_rdatatype_aaaa
;
476 lookup
->rdtypeset
= ISC_TRUE
;
477 lookup
->origin
= NULL
;
478 lookup
->retries
= tries
;
479 ISC_LIST_APPEND(lookup_list
, lookup
, link
);
481 lookup
= clone_lookup(query
->lookup
, ISC_FALSE
);
482 if (lookup
!= NULL
) {
483 strncpy(lookup
->textname
, namestr
,
484 sizeof(lookup
->textname
));
485 lookup
->textname
[sizeof(lookup
->textname
)-1] = 0;
486 lookup
->rdtype
= dns_rdatatype_mx
;
487 lookup
->rdtypeset
= ISC_TRUE
;
488 lookup
->origin
= NULL
;
489 lookup
->retries
= tries
;
490 ISC_LIST_APPEND(lookup_list
, lookup
, link
);
495 printf(";; ->>HEADER<<- opcode: %s, status: %s, id: %u\n",
496 opcodetext
[msg
->opcode
], rcode_totext(msg
->rcode
),
498 printf(";; flags: ");
499 if ((msg
->flags
& DNS_MESSAGEFLAG_QR
) != 0) {
503 if ((msg
->flags
& DNS_MESSAGEFLAG_AA
) != 0) {
504 printf("%saa", did_flag
? " " : "");
507 if ((msg
->flags
& DNS_MESSAGEFLAG_TC
) != 0) {
508 printf("%stc", did_flag
? " " : "");
511 if ((msg
->flags
& DNS_MESSAGEFLAG_RD
) != 0) {
512 printf("%srd", did_flag
? " " : "");
515 if ((msg
->flags
& DNS_MESSAGEFLAG_RA
) != 0) {
516 printf("%sra", did_flag
? " " : "");
519 if ((msg
->flags
& DNS_MESSAGEFLAG_AD
) != 0) {
520 printf("%sad", did_flag
? " " : "");
523 if ((msg
->flags
& DNS_MESSAGEFLAG_CD
) != 0) {
524 printf("%scd", did_flag
? " " : "");
527 printf("; QUERY: %u, ANSWER: %u, "
528 "AUTHORITY: %u, ADDITIONAL: %u\n",
529 msg
->counts
[DNS_SECTION_QUESTION
],
530 msg
->counts
[DNS_SECTION_ANSWER
],
531 msg
->counts
[DNS_SECTION_AUTHORITY
],
532 msg
->counts
[DNS_SECTION_ADDITIONAL
]);
533 opt
= dns_message_getopt(msg
);
535 printf(";; EDNS: version: %u, udp=%u\n",
536 (unsigned int)((opt
->ttl
& 0x00ff0000) >> 16),
537 (unsigned int)opt
->rdclass
);
539 tsig
= dns_message_gettsig(msg
, &tsigname
);
541 printf(";; PSEUDOSECTIONS: TSIG\n");
543 if (! ISC_LIST_EMPTY(msg
->sections
[DNS_SECTION_QUESTION
]) &&
546 result
= printsection(msg
, DNS_SECTION_QUESTION
, "QUESTION",
548 if (result
!= ISC_R_SUCCESS
)
551 if (! ISC_LIST_EMPTY(msg
->sections
[DNS_SECTION_ANSWER
])) {
554 result
= printsection(msg
, DNS_SECTION_ANSWER
, "ANSWER",
555 ISC_TF(!short_form
), query
);
556 if (result
!= ISC_R_SUCCESS
)
560 if (! ISC_LIST_EMPTY(msg
->sections
[DNS_SECTION_AUTHORITY
]) &&
563 result
= printsection(msg
, DNS_SECTION_AUTHORITY
, "AUTHORITY",
565 if (result
!= ISC_R_SUCCESS
)
568 if (! ISC_LIST_EMPTY(msg
->sections
[DNS_SECTION_ADDITIONAL
]) &&
571 result
= printsection(msg
, DNS_SECTION_ADDITIONAL
,
572 "ADDITIONAL", ISC_TRUE
, query
);
573 if (result
!= ISC_R_SUCCESS
)
576 if ((tsig
!= NULL
) && !short_form
) {
578 result
= printrdata(msg
, tsig
, tsigname
,
579 "PSEUDOSECTION TSIG", ISC_TRUE
);
580 if (result
!= ISC_R_SUCCESS
)
586 if (short_form
&& !default_lookups
&&
587 ISC_LIST_EMPTY(msg
->sections
[DNS_SECTION_ANSWER
])) {
588 char namestr
[DNS_NAME_FORMATSIZE
];
589 char typestr
[DNS_RDATATYPE_FORMATSIZE
];
590 dns_name_format(query
->lookup
->name
, namestr
, sizeof(namestr
));
591 dns_rdatatype_format(query
->lookup
->rdtype
, typestr
,
593 printf("%s has no %s record\n", namestr
, typestr
);
595 seen_error
= force_error
;
599 static const char * optstring
= "46ac:dilnm:rst:vwCDN:R:TW:";
602 pre_parse_args(int argc
, char **argv
) {
605 while ((c
= isc_commandline_parse(argc
, argv
, optstring
)) != -1) {
608 memdebugging
= ISC_TRUE
;
609 if (strcasecmp("trace", isc_commandline_argument
) == 0)
610 isc_mem_debugging
|= ISC_MEM_DEBUGTRACE
;
611 else if (!strcasecmp("record",
612 isc_commandline_argument
) == 0)
613 isc_mem_debugging
|= ISC_MEM_DEBUGRECORD
;
614 else if (strcasecmp("usage",
615 isc_commandline_argument
) == 0)
616 isc_mem_debugging
|= ISC_MEM_DEBUGUSAGE
;
642 isc_commandline_reset
= ISC_TRUE
;
643 isc_commandline_index
= 1;
647 parse_args(isc_boolean_t is_batchfile
, int argc
, char **argv
) {
648 char hostname
[MXNAME
];
649 dig_lookup_t
*lookup
;
653 isc_result_t result
= ISC_R_SUCCESS
;
654 dns_rdatatype_t rdtype
;
655 dns_rdataclass_t rdclass
;
656 isc_uint32_t serial
= 0;
658 UNUSED(is_batchfile
);
660 lookup
= make_empty_lookup();
662 lookup
->servfail_stops
= ISC_FALSE
;
663 lookup
->comments
= ISC_FALSE
;
665 while ((c
= isc_commandline_parse(argc
, argv
, optstring
)) != -1) {
668 lookup
->tcp_mode
= ISC_TRUE
;
669 lookup
->rdtype
= dns_rdatatype_axfr
;
670 lookup
->rdtypeset
= ISC_TRUE
;
675 short_form
= ISC_FALSE
;
678 lookup
->recurse
= ISC_FALSE
;
681 if (strncasecmp(isc_commandline_argument
,
683 rdtype
= dns_rdatatype_ixfr
;
684 /* XXXMPA add error checking */
685 serial
= strtoul(isc_commandline_argument
+ 5,
687 result
= ISC_R_SUCCESS
;
689 tr
.base
= isc_commandline_argument
;
690 tr
.length
= strlen(isc_commandline_argument
);
691 result
= dns_rdatatype_fromtext(&rdtype
,
692 (isc_textregion_t
*)&tr
);
695 if (result
!= ISC_R_SUCCESS
) {
697 fatal("invalid type: %s\n",
698 isc_commandline_argument
);
700 if (!lookup
->rdtypeset
||
701 lookup
->rdtype
!= dns_rdatatype_axfr
)
702 lookup
->rdtype
= rdtype
;
703 lookup
->rdtypeset
= ISC_TRUE
;
707 if (rdtype
== dns_rdatatype_axfr
) {
709 list_type
= dns_rdatatype_any
;
710 short_form
= ISC_FALSE
;
711 lookup
->tcp_mode
= ISC_TRUE
;
712 } else if (rdtype
== dns_rdatatype_ixfr
) {
713 lookup
->ixfr_serial
= serial
;
714 lookup
->tcp_mode
= ISC_TRUE
;
717 } else if (rdtype
== dns_rdatatype_a
||
718 rdtype
== dns_rdatatype_aaaa
||
719 rdtype
== dns_rdatatype_mx
) {
720 idnoptions
= IDN_ASCCHECK
;
725 list_addresses
= ISC_FALSE
;
726 default_lookups
= ISC_FALSE
;
729 tr
.base
= isc_commandline_argument
;
730 tr
.length
= strlen(isc_commandline_argument
);
731 result
= dns_rdataclass_fromtext(&rdclass
,
732 (isc_textregion_t
*)&tr
);
734 if (result
!= ISC_R_SUCCESS
) {
736 fatal("invalid class: %s\n",
737 isc_commandline_argument
);
739 lookup
->rdclass
= rdclass
;
740 lookup
->rdclassset
= ISC_TRUE
;
742 default_lookups
= ISC_FALSE
;
745 if (!lookup
->rdtypeset
||
746 lookup
->rdtype
!= dns_rdatatype_axfr
)
747 lookup
->rdtype
= dns_rdatatype_any
;
748 list_type
= dns_rdatatype_any
;
749 list_addresses
= ISC_FALSE
;
750 lookup
->rdtypeset
= ISC_TRUE
;
751 short_form
= ISC_FALSE
;
752 default_lookups
= ISC_FALSE
;
755 lookup
->ip6_int
= ISC_TRUE
;
761 /* Handled by pre_parse_args(). */
765 * The timer routines are coded such that
766 * timeout==MAXINT doesn't enable the timer
771 timeout
= atoi(isc_commandline_argument
);
776 tries
= atoi(isc_commandline_argument
) + 1;
781 lookup
->tcp_mode
= ISC_TRUE
;
784 debug("showing all SOAs");
785 lookup
->rdtype
= dns_rdatatype_ns
;
786 lookup
->rdtypeset
= ISC_TRUE
;
787 lookup
->rdclass
= dns_rdataclass_in
;
788 lookup
->rdclassset
= ISC_TRUE
;
789 lookup
->ns_search_only
= ISC_TRUE
;
790 lookup
->trace_root
= ISC_TRUE
;
791 lookup
->identify_previous_line
= ISC_TRUE
;
792 default_lookups
= ISC_FALSE
;
795 debug("setting NDOTS to %s",
796 isc_commandline_argument
);
797 ndots
= atoi(isc_commandline_argument
);
800 debugging
= ISC_TRUE
;
804 isc_net_disableipv6();
805 have_ipv6
= ISC_FALSE
;
807 fatal("can't find IPv4 networking");
811 isc_net_disableipv4();
812 have_ipv4
= ISC_FALSE
;
814 fatal("can't find IPv6 networking");
817 lookup
->servfail_stops
= ISC_TRUE
;
822 lookup
->retries
= tries
;
824 if (isc_commandline_index
>= argc
)
827 strncpy(hostname
, argv
[isc_commandline_index
], sizeof(hostname
));
828 hostname
[sizeof(hostname
)-1]=0;
829 if (argc
> isc_commandline_index
+ 1) {
830 set_nameserver(argv
[isc_commandline_index
+1]);
831 debug("server is %s", argv
[isc_commandline_index
+1]);
832 listed_server
= ISC_TRUE
;
836 lookup
->pending
= ISC_FALSE
;
837 if (get_reverse(store
, sizeof(store
), hostname
,
838 lookup
->ip6_int
, ISC_TRUE
) == ISC_R_SUCCESS
) {
839 strncpy(lookup
->textname
, store
, sizeof(lookup
->textname
));
840 lookup
->textname
[sizeof(lookup
->textname
)-1] = 0;
841 lookup
->rdtype
= dns_rdatatype_ptr
;
842 lookup
->rdtypeset
= ISC_TRUE
;
843 default_lookups
= ISC_FALSE
;
845 strncpy(lookup
->textname
, hostname
, sizeof(lookup
->textname
));
846 lookup
->textname
[sizeof(lookup
->textname
)-1]=0;
847 usesearch
= ISC_TRUE
;
849 lookup
->new_search
= ISC_TRUE
;
850 ISC_LIST_APPEND(lookup_list
, lookup
, link
);
854 main(int argc
, char **argv
) {
859 ISC_LIST_INIT(lookup_list
);
860 ISC_LIST_INIT(server_list
);
861 ISC_LIST_INIT(search_list
);
865 idnoptions
= IDN_ASCCHECK
;
870 pre_parse_args(argc
, argv
);
871 result
= isc_app_start();
872 check_result(result
, "isc_app_start");
874 parse_args(ISC_FALSE
, argc
, argv
);
876 result
= isc_app_onrun(mctx
, global_task
, onrun_callback
, NULL
);
877 check_result(result
, "isc_app_onrun");
882 return ((seen_error
== 0) ? 0 : 1);