Skip to content

Commit

Permalink
Moved help info to acountry, adig, ahost.
Browse files Browse the repository at this point in the history
  • Loading branch information
div2016bit committed May 27, 2020
1 parent 33999fb commit ea63d50
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 110 deletions.
1 change: 0 additions & 1 deletion Makefile.inc
Expand Up @@ -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 \
Expand Down
12 changes: 11 additions & 1 deletion acountry.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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, ...)
{
Expand Down Expand Up @@ -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);
}
25 changes: 24 additions & 1 deletion adig.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
}
21 changes: 20 additions & 1 deletion ahost.c
Expand Up @@ -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"
Expand All @@ -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)
{
Expand Down Expand Up @@ -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);
}
52 changes: 0 additions & 52 deletions ares_help_info.c

This file was deleted.

54 changes: 0 additions & 54 deletions ares_help_info.h

This file was deleted.

0 comments on commit ea63d50

Please sign in to comment.