Lines Matching refs:G
326 #define G (*(struct globals*)bb_common_bufsiz1) macro
329 G.default_port = 53; \
330 G.default_retry = 2; \
331 G.default_timeout = 5; \
526 unsigned timeout = G.default_timeout * 1000; in send_queries()
543 retry_interval = timeout / G.default_retry; in send_queries()
553 for (qn = 0; qn < G.query_count; qn++) { in send_queries()
554 if (G.query[qn].qlen == 0) in send_queries()
557 if (write(pfd.fd, G.query[qn].query, G.query[qn].qlen) < 0) { in send_queries()
565 servfail_retry = 2 * G.query_count; in send_queries()
599 if (memcmp(reply, G.query[qn].query, 2) == 0) { in send_queries()
603 if (++qn >= G.query_count) { in send_queries()
609 if (G.query[qn].qlen == 0) { in send_queries()
622 write(pfd.fd, G.query[qn].query, G.query[qn].qlen); in send_queries()
629 G.query[qn].qlen = 0; /* flag: "reply received" */ in send_queries()
637 G.query[qn].name, rcodes[rcode]); in send_queries()
638 G.exitcode = EXIT_FAILURE; in send_queries()
642 printf("*** Can't find %s: Parse error\n", G.query[qn].name); in send_queries()
643 G.exitcode = EXIT_FAILURE; in send_queries()
667 if (n_replies >= G.query_count) in send_queries()
671 G.query[qn].latency = tcur - tstart; in send_queries()
675 memcpy(G.query[qn].reply, G.query[save_idx].reply, recvlen); in send_queries()
681 if (save_idx >= G.query_count) in send_queries()
683 if (!G.query[save_idx].rlen) in send_queries()
702 count = G.serv_count++; in add_ns()
704 G.server = xrealloc_vector(G.server, /*8=2^3:*/ 3, count); in add_ns()
705 ns = &G.server[count]; in add_ns()
707 ns->lsa = xhost2sockaddr(addr, G.default_port); in add_ns()
735 if (!G.have_search_directive) in parse_resolvconf()
741 G.have_search_directive = 1; in parse_resolvconf()
743 free(G.search); in parse_resolvconf()
744 G.search = xstrdup(arg); in parse_resolvconf()
745 dbg("search='%s'\n", G.search); in parse_resolvconf()
759 if (!G.search) { in parse_resolvconf()
764 G.search = d + 1; in parse_resolvconf()
765 dbg("search='%s' (from hostname)\n", G.search); in parse_resolvconf()
771 if (G.search && LONE_CHAR(G.search, '.')) in parse_resolvconf()
772 G.search = NULL; in parse_resolvconf()
781 count = G.query_count++; in add_query()
783 G.query = xrealloc_vector(G.query, /*4=2^2:*/ 2, count); in add_query()
784 new_q = &G.query[count]; in add_query()
801 if (type == T_PTR || !G.search || strchr(dname, '.')) { in add_query_with_search()
806 s = G.search; in add_query_with_search()
930 G.default_port = xatou_range(val, 1, 0xffff); in nslookup_main()
933 G.default_retry = xatou_range(val, 1, INT_MAX); in nslookup_main()
939 G.default_timeout = xatou_range(val, 1, INT_MAX / 1000); in nslookup_main()
951 if (G.serv_count == 0) in nslookup_main()
981 for (rc = 0; rc < G.serv_count;) { in nslookup_main()
984 c = send_queries(&G.server[rc]); in nslookup_main()
989 printf("Replies:\t%d\n", G.server[rc].replies); in nslookup_main()
990 printf("Failures:\t%d\n\n", G.server[rc].failures); in nslookup_main()
999 if (rc >= G.serv_count) { in nslookup_main()
1024 for (rc = 0; rc < G.query_count; rc++) { in nslookup_main()
1025 if (G.query[rc].qlen) { in nslookup_main()
1026 printf("*** Can't find %s: No answer\n", G.query[rc].name); in nslookup_main()
1034 free(G.server); in nslookup_main()
1035 free(G.query); in nslookup_main()
1038 return G.exitcode; in nslookup_main()