From ea63d508530de9875ea11915ff68669198082485 Mon Sep 17 00:00:00 2001 From: anonymoushelpishere <44309014+anonymoushelpishere@users.noreply.github.com> Date: Tue, 26 May 2020 22:00:25 -0700 Subject: [PATCH] Moved help info to acountry, adig, ahost. --- Makefile.inc | 1 - acountry.c | 12 ++++++++++- adig.c | 25 +++++++++++++++++++++- ahost.c | 21 ++++++++++++++++++- ares_help_info.c | 52 ---------------------------------------------- ares_help_info.h | 54 ------------------------------------------------ 6 files changed, 55 insertions(+), 110 deletions(-) delete mode 100644 ares_help_info.c delete mode 100644 ares_help_info.h diff --git a/Makefile.inc b/Makefile.inc index df3a4eca0..f65df1f57 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -61,7 +61,6 @@ HHEADERS = ares.h \ ares_data.h \ ares_dns.h \ ares_getenv.h \ - ares_help_info.h \ ares_inet_net_pton.h \ ares_iphlpapi.h \ ares_ipv6.h \ diff --git a/acountry.c b/acountry.c index 1223a9e83..b796f8ebe 100644 --- a/acountry.c +++ b/acountry.c @@ -49,7 +49,6 @@ #include "ares.h" #include "ares_getopt.h" #include "ares_nowarn.h" -#include "ares_help_info.h" #ifndef HAVE_STRDUP # include "ares_strdup.h" @@ -90,6 +89,7 @@ static void wait_ares(ares_channel channel); static void callback(void *arg, int status, int timeouts, struct hostent *host); static void callback2(void *arg, int status, int timeouts, struct hostent *host); static void find_country_from_cname(const char *cname, struct in_addr addr); +static void print_help_info_acountry(); static void Abort(const char *fmt, ...) { @@ -627,3 +627,13 @@ static void find_country_from_cname(const char *cname, struct in_addr addr) } free(ccopy); } + +/* Information from the man page. Formatting taken from man -h */ +static void print_help_info_acountry() { + printf("acountry, version %s \n\n", ARES_VERSION_STR); + printf("usage: acountry [-?hdv] {host|addr} ...\n\n" + " d : Print some extra debugging output.\n" + " h : Display this help and exit.\n" + " v : Be more verbose. Print extra information.\n\n"); + exit(0); +} \ No newline at end of file diff --git a/adig.c b/adig.c index c7fc6101a..e2b523c5b 100644 --- a/adig.c +++ b/adig.c @@ -42,7 +42,6 @@ #include "ares_dns.h" #include "ares_getopt.h" #include "ares_nowarn.h" -#include "ares_help_info.h" #ifndef HAVE_STRDUP # include "ares_strdup.h" @@ -178,6 +177,7 @@ static void usage(void); static void destroy_addr_list(struct ares_addr_node *head); static void append_addr_list(struct ares_addr_node **head, struct ares_addr_node *node); +static void print_help_info_adig(); int main(int argc, char **argv) { @@ -828,3 +828,26 @@ static void append_addr_list(struct ares_addr_node **head, else *head = node; } + + +/* Information from the man page. Formatting taken from man -h */ +static void print_help_info_adig() { + printf("adig, version %s \n\n", ARES_VERSION_STR); + printf("usage: adig [-h] [-d] [-f flag] [-s server] [-c class] [-t type] [-T|U port] name ...\n\n" + " d : Print some extra debugging output.\n" + " f : Add a flag. Possible values for flag are igntc, noaliases, norecurse, primary, stayopen, usevc.\n" + " h : Display this help and exit.\n\n" + " T port : Use specified TCP port to connect to DNS server.\n" + " U port : Use specified UDP port to connect to DNS server.\n" + " c class : Set the query class. Possible values for class are NY, CHAOS, HS, IN (default).\n" + " s server : Connect to specified DNS server, instead of the system's default one(s).\n" + " t type : Query records of specified type. \n" + " Possible values for type are A \n" + " (default), AAAA, AFSDB, ANY,\n" + " AXFR, CNAME, GPOS, HINFO, ISDN,\n" + " KEY, LOC, MAILA, MAILB, MB, MD,\n" + " MF, MG, MINFO, MR, MX, NAPTR, NS,\n" + " NSAP, NSAP_PTR, NULL, PTR, PX, RP,\n" + " RT, SIG, SOA, SRV, TXT, WKS, X25\n\n"); + exit(0); +} diff --git a/ahost.c b/ahost.c index f1c7cc465..6833b7da7 100644 --- a/ahost.c +++ b/ahost.c @@ -31,7 +31,6 @@ #include "ares_getopt.h" #include "ares_ipv6.h" #include "ares_nowarn.h" -#include "ares_help_info.h" #ifndef HAVE_STRDUP # include "ares_strdup.h" @@ -50,6 +49,7 @@ static void callback(void *arg, int status, int timeouts, struct hostent *host); static void usage(void); +static void print_help_info_ahost(); int main(int argc, char **argv) { @@ -207,3 +207,22 @@ static void usage(void) fprintf(stderr, "usage: ahost [-h] [-d] [-s {domain}] [-t {a|aaaa|u}] {host|addr} ...\n"); exit(1); } + +/* Information from the man page. Formatting taken from man -h */ +static void print_help_info_ahost() { + printf("ahost, version %s \n\n", ARES_VERSION_STR); + printf("usage: ahost [-h] [-d] [-s {domain}] [-t {a|aaaa|u}] {host|addr} ...\n\n" + " d : Print some extra debugging output.\n" + " h : Display this help and exit.\n\n" + " s domain : Specify the domain to search instead of \n" + " using the default values from \n" + " /etc/resolv.conf. This option only has an \n" + " effect on platforms that use /etc/resolv.conf\n" + " for DNS configuration; it has no effect on other\n" + " platforms (such as Win32 or Android).\n" + " t type : If type is \"a\", print the A record (default).\n" + " If type is \"aaaa\", print the AAAA record. If\n" + " type is \"u\", look for either AAAA or A record\n" + " (in that order).\n\n"); + exit(0); +} \ No newline at end of file diff --git a/ares_help_info.c b/ares_help_info.c deleted file mode 100644 index 2b6bdd73f..000000000 --- a/ares_help_info.c +++ /dev/null @@ -1,52 +0,0 @@ -#include -#include "ares_version.h" -#include "ares_help_info.h" - -/* Information from the man page. Formatting taken from man -h */ -void print_help_info_adig() { - printf("adig, version %s \n\n", ARES_VERSION_STR); - printf("usage: adig [-h] [-d] [-f flag] [-s server] [-c class] [-t type] [-T|U port] name ...\n\n" - " d : Print some extra debugging output.\n" - " f : Add a flag. Possible values for flag are igntc, noaliases, norecurse, primary, stayopen, usevc.\n" - " h : Display this help and exit.\n\n" - " T port : Use specified TCP port to connect to DNS server.\n" - " U port : Use specified UDP port to connect to DNS server.\n" - " c class : Set the query class. Possible values for class are NY, CHAOS, HS, IN (default).\n" - " s server : Connect to specified DNS server, instead of the system's default one(s).\n" - " t type : Query records of specified type. \n" - " Possible values for type are A \n" - " (default), AAAA, AFSDB, ANY,\n" - " AXFR, CNAME, GPOS, HINFO, ISDN,\n" - " KEY, LOC, MAILA, MAILB, MB, MD,\n" - " MF, MG, MINFO, MR, MX, NAPTR, NS,\n" - " NSAP, NSAP_PTR, NULL, PTR, PX, RP,\n" - " RT, SIG, SOA, SRV, TXT, WKS, X25\n\n"); - exit(0); -} - -void print_help_info_acountry() { - printf("acountry, version %s \n\n", ARES_VERSION_STR); - printf("usage: acountry [-?hdv] {host|addr} ...\n\n" - " d : Print some extra debugging output.\n" - " h : Display this help and exit.\n" - " v : Be more verbose. Print extra information.\n\n"); - exit(0); -} - -void print_help_info_ahost() { - printf("ahost, version %s \n\n", ARES_VERSION_STR); - printf("usage: ahost [-h] [-d] [-s {domain}] [-t {a|aaaa|u}] {host|addr} ...\n\n" - " d : Print some extra debugging output.\n" - " h : Display this help and exit.\n\n" - " s domain : Specify the domain to search instead of \n" - " using the default values from \n" - " /etc/resolv.conf. This option only has an \n" - " effect on platforms that use /etc/resolv.conf\n" - " for DNS configuration; it has no effect on other\n" - " platforms (such as Win32 or Android).\n" - " t type : If type is \"a\", print the A record (default).\n" - " If type is \"aaaa\", print the AAAA record. If\n" - " type is \"u\", look for either AAAA or A record\n" - " (in that order).\n\n"); - exit(0); -} \ No newline at end of file diff --git a/ares_help_info.h b/ares_help_info.h deleted file mode 100644 index 43e73896e..000000000 --- a/ares_help_info.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef ADIGHELP_H -#define ADIGHELP_H -#include -#include "ares_version.h" - -/* Information from the man page. Formatting taken from man -h */ -void print_help_info_adig() { - printf("adig, version %s \n\n", ARES_VERSION_STR); - printf("usage: adig [-h] [-d] [-f flag] [-s server] [-c class] [-t type] [-T|U port] name ...\n\n" - " d : Print some extra debugging output.\n" - " f : Add a flag. Possible values for flag are igntc, noaliases, norecurse, primary, stayopen, usevc.\n" - " h : Display this help and exit.\n\n" - " T port : Use specified TCP port to connect to DNS server.\n" - " U port : Use specified UDP port to connect to DNS server.\n" - " c class : Set the query class. Possible values for class are NY, CHAOS, HS, IN (default).\n" - " s server : Connect to specified DNS server, instead of the system's default one(s).\n" - " t type : Query records of specified type. \n" - " Possible values for type are A \n" - " (default), AAAA, AFSDB, ANY,\n" - " AXFR, CNAME, GPOS, HINFO, ISDN,\n" - " KEY, LOC, MAILA, MAILB, MB, MD,\n" - " MF, MG, MINFO, MR, MX, NAPTR, NS,\n" - " NSAP, NSAP_PTR, NULL, PTR, PX, RP,\n" - " RT, SIG, SOA, SRV, TXT, WKS, X25\n\n"); - exit(0); -} - -void print_help_info_acountry() { - printf("acountry, version %s \n\n", ARES_VERSION_STR); - printf("usage: acountry [-?hdv] {host|addr} ...\n\n" - " d : Print some extra debugging output.\n" - " h : Display this help and exit.\n" - " v : Be more verbose. Print extra information.\n\n"); - exit(0); -} - -void print_help_info_ahost() { - printf("ahost, version %s \n\n", ARES_VERSION_STR); - printf("usage: ahost [-h] [-d] [-s {domain}] [-t {a|aaaa|u}] {host|addr} ...\n\n" - " d : Print some extra debugging output.\n" - " h : Display this help and exit.\n\n" - " s domain : Specify the domain to search instead of \n" - " using the default values from \n" - " /etc/resolv.conf. This option only has an \n" - " effect on platforms that use /etc/resolv.conf\n" - " for DNS configuration; it has no effect on other\n" - " platforms (such as Win32 or Android).\n" - " t type : If type is \"a\", print the A record (default).\n" - " If type is \"aaaa\", print the AAAA record. If\n" - " type is \"u\", look for either AAAA or A record\n" - " (in that order).\n\n"); - exit(0); -} -#endif \ No newline at end of file