From 6336e5287a72b80a993eab21ac4b62bbc273c7ee Mon Sep 17 00:00:00 2001 From: Joel Grunbaum <joelgrun@gmail.com> Date: Thu, 22 Oct 2020 02:30:32 +0000 Subject: [PATCH] removed accidentally committed file --- main.c | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/main.c b/main.c index 5fb4cf2..00d3e50 100644 --- a/main.c +++ b/main.c @@ -30,13 +30,13 @@ int main(int argc, char** argv) { int option, added_hosts = 0; - while((option = getopt(argc, argv, "s:h:t:n:")) != -1) { + while((option = getopt(argc, argv, "s:a:t:n:h")) != -1) { switch (option) { case 's': //server to use add_dns_server(&servers, optarg); num_servers++; break; - case 'h': //hostname to search + case 'a': //hostname to search add_hosts_server(&hosts, optarg); added_hosts++; break; @@ -47,8 +47,15 @@ num_tests = atoi(optarg); break; case '?': + case 'h': default: - printf("Error: invalid option -%c\n", optopt); + printf("Usage: %s [options]\n", argv[0]); + printf("Options:\n"); + printf("\t-s <server>\tadd a DNS server to be tested\n"); + printf("\t-a <hostname>\tadd a hostname to be tested\n"); + printf("\t-t <number>\tspecify the number of hostnames to be tested, capped at 50 + number manually added\n\t\t\tdefaults to test all available\n"); + printf("\t-n <number>\tspecify the number of tests to perform on each hostname\n\t\t\tdefaults to 10\n"); + printf("\t-h\t\tShow this help\n"); free_dns_list(&servers); free_hosts_list(&hosts); exit(1); @@ -58,10 +65,10 @@ num_hosts = NUM_HOSTNAMES + added_hosts; } for (int i = added_hosts; i < num_hosts; i++) { - add_hosts_server(&hosts, HOSTNAMES[i-added_hosts]); + add_hosts_server(&hosts, (char*)HOSTNAMES[i-added_hosts]); } for (int i = 0; i < NUM_DNS; i++) { - add_dns_server(&servers, DNS_SERVERS[i]); + add_dns_server(&servers, (char*)DNS_SERVERS[i]); } test_dns(); sort_servers(&servers); -- Gitblit v1.10.0