tools: refine help (#481)

fix invalid help options and documentation typos

Fix By: @lifenjoiner
pull/485/head
lifenjoiner 2 years ago committed by GitHub
parent 20c3cb7036
commit f6ddd08e69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      docs/acountry.1
  2. 24
      docs/adig.1
  3. 2
      docs/ahost.1
  4. 6
      src/tools/acountry.c
  5. 38
      src/tools/adig.c
  6. 23
      src/tools/ahost.c

@ -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

@ -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

@ -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

@ -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);
}

@ -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");

@ -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);
}

Loading…
Cancel
Save