Updated help information for adig, acountry, and ahost. (#334)

Provide more descriptive help information for various utilities.

Fix By: @anonymoushelpishere
pull/336/head
anonymoushelpishere 5 years ago committed by GitHub
parent 1b98172b14
commit d561177542
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      acountry.c
  2. 33
      adig.c
  3. 27
      ahost.c

@ -89,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, ...)
{
@ -129,7 +130,11 @@ int main(int argc, char **argv)
verbose++;
break;
case 'h':
print_help_info_acountry();
break;
case '?':
print_help_info_acountry();
break;
default:
Abort(usage);
}
@ -624,3 +629,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);
}

@ -177,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)
{
@ -205,7 +206,7 @@ int main(int argc, char **argv)
options.flags = ARES_FLAG_NOCHECKRESP;
options.servers = NULL;
options.nservers = 0;
while ((c = ares_getopt(argc, argv, "df:s:c:t:T:U:")) != -1)
while ((c = ares_getopt(argc, argv, "dh?f:s:c:t:T:U:")) != -1)
{
switch (c)
{
@ -214,7 +215,12 @@ int main(int argc, char **argv)
dbug_init();
#endif
break;
case 'h':
print_help_info_adig();
break;
case '?':
print_help_info_adig();
break;
case 'f':
/* Add a flag. */
for (i = 0; i < nflags; i++)
@ -825,3 +831,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);
}

@ -49,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)
{
@ -76,7 +77,7 @@ int main(int argc, char **argv)
return 1;
}
while ((c = ares_getopt(argc,argv,"dt:hs:")) != -1)
while ((c = ares_getopt(argc,argv,"dt:h?s:")) != -1)
{
switch (c)
{
@ -103,6 +104,11 @@ int main(int argc, char **argv)
usage();
break;
case 'h':
print_help_info_ahost();
break;
case '?':
print_help_info_ahost();
break;
default:
usage();
break;
@ -204,3 +210,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);
}
Loading…
Cancel
Save