MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl/samples/dns_req/main.cpp:112–155  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112int main(int argc, char *argv[])
113{
114 int ch;
115 char dns_ips[512], domains[1024];
116 int dns_port = 53;
117
118 dns_ips[0] = 0;
119 domains[0] = 0;
120
121 acl_lib_init();
122
123 while ((ch = getopt(argc, argv, "hs:p:d:")) > 0) {
124 switch (ch) {
125 case 'h':
126 usage(argv[0]);
127 return 0;
128 case 's':
129 ACL_SAFE_STRNCPY(dns_ips, optarg, sizeof(dns_ips));
130 break;
131 case 'p':
132 dns_port = atoi(optarg);
133 break;
134 case 'd':
135 ACL_SAFE_STRNCPY(domains, optarg, sizeof(domains));
136 break;
137 default:
138 usage(argv[0]);
139 return 0;
140 }
141 }
142
143 if (dns_ips[0] == 0 || domains[0] == 0) {
144 usage(argv[0]);
145 return 0;
146 }
147
148 acl_msg_stdout_enable(1);
149 dns_lookup(domains, dns_ips, dns_port);
150#ifdef ACL_MS_WINDOWS
151 printf("Enter any key to exit\n");
152 getchar();
153#endif
154 return 0;
155}
156

Callers

nothing calls this directly

Calls 5

acl_lib_initFunction · 0.85
acl_msg_stdout_enableFunction · 0.85
usageFunction · 0.70
dns_lookupFunction · 0.70
getoptFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…