From f6ddd08e69fbfc890fb4bdc76b35c52436e14633 Mon Sep 17 00:00:00 2001 From: lifenjoiner Date: Sat, 3 Sep 2022 20:02:58 +0800 Subject: [PATCH] tools: refine help (#481) fix invalid help options and documentation typos Fix By: @lifenjoiner --- docs/acountry.1 | 2 +- docs/adig.1 | 24 +++++++++++++++--------- docs/ahost.1 | 2 +- src/tools/acountry.c | 6 +++--- src/tools/adig.c | 38 +++++++++++++++++++++----------------- src/tools/ahost.c | 23 ++++++++++------------- 6 files changed, 51 insertions(+), 44 deletions(-) diff --git a/docs/acountry.1 b/docs/acountry.1 index 8c3aaea8..ab5ab3d0 100644 --- a/docs/acountry.1 +++ b/docs/acountry.1 @@ -17,7 +17,7 @@ This utility comes with the \fBc\-ares\fR asynchronous resolver library. \fB\-d\fR Print some extra debugging output. .TP -\fB\-h\fR, \fB\-\-help\fR +\fB\-h\fR, \fB\-?\fR Display this help and exit. .TP \fB\-v\fR diff --git a/docs/adig.1 b/docs/adig.1 index 2056b959..52ff49b7 100644 --- a/docs/adig.1 +++ b/docs/adig.1 @@ -18,34 +18,40 @@ This utility comes with the \fBc\-ares\fR asynchronous resolver library. \fB\-c\fR class Set the query class. Possible values for class are -NY, CHAOS, HS, IN (default). +ANY, CHAOS, HS and IN (default). .TP \fB\-d\fR Print some extra debugging output. .TP \fB\-f\fR flag -Add a flag. +Add a behavior control flag. Possible values for flag are -igntc, noaliases, norecurse, primary, stayopen, usevc. + igntc - ignore to query in TCP to get truncated UDP answer, + noaliases - don't honor the HOSTALIASES environment variable, + norecurse - don't query upstream servers recursively, + primary - use the first server, + stayopen - don't close the communication sockets, and + usevc - always use TCP. .TP -\fB\-h\fR, \fB\-\-help\fR +\fB\-h\fR, \fB\-?\fR Display this help and exit. .TP -\fB\-T\fR port -Use specified TCP port to connect to DNS server. -.TP \fB\-s\fR server Connect to specified DNS server, instead of the system's default one(s). +Servers are tried in round-robin, if the previous one failed. .TP \fB\-t\fR type Query records of specified type. Possible values for type are A (default), AAAA, AFSDB, ANY, AXFR, CNAME, GPOS, HINFO, ISDN, KEY, LOC, MAILA, MAILB, MB, MD, MF, MG, MINFO, MR, MX, NAPTR, NS, NSAP, NSAP_PTR, NULL, -PTR, PX, RP, RT, SIG, SOA, SRV, TXT, URI, WKS, X25, +PTR, PX, RP, RT, SIG, SOA, SRV, TXT, URI, WKS and X25. +.TP +\fB\-T\fR port +Connect to the specified TCP port of DNS server. .TP \fB\-U\fR port -Use specified UDP port to connect to DNS server. +Connect to the specified UDP port of DNS server. .TP \fB\-x\fR For an IPv4 \fB-t PTR a.b.c.d\fR lookup, query for diff --git a/docs/ahost.1 b/docs/ahost.1 index 430af821..07d9d1d1 100644 --- a/docs/ahost.1 +++ b/docs/ahost.1 @@ -17,7 +17,7 @@ This utility comes with the \fBc\-ares\fR asynchronous resolver library. \fB\-d\fR Print some extra debugging output. .TP -\fB\-h\fR, \fB\-\-help\fR +\fB\-h\fR, \fB\-?\fR Display this help and exit. .TP \fB\-t\fR type diff --git a/src/tools/acountry.c b/src/tools/acountry.c index a86d7cb0..422df085 100644 --- a/src/tools/acountry.c +++ b/src/tools/acountry.c @@ -643,10 +643,10 @@ static void find_country_from_cname(const char *cname, struct in_addr addr) /* Information from the man page. Formatting taken from man -h */ static void print_help_info_acountry(void) { - printf("acountry, version %s \n\n", ARES_VERSION_STR); - printf("usage: acountry [-hdv] {host|addr} ...\n\n" - " d : Print some extra debugging output.\n" + printf("acountry, version %s\n\n", ARES_VERSION_STR); + printf("usage: acountry [-hdv] host|addr ...\n\n" " h : Display this help and exit.\n" + " d : Print some extra debugging output.\n" " v : Be more verbose. Print extra information.\n\n"); exit(0); } diff --git a/src/tools/adig.c b/src/tools/adig.c index e4271668..cf5bd4d3 100644 --- a/src/tools/adig.c +++ b/src/tools/adig.c @@ -960,23 +960,27 @@ static void append_addr_list(struct ares_addr_node **head, /* Information from the man page. Formatting taken from man -h */ static void print_help_info_adig(void) { - 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] [-x | -xx] 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, URI, WKS, X25\n\n" + printf("adig, version %s\n\n", ARES_VERSION_STR); + printf("usage: adig [-h] [-d] [-f flag] [[-s server] ...] [-T|U port] [-c class] [-t type] [-x|-xx] name ...\n\n" + " h : Display this help and exit.\n" + " d : Print some extra debugging output.\n\n" + " f flag : Add a behavior control flag. Possible values are\n" + " igntc - ignore to query in TCP to get truncated UDP answer,\n" + " noaliases - don't honor the HOSTALIASES environment variable,\n" + " norecurse - don't query upstream servers recursively,\n" + " primary - use the first server,\n" + " stayopen - don't close the communication sockets, and\n" + " usevc - use TCP only.\n" + " s server : Connect to the specified DNS server, instead of the system's default one(s).\n" + " Servers are tried in round-robin, if the previous one failed.\n" + " T port : Connect to the specified TCP port of DNS server.\n" + " U port : Connect to the specified UDP port of DNS server.\n" + " c class : Set the query class. Possible values for class are ANY, CHAOS, HS and IN (default)\n" + " t type : Query records of the specified type.\n" + " Possible values for type are A (default), AAAA, AFSDB, ANY, AXFR,\n" + " CNAME, GPOS, HINFO, ISDN, KEY, LOC, MAILA, MAILB, MB, MD, MF, MG,\n" + " MINFO, MR, MX, NAPTR, NS, NSAP, NSAP_PTR, NULL, PTR, PX, RP, RT,\n" + " SIG, SOA, SRV, TXT, URI, WKS and X25.\n\n" " -x : For a '-t PTR a.b.c.d' lookup, query for 'd.c.b.a.in-addr.arpa.'\n" " -xx : As above, but for IPv6, compact the format into a bitstring like\n" " '[xabcdef00000000000000000000000000].IP6.ARPA.'\n"); diff --git a/src/tools/ahost.c b/src/tools/ahost.c index 77ca7cd0..8ac21066 100644 --- a/src/tools/ahost.c +++ b/src/tools/ahost.c @@ -213,19 +213,16 @@ static void usage(void) /* Information from the man page. Formatting taken from man -h */ static void print_help_info_ahost(void) { - 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" + printf("ahost, version %s\n\n", ARES_VERSION_STR); + printf("usage: ahost [-h] [-d] [[-s domain] ...] [-t a|aaaa|u] host|addr ...\n\n" + " h : Display this help and exit.\n" + " d : Print some extra debugging output.\n\n" + " s domain : Specify the domain to search instead of using the default values\n" + " from /etc/resolv.conf. This option only has an effect on\n" + " platforms that use /etc/resolv.conf for DNS configuration;\n" + " it has no effect on other platforms (such as Win32 or Android).\n\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"); + " If type is \"aaaa\", print the AAAA record.\n" + " If type is \"u\", look for either AAAA or A record (in that order).\n\n"); exit(0); }