[This is an updated version of the posted one,
 I added the makefile, modified the options
 to use getopt (and stop dumping core on bad arguments). cks
 made it run on Ultrix, delinted it - moraes]
[added support for the T_MP record that we use for pathalias
 routing -- see utsetup/MP.doc in utbind - moraes]

Path: jarvis.csri.toronto.edu!geneva.rutgers.edu!hedrick
Original-To: systems-dev-bind@rutgers.edu
Path: jarvis.csri.toronto.edu!geneva.rutgers.edu!hedrick
From: hedrick@geneva.rutgers.edu (Charles Hedrick)
Newsgroups: systems.dev.bind
Subject: new version of host, a query program for the DNS
Message-ID: <Jul.18.00.11.32.1989.994@geneva.rutgers.edu>
Date: Tue, 18 Jul 89 00:11:36 EDT
Organization: Rutgers Univ., New Brunswick, N.J.
Lines: 1432
Newsgroups: list.bind
Distribution: list
Sender: list-admin@ai.toronto.edu
Approved: list.bind@mail.ai.toronto.edu


Various people have taken copies of "host", our program for making
queries.  It's intended as a replacement for nslookup.  I believe that
it's easier to use, and it gives more information.  It is intended to
produce output meaningful to end users.  If you just say "host foo",
it looks up foo the same way the mail system would, and gives you both
the A and MX records, explained in English.

Experts will always want to use the -v option, which causes output to
be in the format used in the DNS master files, rather than the more
English-like format.  As far as I know, there are enough options to
generate any possible query.  It is also possible to do zone
transfers.  If you specify

  host -l -v -t any foo.edu

(-l: list the whole domain, i.e. zone transfer, -v: use official
master file format instead of English, -t any: show all types of
record) you'll get a copy of foo.edu's master file, more or less.
Unlike nslookup, it will locate an authoritative name server for
foo.edu automatically, though in many applications you'd likely do

  host -t ns foo.edu

first and choose a name server yourself, e.g.

  host -l -v -t any foo.edu mainsystem.foo.edu

A warning: I realized at the last minute that the code would be
non-portable.  Rutgers has extended the resolver to allow us to be in
more than one domain (declared in resolv.conf).  We run a system for
the New Jersey Intercampus Network.  It wants to be able to use
unqualified names for both hosts in njin.net and rutgers.edu.  I have
submitted these changes to Berkeley.  But for the moment presumably no
one outside Rutgers has them.  I just added an ifdef to handle this.
I tested it, and I think it's right.  But the code around #ifdef MAXDS
has gotten almost no actual use.

The support for reverse lookups, i.e. address to name, is not very
good.  I should produce the appropriate x.y.z.w.in-addr.arpa and use
the normal code.

This code has incestuous relations with the 4.8 resolver routines in
libc or libresolv.  It should be fairly easy to convert to earlier
resolvers.

Article 873 of list.bind:
Path: jarvis.csri.toronto.edu!trantor.umd.edu!louie
Message-ID: <8907181417.AA13099@trantor.umd.edu>
Original-To: hedrick@geneva.rutgers.edu (Charles Hedrick)
Original-Cc: systems-dev-bind@rutgers.edu
Subject: Re: new version of host, a query program for the DNS 
References: Your message of 18 Jul 89 04:11:36 GMT.
             <Jul.18.00.11.32.1989.994@geneva.rutgers.edu> 
Date: Tue, 18 Jul 89 10:17:04 EDT
From: louie@trantor.umd.edu ("Louis A. Mamakos")
Newsgroups: list.bind
Distribution: list
Sender: list-admin@ai.toronto.edu
Approved: list.bind@mail.ai.toronto.edu

Chuck,
	Looks good, a real handy tool.  I noticed one problem that you
will exprience if you are on a little endian machine -- the call to 
getservbyport() in p_rr()  needs to changed from

	    servp = getservbyport (n, protop->p_name);
to
	    servp = getservbyport (htons(n), protop->p_name);


Other than that, things worked pretty well.

louie


Article 871 of list.bind:
Path: jarvis.csri.toronto.edu!aramis.rutgers.edu!hedrick
Date: Tue, 18 Jul 89 01:47:27 EDT
From: hedrick@aramis.rutgers.edu
Message-ID: <8907180547.AA22000@athos.rutgers.edu>
Original-To: systems-dev-bind@rutgers.edu
Subject: one more compatibility issue
Newsgroups: list.bind
Distribution: list
Sender: list-admin@ai.toronto.edu
Approved: list.bind@mail.ai.toronto.edu

You may need to define
  #define T_TXT 16
if you don't have it in your header file.  Apparently named as
shipped doesn't support text records.


