]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Remove arlib.
authorDave Hart <hart@ntp.org>
Wed, 3 Feb 2010 23:51:52 +0000 (23:51 +0000)
committerDave Hart <hart@ntp.org>
Wed, 3 Feb 2010 23:51:52 +0000 (23:51 +0000)
bk: 4b6a0c189A85OPDaMu4p6HV3534RGw

14 files changed:
ChangeLog
Makefile.am
arlib/COPYING [deleted file]
arlib/INSTALL [deleted file]
arlib/Makefile.am [deleted file]
arlib/README [deleted file]
arlib/UNSHAR.HDR [deleted file]
arlib/arlib.3 [deleted file]
arlib/arlib.c [deleted file]
arlib/arlib.h [deleted file]
arlib/arplib.h [deleted file]
arlib/configure.in [deleted file]
arlib/sample.c [deleted file]
configure.ac

index 3d2cd1f8307d6c96658d7ee2a8a331e515a1e3ef..d0aefce6af433c8bc1ff667d4e1ee3c95ecee015 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,7 @@
 * Convert many sprintf() calls to snprintf(), also strcpy(), strcat().
 * Fix widely cut-n-pasted bug in refclock shutdown after failed start.
 * Remove some dead code checking for emalloc() returning NULL.
+* Remove arlib.
 
 ---
 (4.2.6p1-RC3) 2010/01/24 Released by Harlan Stenn <stenn@ntp.org>
index b9e7cbf0891b1c10c07567d2ddaee0e9b8be317b..0af2449274ac3fb9a9809ed396be5b681b98e900 100644 (file)
@@ -1,4 +1,3 @@
-#AUTOMAKE_OPTIONS = util/ansi2knr foreign dist-tarZ no-dependencies
 AUTOMAKE_OPTIONS = foreign 1.10
 ACLOCAL_AMFLAGS= -I m4 -I libopts/m4
 
@@ -14,7 +13,6 @@ if NEED_LIBOPTS
 SUBDIRS+= libopts
 endif
 SUBDIRS+=              \
-       @ARLIB_DIR@     \
        libntp          \
        libparse        \
        ntpd            \
@@ -34,7 +32,6 @@ DIST_SUBDIRS=         \
        scripts         \
        include         \
        ElectricFence   \
-       arlib           \
        libntp          \
        libopts         \
        libparse        \
@@ -51,7 +48,7 @@ DIST_SUBDIRS=         \
        util            \
        $(NULL)
 
-DISTCHECK_CONFIGURE_FLAGS=     -C --with-arlib --enable-local-libopts
+DISTCHECK_CONFIGURE_FLAGS = -C
 
 EXTRA_DIST =                   \
        COPYRIGHT               \
diff --git a/arlib/COPYING b/arlib/COPYING
deleted file mode 100644 (file)
index 57e5c2a..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-Replied: Fri, 16 Feb 2001 14:12:54 -0500
-Replied: "Darren Reed <darrenr@reed.wattle.id.au> "
-Received: from [139.134.6.79] by whimsy.udel.edu id aa15476;
-          16 Feb 2001 04:21 EST
-Received: from CPE-61-9-164-106.vic.bigpond.net.au
-          ([139.134.4.52]) by mailin6.bigpond.com (Netscape Messaging
-          Server 4.15) with SMTP id G8UFIB00.4QI for
-          <stenn@whimsy.udel.edu>; Fri, 16 Feb 2001 19:25:23 +1000 
-Received: from CPE-61-9-164-110.vic.bigpond.net.au ([61.9.164.110]) by mail5.bigpond.com (Claudes-Retiring-MailRouter V2.9c 9/11963672); 16 Feb 2001 19:20:45
-Received: (from root@localhost)
-       by CPE-61-9-164-106.vic.bigpond.net.au (8.11.0/8.11.0) id f1G92GC29158
-       for <stenn@whimsy.udel.edu>; Fri, 16 Feb 2001 20:02:16 +1100
-From: Darren Reed <darrenr@reed.wattle.id.au>
-Message-Id: <200102160901.UAA23657@avalon.reed.wattle.id.au>
-Subject: Re: arlib?
-In-Reply-To: <901.982219274@whimsy.udel.edu> from Harlan Stenn at "Feb 15, 1 01:41:14 am"
-To: Harlan Stenn <stenn@whimsy.udel.edu>
-Date: Fri, 16 Feb 2001 20:01:46 +1100
-X-Mailer: ELM [version 2.4ME+ PL37 (25)]
-MIME-Version: 1.0
-Content-Type: text/plain; charset=US-ASCII
-Content-Transfer-Encoding: 7bit
-
-In some email I received from Harlan Stenn, sie wrote:
-> Darren,
-> 
-> I'm looking for an async resolver library that I can use with NTP.
-> 
-> I noticed your code in the contrib/ subdir of later bind8 distribution
-> and I noticed the Copyright notice in arlib.c:
-> 
->  * arlib.c (C)opyright 1993 Darren Reed. All rights reserved.
->  * This file may not be distributed without the author's permission in any
->  * shape or form. The author takes no responsibility for any damage or loss
->  * of property which results from the use of this software.
-> 
-> so I thought I'd ask your permission to distribute your files if I can
-> figure out how to make it all work with ntpd.
-
-http://coombs.anu.edu.au/~avalon/arlib.tar.gz
-
-a few bug fixes (inc. buffer overflow :) and stuff in there.
-
-But otherwise, go for it.
-
-Darren
diff --git a/arlib/INSTALL b/arlib/INSTALL
deleted file mode 100644 (file)
index b42a17a..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-Basic Installation
-==================
-
-   These are generic installation instructions.
-
-   The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation.  It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions.  Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
-
-   If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
-
-   The file `configure.in' is used to create `configure' by a program
-called `autoconf'.  You only need `configure.in' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
-
-The simplest way to compile this package is:
-
-  1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.  If you're
-     using `csh' on an old version of System V, you might need to type
-     `sh ./configure' instead to prevent `csh' from trying to execute
-     `configure' itself.
-
-     Running `configure' takes awhile.  While running, it prints some
-     messages telling which features it is checking for.
-
-  2. Type `make' to compile the package.
-
-  3. Optionally, type `make check' to run any self-tests that come with
-     the package.
-
-  4. Type `make install' to install the programs and any data files and
-     documentation.
-
-  5. You can remove the program binaries and object files from the
-     source code directory by typing `make clean'.  To also remove the
-     files that `configure' created (so you can compile the package for
-     a different kind of computer), type `make distclean'.  There is
-     also a `make maintainer-clean' target, but that is intended mainly
-     for the package's developers.  If you use it, you may have to get
-     all sorts of other programs in order to regenerate files that came
-     with the distribution.
-
-Compilers and Options
-=====================
-
-   Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  You can give `configure'
-initial values for variables by setting them in the environment.  Using
-a Bourne-compatible shell, you can do that on the command line like
-this:
-     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
-
-Or on systems that have the `env' program, you can do it like this:
-     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
-
-Compiling For Multiple Architectures
-====================================
-
-   You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory.  To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'.  `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script.  `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
-   If you have to use a `make' that does not supports the `VPATH'
-variable, you have to compile the package for one architecture at a time
-in the source code directory.  After you have installed the package for
-one architecture, use `make distclean' before reconfiguring for another
-architecture.
-
-Installation Names
-==================
-
-   By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc.  You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
-
-   You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files.  If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
-
-   In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
-kinds of files.  Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
-
-   If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
-   Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System).  The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
-   For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
-   There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on.  Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
-     CPU-COMPANY-SYSTEM
-
-See the file `config.sub' for the possible values of each field.  If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
-
-   If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
-
-Sharing Defaults
-================
-
-   If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists.  Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Operation Controls
-==================
-
-   `configure' recognizes the following options to control how it
-operates.
-
-`--cache-file=FILE'
-     Use and save the results of the tests in FILE instead of
-     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
-     debugging `configure'.
-
-`--help'
-     Print a summary of the options to `configure', and exit.
-
-`--quiet'
-`--silent'
-`-q'
-     Do not print messages saying which checks are being made.  To
-     suppress all normal output, redirect it to `/dev/null' (any error
-     messages will still be shown).
-
-`--srcdir=DIR'
-     Look for the package's source code in directory DIR.  Usually
-     `configure' can determine that directory automatically.
-
-`--version'
-     Print the version of Autoconf used to generate the `configure'
-     script, and exit.
-
-`configure' also accepts some other, not widely useful, options.
diff --git a/arlib/Makefile.am b/arlib/Makefile.am
deleted file mode 100644 (file)
index 47286de..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-AUTOMAKE_OPTIONS = foreign
-
-#lib_LIBRARIES = libares.a
-noinst_LIBRARIES = libares.a
-libares_a_SOURCES = arlib.c arplib.h
-#include_HEADERS = arlib.h
-noinst_HEADERS = arlib.h
-
-noinst_PROGRAMS = example
-example_SOURCES = sample.c
-example_LDADD = libares.a
-#man_MANS = arlib.3
-#EXTRA_DIST = $(man_MANS) UNSHAR.HDR
-noinst_MANS = arlib.3
-EXTRA_DIST = $(noinst_MANS) UNSHAR.HDR
diff --git a/arlib/README b/arlib/README
deleted file mode 100644 (file)
index 1d2e787..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-
-                               Asynchronous DNS
-                               ----------------
-
-       Intro.
-
-For those who write real time network applications that have to handle
-multiple TCP or UDP connections, the problem of effectively doing DNS
-lookups is quite real.  Generally, this means the program waits while
-the query finishes, holding everything else up.  This small library of
-routines aims to solve that problem by performing the DNS query and
-then returning the program to its normal flow.
-
-       Whats included ?
-
-The library routines, arlib.c, a header file for it, arlib.h, a man
-page, arlib.3 and an example of how this sort of code is used,
-sample.c.
-
-
-       Compilation & Installation.
-
-Edit the Makefile and do "make install" to install things where you
-wish them to go.  You should check it makes and works before doing
-this :)
-
-If the compilation is successful, you'll have an executeable called
-"example" and libares.a.  "example" is a simple program which will
-do hostname->IP# or IP#->hostnae lookups by entering either the
-hostname or IP# on the line with "Host-->".  You dont have to wait
-for a query to fail or succeed before typing in the next line.
-
-       Portability.
-
-I'm not sure how portable this is, it was written under SunOS 4.1.2
-on a Sparc 1+ and hasn't been tested very widely.  If you find any
-problems when compiling/execution, plase send me a patch (using
-diff -c) to avalon@coombs.anu.edu.au.  If it goes well enough, I'll
-send it to comp.unix.sources or comp.sources.misc for further testing.
-
-       Future additions.
-
-Adding a working cache would be nice but I'm not sure if that really
-is needed (?).  I guess it depends on how often your program is
-required to do a DNS lookup and whether caching would help.
-
-
-Cheers,
-Darren.
diff --git a/arlib/UNSHAR.HDR b/arlib/UNSHAR.HDR
deleted file mode 100644 (file)
index c92d475..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-Replied: Sun, 19 Dec 93 09:58:30 PST
-Replied: "Darren Reed <avalon@coombs.anu.edu.au> "
-Return-Path: avalon@coombs.anu.edu.au
-Received: by gw.home.vix.com id AA12017; Sun, 19 Dec 93 07:04:44 -0800
-Message-Id: <9312191504.AA12017@gw.home.vix.com>
-Received: by coombs.anu.edu.au
-       (1.37.109.8/16.2) id AA10850; Mon, 20 Dec 1993 02:07:21 +1100
-From: Darren Reed <avalon@coombs.anu.edu.au>
-Subject: Addition for 4.9 "contrib" directory
-To: paul@vix.com
-Date: Mon, 20 Dec 1993 02:07:20 +1000 (EDT)
-X-Mailer: ELM [version 2.4 PL21]
-Mime-Version: 1.0
-Content-Type: text/plain; charset=US-ASCII
-Content-Transfer-Encoding: 7bit
-Content-Length: 67950     
-
-
-Well, I just sent one letter off to dec.com, being from the 4.9 README I had.
-
-So, to sum up what I said, I've included below, some code I've written to
-perform async. DNS lookups - `replacements' for gethostbyname and
-gethostbyaddr.  I've written and tested it mainly on a HP-UX machine, so
-I'm not sure how it will port to others, but I've tried to keep the amount
-of OS specific code to a minimum.
-
-The Makefile is setup to work best from "contrib/arlib", which is how I
-checked to make sure it worked and ran well.  There's a man page included
-also.
-
-Cheers,
-Darren
diff --git a/arlib/arlib.3 b/arlib/arlib.3
deleted file mode 100644 (file)
index afdc02f..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-.TH arlib 3
-.SH NAME
-ar_answer, ar_close, ar_delete, ar_gethostbyname, ar_gethostbyaddr,
-ar_init, ar_open, ar_timeout - Asynchronous DNS library routines
-.SH SYNOPSIS
-.nf
-.B #include "arlib.h"
-
-.B struct hostent *ar_answer(dataptr, size)
-.B char *dataptr;
-.B int size;
-
-.B void ar_close();
-
-.B int ar_delete(dataptr, size)
-.B char *dataptr;
-.B int size;
-
-.B int ar_gethostbyname(name, dataptr, size)
-.B char *name;
-.B char *dataptr;
-.B int size;
-
-.B int ar_gethostbyaddr(name, dataptr, size)
-.B char *name;
-.B char *dataptr;
-.B int size;
-
-.B int ar_init(flags)
-.B int flags;
-
-.B int ar_open();
-
-.B long ar_timeout(time, dataptr, size)
-.B long time;
-.B char *dataptr;
-.B int size;
-.fi
-.SH DESCRIPTION
-
-.PP
-   This small library of DNS routines is intended to provide an
-asynchronous interface to performing hostname and IP number lookups.
-Only lookups of Internet domain are handled as yet.  To use this
-set of routines properly, the presence of the
-.B "BIND 4.8"
-resolve
-libraries is required (or any library derived from it).
-.PP
-   This library should be used in conjunction with
-.B select(2)
-to wait for
-the name server's reply to arrive or the lookup to timeout.
-.PP
-   To open a fd for talking to the name server, either
-.B ar_open()
-or
-ar_init()
-must be used.
-.B  ar_open()
- will open either a datagram socket
-or a virtual circuit with the name server, depending on the flags
-set in the _res structure (see
-.B resolv(5)
-).  In both cases, if the socket
-
-> i
-.B  ar_init()
-is
-used to both open the socket (as in
-.B ar_open()
-) and initialize the
-queues used by this library.  The values recognized as parameters to
-.B ar_init()
-are:
-
-.RS
-#define ARES_INITLIST   1
-.RE
-.RS
-#define ARES_CALLINIT   2
-.RE
-.RS
-#define ARES_INITSOCK   4
-.RE
-.RS
-#define ARES_INITDEBG   8
-.RE
-
-   ARES_INITLIST initializes the list of queries waiting for replies.
-ARES_CALLINIT is a flag which when set causes
-.B res_init()
-to be called.
-ARES_INITSOCK will close the current socket if it is open and call
-.B ar_open()
-to open a new one, returning the fd for that socket.
-ARES_INITDEBG sets the RES_DEBUG flag of the
-.B _res
-structure.
-ARES_INITCACH is as yet, unused and is for future use where the library
-keeps its own cache of replies.
-
-   To send a query about either a hostname or an IP number,
-.B ar_gethostbyname()
-and
-.B ar_gethostbyaddr()
-must be used.  Each takes
-either a pointer to the hostname or the IP number respectively for use
-when making the query.  In addition to this, both (optionally) can be
-passed a pointer to data, dataptr, with the size also passed which can
-be used for identifying individual queries.  A copy of the area pointed
-to is made if dataptr is non NULL and size is non zero.  These functions
-will always return NULL unless the answer to the query is found in
-internal caches.  A new flag, RES_CHECKPTR is checked during the
-processing of answers for
-.B ar_gethostbyname()
-which will automatically
-cause a reverse lookup to be queued, causing a failure if that reply
-differs from the original.
-
-   To check for a query,
-.B ar_answer()
-is called with a pointer to an  area
-of memory which is sufficient to hold what was originally passed via
-.B ar_gethostbyname()
-or
-.B ar_gethostbyaddr()
-through dataptr.  If an answer
-is found, a pointer to the host information is returned and the data
-segment copied if dataptr is non NULL and it was originally passed.  The
-size of the copied data is the smaller of the passed size and that of
-original data stored.
-
-   To expire old queries,
-.B ar_timeout()
-is called with the 'current' time
-(or the time for which you want to do timeouts for).  If a queue entry
-is too old, it will be expired when it has exhausted all available avenues
-for lookups and the data segment for the expired query copied into
-dataptr.  The size of the copied data is the smaller of the passed size
-and that of the original stored data.  Only 1 entry is thus expired with
-each call, requiring that it be called immediately after an expiration
-to check for others.  In addition to expiring lookups,
-.B ar_timeout()
-also
-triggers resends of queries and the searching of the domain tree for the
-host, the latter works from the
-.B _res
-structure of
-.B resolv(5).
-
-   To delete entries from the queue,
-.B ar_delete()
-can be used and by
-passing the pointer and size of the data segment, all queries have their
-data segments checked (if present) for an exact match, being deleted if
-and only if there is a match.  A NULL pointer passed to ar_deleted()
-matches all queries which were called with a NULL dataptr parameter.
-The amount of data compared is the smaller of the size passed and that
-of the data stored for the queue entry being compared.
-
-   To close a socket opened by
-.B ar_open()
-,
-.B ar_close()
-should  be used so
-that it is closed and also marked closed within this library.
-
-   
-.SH DIAGNOSIS
-
-.B ar_open()
-returns -1 if a socket isn't open and could not be opened;
-otherwise returns the current fd open or the fd it opened.
-
-.B ar_init()
-returns -1 for any errors, the value returned by
-.B res_init()
-if
-.B res_init()
-was called, the return value for
-.B ar_open()
-if that was
-called or the current socket open if 0 is passed and a socket is open.
-If neither
-.B res_init()
-or
-.B ar_open()
-are called and the flags are non-zero, -2 is returned.
-.B ar_gethostbyaddr()
-and
-.B ar_gethostbyname()
-will always return NULL in this version but may return a pointer to a hostent
-structure if a cache is being used and the answer is found in the cache.
-
-.B ar_answer()
-returns NULL if the answer is either not found or the
-query returned an error and another attempt at a lookup is attempted.
-If an answer was found, it returned a pointer to this structure and
-the contents of the data segment copied over.
-
-.B ar_timeout()
-returns the time when it should be called next or 0 if
-there are no queries in the queue to be checked later.  If any queries
-are expired, the data segment is copied over if dataptr is non NULL.
-
-.B ar_delete()
-returns the number of entries that were found to match
-and consequently deleted.
-
-.SH SEE ALSO
-
-gethostbyaddr(3), gethostbyname(3), resolv(5)
-
-.SH FILES
-.nf
-arlib.h
-/usr/include/resolv.h
-/usr/include/arpa/nameser.h
-/etc/resolv.conf
-
-.SH BUGS
-
-The results of a successful call to ar_answer() destroy the structure
-for any previous calls.
-
-.SH AUTHOR
-
-Darren Reed.  Email address: avalon@coombs.anu.edu.au
diff --git a/arlib/arlib.c b/arlib/arlib.c
deleted file mode 100644 (file)
index 3d76e57..0000000
+++ /dev/null
@@ -1,1056 +0,0 @@
-/*
- * arlib.c (C)opyright 1993 Darren Reed. All rights reserved.
- * This file may not be distributed without the author's permission in any
- * shape or form. The author takes no responsibility for any damage or loss
- * of property which results from the use of this software.
- */
-#ifndef lint
-static char    sccsid[] = "@(#)arlib.c 1.9 6/5/93 (C)opyright 1992 Darren \
-Reed. ASYNC DNS";
-#endif
-
-#include <stdio.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include "netdb.h"
-#include "arpa/nameser.h"
-#include <resolv.h>
-#include "arlib.h"
-#include "arplib.h"
-
-extern int     errno, h_errno;
-static char    ar_hostbuf[65], ar_domainname[65];
-static char    ar_dot[] = ".";
-static int     ar_resfd = -1, ar_vc = 0;
-static struct  reslist *ar_last, *ar_first;
-
-/*
- * Statistics structure.
- */
-static struct  resstats {
-       int     re_errors;
-       int     re_nu_look;
-       int     re_na_look;
-       int     re_replies;
-       int     re_requests;
-       int     re_resends;
-       int     re_sent;
-       int     re_timeouts;
-} ar_reinfo;
-
-static int do_query_name(/* struct resinfo *, char *, struct reslist * */);
-static int do_query_number(/* struct resinfo *, char *, struct reslist * */);
-static int ar_resend_query(/* struct reslist * */);
-
-/*
- * ar_init
- *
- * Initializes the various ARLIB internal varilables and related DNS
- * options for res_init().
- *
- * Returns 0 or the socket opened for use with talking to name servers
- * if 0 is passed or ARES_INITSOCK is set.
- */
-int    ar_init(op)
-int    op;
-{
-       int     ret = 0;
-
-       if (op & ARES_INITLIST)
-           {
-               bzero(&ar_reinfo, sizeof(ar_reinfo));
-               ar_first = ar_last = NULL;
-           }
-
-       if (op & ARES_CALLINIT && !(_res.options & RES_INIT))
-           {
-               ret = res_init();
-               (void)strcpy(ar_domainname, ar_dot);
-               (void)strncat(ar_domainname, _res.defdname,
-                               sizeof(ar_domainname)-2);
-           }
-
-       if (op & ARES_INITSOCK)
-               ret = ar_resfd = ar_open();
-
-       if (op & ARES_INITDEBG)
-               _res.options |= RES_DEBUG;
-
-       if (op == 0)
-               ret = ar_resfd;
-
-       return ret;
-}
-
-
-/*
- * ar_open
- *
- * Open a socket to talk to a name server with.
- * Check _res.options to see if we use a TCP or UDP socket.
- */
-int    ar_open()
-{
-       if (ar_resfd == -1)
-           {
-               if (_res.options & RES_USEVC)
-                   {
-                       struct  sockaddr_in     *sip;
-                       int     i;
-
-                       sip = _res.NS_ADDR_LIST;        /* was _res.nsaddr_list */
-                       ar_vc = 1;
-                       ar_resfd = socket(AF_INET, SOCK_STREAM, 0);
-
-                       /*
-                        * Try each name server listed in sequence until we
-                        * succeed or run out.
-                        */
-                       while (connect(ar_resfd, (struct sockaddr *)sip++,
-                                       sizeof(struct sockaddr)))
-                           {
-                               (void)close(ar_resfd);
-                               ar_resfd = -1;
-                               if (i >= _res.nscount)
-                                       break;
-                               ar_resfd = socket(AF_INET, SOCK_STREAM, 0);
-                           }
-                   }
-               else
-                       ar_resfd = socket(AF_INET, SOCK_DGRAM, 0);
-           }
-       if (ar_resfd >= 0)
-           {   /* Need one of these two here - and it MUST work!! */
-               int flags;
-
-               if ((flags = fcntl(ar_resfd, F_GETFL, 0)) != -1)
-#ifdef O_NONBLOCK
-                        if (fcntl(ar_resfd, F_SETFL, flags|O_NONBLOCK) == -1)
-#else
-# ifdef        O_NDELAY
-                        if (fcntl(ar_resfd, F_SETFL, flags|O_NDELAY) == -1)
-# else
-#  ifdef       FNDELAY
-                        if (fcntl(ar_resfd, F_SETFL, flags|FNDELAY) == -1)
-#  endif
-# endif
-#endif
-                   {
-                       (void)close(ar_resfd);
-                       ar_resfd = -1;
-                   }
-           }
-       return ar_resfd;
-}
-
-
-/*
- * ar_close
- *
- * Closes and flags the ARLIB socket as closed.
- */
-void   ar_close()
-{
-       (void)close(ar_resfd);
-       ar_resfd = -1;
-       return;
-}
-
-
-/*
- * ar_add_request
- *
- * Add a new DNS query to the end of the query list.
- */
-static int     ar_add_request(new)
-struct reslist *new;
-{
-       if (!new)
-               return -1;
-       if (!ar_first)
-               ar_first = ar_last = new;
-       else {
-               ar_last->re_next = new;
-               ar_last = new;
-       }
-       new->re_next = NULL;
-       ar_reinfo.re_requests++;
-       return 0;
-}
-
-
-/*
- * ar_remrequest
- *
- * Remove a request from the list. This must also free any memory that has
- * been allocated for temporary storage of DNS results.
- *
- * Returns -1 if there are anyy problems removing the requested structure
- * or 0 if the remove is successful.
- */
-static int     ar_remrequest(old)
-struct reslist *old;
-{
-       register struct reslist *rptr, *r2ptr;
-       register char   **s;
-
-       if (!old)
-               return -1;
-       for (rptr = ar_first, r2ptr = NULL; rptr; rptr = rptr->re_next)
-           {
-               if (rptr == old)
-                       break;
-               r2ptr = rptr;
-           }
-
-       if (!rptr)
-               return -1;
-       if (rptr == ar_first)
-               ar_first = ar_first->re_next;
-       else if (rptr == ar_last)
-           {
-               if (ar_last = r2ptr)
-                       ar_last->re_next = NULL;
-           }
-       else
-               r2ptr->re_next = rptr->re_next;
-
-       if (!ar_first)
-               ar_last = ar_first;
-
-#ifdef ARLIB_DEBUG
-       ar_dump_hostent("ar_remrequest:", rptr->re_he);
-#endif
-
-       if (rptr->re_he.h_name)
-               (void)free(rptr->re_he.h_name);
-       if (s = rptr->re_he.h_aliases)
-               for (; *s; s++)
-                       (void)free(*s);
-       if (rptr->re_rinfo.ri_ptr)
-               (void)free(rptr->re_rinfo.ri_ptr);
-       (void)free(rptr);
-
-       return 0;
-}
-
-
-/*
- * ar_make_request
- *
- * Create a DNS query recorded for the request being made and place it on the
- * current list awaiting replies.  Initialization of the record with set
- * values should also be done.
- */
-static struct  reslist *ar_make_request(resi)
-register struct        resinfo *resi;
-{
-       register struct reslist *rptr;
-       register struct resinfo *rp;
-
-       rptr = (struct reslist *)calloc(1, sizeof(struct reslist));
-       rp = &rptr->re_rinfo;
-
-       rptr->re_next    = NULL; /* where NULL is non-zero ;) */
-       rptr->re_sentat  = time(NULL);
-       rptr->re_retries = _res.retry;
-       rptr->re_sends = 1;
-       rptr->re_resend  = 1;
-       rptr->re_timeout = rptr->re_sentat + _res.retrans;
-       rptr->re_he.h_name = NULL;
-       rptr->re_he.h_addrtype   = AF_INET;
-       rptr->re_he.h_aliases[0] = NULL;
-       rp->ri_ptr = resi->ri_ptr;
-       rp->ri_size = resi->ri_size;
-
-       (void)ar_add_request(rptr);
-
-       return rptr;
-}
-
-
-/*
- * ar_timeout
- *
- * Remove queries from the list which have been there too long without
- * being resolved.
- */
-long   ar_timeout(now, info, size)
-time_t now;
-char   *info;
-int    size;
-{
-       register struct reslist *rptr, *r2ptr;
-       register long   next = 0;
-
-       for (rptr = ar_first, r2ptr = NULL; rptr; rptr = r2ptr)
-           {
-               r2ptr = rptr->re_next;
-               if (now >= rptr->re_timeout)
-                   {
-                       /*
-                        * If the timeout for the query has been exceeded,
-                        * then resend the query if we still have some
-                        * 'retry credit' and reset the timeout. If we have
-                        * used it all up, then remove the request.
-                        */
-                       if (--rptr->re_retries <= 0)
-                           {
-                               ar_reinfo.re_timeouts++;
-                               if (info && rptr->re_rinfo.ri_ptr)
-                                       bcopy(rptr->re_rinfo.ri_ptr, info,
-                                               MIN(rptr->re_rinfo.ri_size,
-                                                   size));
-                               (void)ar_remrequest(rptr);
-                               return now;
-                           }
-                       else
-                           {
-                               rptr->re_sends++;
-                               rptr->re_sentat = now;
-                               rptr->re_timeout = now + _res.retrans;
-                               (void)ar_resend_query(rptr);
-                           }
-                   }
-               if (!next || rptr->re_timeout < next)
-                       next = rptr->re_timeout;
-           }
-       return next;
-}
-
-
-/*
- * ar_send_res_msg
- *
- * When sending queries to nameservers listed in the resolv.conf file,
- * don't send a query to every one, but increase the number sent linearly
- * to match the number of resends. This increase only occurs if there are
- * multiple nameserver entries in the resolv.conf file.
- * The return value is the number of messages successfully sent to 
- * nameservers or -1 if no successful sends.
- */
-static int     ar_send_res_msg(msg, len, rcount)
-char   *msg;
-int    len, rcount;
-{
-       register int    i;
-       int     sent = 0;
-
-       if (!msg)
-               return -1;
-
-       rcount = (_res.nscount > rcount) ? rcount : _res.nscount;
-       if (_res.options & RES_PRIMARY)
-               rcount = 1;
-
-       if (ar_vc)
-           {
-               ar_reinfo.re_sent++;
-               sent++;
-               if (write(ar_resfd, msg, len) == -1)
-                   {
-                       int errtmp = errno;
-                       (void)close(ar_resfd);
-                       errno = errtmp;
-                       ar_resfd = -1;
-                   }
-           }
-       else
-               for (i = 0; i < rcount; i++)
-                   {
-                       if (sendto(ar_resfd, msg, len, 0,
-                                  (struct sockaddr *)&(_res.NS_ADDR_LIST[i]),
-                               sizeof(struct sockaddr_in)) == len)
-                           {
-                               ar_reinfo.re_sent++;
-                               sent++;
-                           }
-                   }
-       return (sent) ? sent : -1;
-}
-
-
-/*
- * ar_find_id
- *
- * find a dns query record by the id (id is determined by dn_mkquery)
- */
-static struct  reslist *ar_find_id(id)
-int    id;
-{
-       register struct reslist *rptr;
-
-       for (rptr = ar_first; rptr; rptr = rptr->re_next)
-               if (rptr->re_id == id)
-                       return rptr;
-       return NULL;
-}
-
-
-/*
- * ar_delete
- *
- * Delete a request from the waiting list if it has a data pointer which
- * matches the one passed.
- */
-int    ar_delete(ptr, size)
-char   *ptr;
-int    size;
-{
-       register struct reslist *rptr;
-       register struct reslist *r2ptr;
-       int     removed = 0;
-
-       for (rptr = ar_first; rptr; rptr = r2ptr)
-           {
-               r2ptr = rptr->re_next;
-               if (rptr->re_rinfo.ri_ptr && ptr && size &&
-                   bcmp(rptr->re_rinfo.ri_ptr, ptr, size) == 0)
-                   {
-                       (void)ar_remrequest(rptr);
-                       removed++;
-                   }
-           }
-       return removed;
-}
-
-
-/*
- * ar_query_name
- *
- * generate a query based on class, type and name.
- */
-static int     ar_query_name(name, class, type, rptr)
-char   *name;
-int    class, type;
-struct reslist *rptr;
-{
-       static  char buf[MAXPACKET];
-       int     r,s,a;
-       HEADER  *hptr;
-
-       bzero(buf, sizeof(buf));
-       r = res_mkquery(QUERY, name, class, type, NULL, 0, NULL,
-                       buf, sizeof(buf));
-       if (r <= 0)
-           {
-               h_errno = NO_RECOVERY;
-               return r;
-           }
-       hptr = (HEADER *)buf;
-       rptr->re_id = ntohs(hptr->id);
-
-       s = ar_send_res_msg(buf, r, rptr->re_sends);
-
-       if (s == -1)
-           {
-               h_errno = TRY_AGAIN;
-               return -1;
-           }
-       else
-               rptr->re_sent += s;
-       return 0;
-}
-
-
-/*
- * ar_gethostbyname
- *
- * Replacement library function call to gethostbyname().  This one, however,
- * doesn't return the record being looked up but just places the query in the
- * queue to await answers.
- */
-int    ar_gethostbyname(name, info, size)
-char   *name;
-char   *info;
-int    size;
-{
-       char    host[65];
-       struct  resinfo resi;
-       register struct resinfo *rp = &resi;
-
-       if (size && info)
-           {
-               rp->ri_ptr = (char *)malloc(size);
-               bcopy(info, rp->ri_ptr, size);
-               rp->ri_size = size;
-           }
-       else
-               bzero((char *)rp, sizeof(resi));
-       ar_reinfo.re_na_look++;
-       (void)strncpy(host, name, 64);
-       host[64] = '\0';
-
-       return (do_query_name(rp, host, NULL));
-}
-
-
-static int     do_query_name(resi, name, rptr)
-struct resinfo *resi;
-char   *name;
-register struct        reslist *rptr;
-{
-       char    hname[65];
-       int     len;
-
-       len = strlen((char *)strncpy(hname, name, sizeof(hname)-1));
-
-       if (rptr && (hname[len-1] != '.'))
-           {
-               (void)strncat(hname, ar_dot, sizeof(hname)-len-1);
-               /*
-                * NOTE: The logical relationship between DNSRCH and DEFNAMES
-                * is implies. ie no DEFNAES, no DNSRCH.
-                */
-               if (_res.options & (RES_DEFNAMES|RES_DNSRCH) ==
-                   (RES_DEFNAMES|RES_DNSRCH))
-                   {
-                       if (_res.dnsrch[rptr->re_srch])
-                               (void)strncat(hname, _res.dnsrch[rptr->re_srch],
-                                       sizeof(hname) - ++len -1);
-                   }
-               else if (_res.options & RES_DEFNAMES)
-                       (void)strncat(hname, ar_domainname, sizeof(hname) - len -1);
-           }
-
-       /*
-        * Store the name passed as the one to lookup and generate other host
-        * names to pass onto the nameserver(s) for lookups.
-        */
-       if (!rptr)
-           {
-               rptr = ar_make_request(resi);
-               rptr->re_type = T_A;
-               (void)strncpy(rptr->re_name, name, sizeof(rptr->re_name)-1);
-           }
-       return (ar_query_name(hname, C_IN, T_A, rptr));
-}
-
-
-/*
- * ar_gethostbyaddr
- *
- * Generates a query for a given IP address.
- */
-int    ar_gethostbyaddr(addr, info, size)
-char   *addr;
-char   *info;
-int    size;
-{
-       struct  resinfo resi;
-       register struct resinfo *rp = &resi;
-
-       if (size && info)
-           {
-               rp->ri_ptr = (char *)malloc(size);
-               bcopy(info, rp->ri_ptr, size);
-               rp->ri_size = size;
-           }
-       else
-               bzero((char *)rp, sizeof(resi));
-       ar_reinfo.re_nu_look++;
-       return (do_query_number(rp, addr, NULL));
-}
-
-
-/*
- * do_query_number
- *
- * Use this to do reverse IP# lookups.
- */
-static int     do_query_number(resi, numb, rptr)
-struct resinfo *resi;
-char   *numb;
-register struct        reslist *rptr;
-{
-       register unsigned char  *cp;
-       static  char    ipbuf[32];
-
-       /*
-        * Generate name in the "in-addr.arpa" domain.  No addings bits to this
-        * name to get more names to query!.
-        */
-       cp = (unsigned char *)numb;
-       (void)sprintf(ipbuf,"%u.%u.%u.%u.in-addr.arpa.",
-                       (unsigned int)(cp[3]), (unsigned int)(cp[2]),
-                       (unsigned int)(cp[1]), (unsigned int)(cp[0]));
-
-       if (!rptr)
-           {
-               rptr = ar_make_request(resi);
-               rptr->re_type = T_PTR;
-               rptr->re_he.h_length = sizeof(struct in_addr);
-               bcopy(numb, (char *)&rptr->re_addr, rptr->re_he.h_length);
-               bcopy(numb, (char *)&rptr->re_he.h_addr_list[0].s_addr,
-                       rptr->re_he.h_length);
-           }
-       return (ar_query_name(ipbuf, C_IN, T_PTR, rptr));
-}
-
-
-/*
- * ar_resent_query
- *
- * resends a query.
- */
-static int     ar_resend_query(rptr)
-struct reslist *rptr;
-{
-       if (!rptr->re_resend)
-               return -1;
-
-       switch(rptr->re_type)
-       {
-       case T_PTR:
-               ar_reinfo.re_resends++;
-               return do_query_number(NULL, &rptr->re_addr, rptr);
-       case T_A:
-               ar_reinfo.re_resends++;
-               return do_query_name(NULL, rptr->re_name, rptr);
-       default:
-               break;
-       }
-
-       return -1;
-}
-
-
-/*
- * ar_procanswer
- *
- * process an answer received from a nameserver.
- */
-static int     ar_procanswer(rptr, hptr, buf, eob)
-struct reslist *rptr;
-char   *buf, *eob;
-HEADER *hptr;
-{
-       char    *cp, **alias, *s;
-       int     class, type, dlen, len, ans = 0, n, i;
-       u_int32_t ttl, dr, *adr;
-       struct  hent    *hp;
-
-       cp = buf + sizeof(HEADER);
-       adr = (u_int32_t *)rptr->re_he.h_addr_list;
-
-       while (*adr)
-               adr++;
-
-       alias = rptr->re_he.h_aliases;
-       while (*alias)
-               alias++;
-
-       hp = &rptr->re_he;
-
-
-       /*
-        * Skip over the original question.
-        */
-       while (hptr->qdcount-- > 0)
-               cp += dn_skipname(cp, eob) + QFIXEDSZ;
-       /*
-        * proccess each answer sent to us. blech.
-        */
-       while (hptr->ancount-- > 0 && cp < eob) {
-               n = dn_expand(buf, eob, cp, ar_hostbuf, sizeof(ar_hostbuf));
-               cp += n;
-               if (n <= 0)
-                       return ans;
-
-               ans++;
-               /*
-                * 'skip' past the general dns crap (ttl, class, etc) to get
-                * the pointer to the right spot.  Some of thse are actually
-                * useful so its not a good idea to skip past in one big jump.
-                */
-               type = (int)_getshort(cp);
-               cp += sizeof(short);
-               class = (int)_getshort(cp);
-               cp += sizeof(short);
-               ttl = (u_int32_t)_getlong(cp);
-               cp += sizeof(u_int32_t);
-               dlen =  (int)_getshort(cp);
-               cp += sizeof(short);
-               rptr->re_type = type;
-
-               switch(type)
-               {
-               case T_A :
-                       rptr->re_he.h_length = dlen;
-                       if (ans == 1)
-                               rptr->re_he.h_addrtype=(class == C_IN) ?
-                                                       AF_INET : AF_UNSPEC;
-                       if (dlen != sizeof(dr))
-                           {
-                               h_errno = TRY_AGAIN;
-                               continue;
-                           }
-                       bcopy(cp, &dr, dlen);
-                       *adr++ = dr;
-                       *adr = 0;
-                       cp += dlen;
-                       len = strlen(ar_hostbuf);
-                       if (!rptr->re_he.h_name)
-                           {
-                               rptr->re_he.h_name = (char *)malloc(len+1);
-                               if (!rptr->re_he.h_name)
-                                       break;
-                               (void)strcpy(rptr->re_he.h_name, ar_hostbuf);
-                           }
-                       break;
-               case T_PTR :
-                       if ((n = dn_expand(buf, eob, cp, ar_hostbuf,
-                                          sizeof(ar_hostbuf) )) < 0)
-                           {
-                               cp += n;
-                               continue;
-                           }
-                       cp += n;
-                       len = strlen(ar_hostbuf)+1;
-                       /*
-                        * copy the returned hostname into the host name
-                        * or alias field if there is a known hostname
-                        * already.
-                        */
-                       if (!rptr->re_he.h_name)
-                           {
-                               rptr->re_he.h_name = (char *)malloc(len);
-                               if (!rptr->re_he.h_name)
-                                       break;
-                               (void)strcpy(rptr->re_he.h_name, ar_hostbuf);
-                           }
-                       else
-                           {
-                               *alias = (char *)malloc(len);
-                               if (!*alias)
-                                       return -1;
-                               (void)strcpy(*alias++, ar_hostbuf);
-                               *alias = NULL;
-                           }
-                       break;
-               case T_CNAME :
-                       cp += dlen;
-                       if (alias >= &(rptr->re_he.h_aliases[MAXALIASES-1]))
-                               continue;
-                       n = strlen(ar_hostbuf)+1;
-                       *alias = (char *)malloc(n);
-                       if (!*alias)
-                               return -1;
-                       (void)strcpy(*alias++, ar_hostbuf);
-                       *alias = NULL;
-                       break;
-               default :
-                       break;
-               }
-       }
-
-       return ans;
-}
-
-
-/*
- * ar_answer
- *
- * Get an answer from a DNS server and process it.  If a query is found to
- * which no answer has been given to yet, copy its 'info' structure back
- * to where "reip" points and return a pointer to the hostent structure.
- */
-struct hostent *ar_answer(reip, size)
-char   *reip;
-int    size;
-{
-       static  char    ar_rcvbuf[sizeof(HEADER) + MAXPACKET];
-       static  struct  hostent ar_host;
-
-       register HEADER *hptr;
-       register struct reslist *rptr = NULL;
-       register struct hostent *hp;
-       register char **s;
-       unsigned long   *adr;
-       int     rc, i, n, a;
-
-       rc = recv(ar_resfd, ar_rcvbuf, sizeof(ar_rcvbuf), 0);
-       if (rc <= 0)
-               goto getres_err;
-
-       ar_reinfo.re_replies++;
-       hptr = (HEADER *)ar_rcvbuf;
-       /*
-        * convert things to be in the right order.
-        */
-       hptr->id = ntohs(hptr->id);
-       hptr->ancount = ntohs(hptr->ancount);
-       hptr->arcount = ntohs(hptr->arcount);
-       hptr->nscount = ntohs(hptr->nscount);
-       hptr->qdcount = ntohs(hptr->qdcount);
-       /*
-        * response for an id which we have already received an answer for
-        * just ignore this response.
-        */
-       rptr = ar_find_id(hptr->id);
-       if (!rptr)
-               goto getres_err;
-
-       if ((hptr->rcode != NOERROR) || (hptr->ancount == 0))
-           {
-               switch (hptr->rcode)
-               {
-               case NXDOMAIN:
-                       h_errno = HOST_NOT_FOUND;
-                       break;
-               case SERVFAIL:
-                       h_errno = TRY_AGAIN;
-                       break;
-               case NOERROR:
-                       h_errno = NO_DATA;
-                       break;
-               case FORMERR:
-               case NOTIMP:
-               case REFUSED:
-               default:
-                       h_errno = NO_RECOVERY;
-                       break;
-               }
-               ar_reinfo.re_errors++;
-               /*
-               ** If a bad error was returned, we stop here and dont send
-               ** send any more (no retries granted).
-               */
-               if (h_errno != TRY_AGAIN)
-                   {
-                       rptr->re_resend = 0;
-                       rptr->re_retries = 0;
-                   }
-               goto getres_err;
-           }
-
-       a = ar_procanswer(rptr, hptr, ar_rcvbuf, ar_rcvbuf+rc);
-
-       if ((rptr->re_type == T_PTR) && (_res.options & RES_CHECKPTR))
-           {
-               /*
-                * For reverse lookups on IP#'s, lookup the name that is given
-                * for the ip# and return with that as the official result.
-                * -avalon
-                */
-               rptr->re_type = T_A;
-               /*
-                * Clean out the list of addresses already set, even though
-                * there should only be one :)
-                */
-               adr = (unsigned long *)rptr->re_he.h_addr_list;
-               while (*adr)
-                       *adr++ = 0L;
-               /*
-                * Lookup the name that we were given for the ip#
-                */
-               ar_reinfo.re_na_look++;
-               (void)strncpy(rptr->re_name, rptr->re_he.h_name,
-                       sizeof(rptr->re_name)-1);
-               rptr->re_he.h_name = NULL;
-               rptr->re_retries = _res.retry;
-               rptr->re_sends = 1;
-               rptr->re_resend = 1;
-               rptr->re_he.h_name = NULL;
-               ar_reinfo.re_na_look++;
-               (void)ar_query_name(rptr->re_name, C_IN, T_A, rptr);
-               return NULL;
-           }
-
-       if (reip && rptr->re_rinfo.ri_ptr && size)
-               bcopy(rptr->re_rinfo.ri_ptr, reip,
-                       MIN(rptr->re_rinfo.ri_size, size));
-       /*
-        * Clean up structure from previous usage.
-        */
-       hp = &ar_host;
-#ifdef ARLIB_DEBUG
-       ar_dump_hostent("ar_answer: previous usage", hp);
-#endif
-
-       if (hp->h_name)
-               (void)free(hp->h_name);
-       if (s = hp->h_aliases)
-           {
-               while (*s)
-                       (void)free(*s++);
-               (void)free(hp->h_aliases);
-           }
-       if (s = hp->h_addr_list)
-           {
-               /*
-                * Only free once since we allocated space for
-                * address in one big chunk.
-                */
-               (void)free(*s);
-               (void)free(hp->h_addr_list);
-           }
-       bzero((char *)hp, sizeof(*hp));
-
-       /*
-        * Setup and copy details for the structure we return a pointer to.
-        */
-       hp->h_addrtype = AF_INET;
-       hp->h_length = sizeof(struct in_addr);
-       if(rptr->re_he.h_name)
-           {
-               hp->h_name = (char *)malloc(strlen(rptr->re_he.h_name)+1);
-               if(!hp->h_name)
-                   {
-#ifdef ARLIB_DEBUG
-                       fprintf(stderr, "no memory for hostname\n");
-#endif
-                       h_errno = TRY_AGAIN;
-                       goto getres_err;
-                   }
-               (void)strcpy(hp->h_name, rptr->re_he.h_name);
-           }
-#ifdef ARLIB_DEBUG
-       ar_dump_hostent("ar_answer: (snap) store name", hp);
-#endif
-
-       /*
-        * Count IP#'s.
-        */
-       for (i = 0, n = 0; i < MAXADDRS; i++, n++)
-               if (!rptr->re_he.h_addr_list[i].s_addr)
-                       break;
-       s = hp->h_addr_list = (char **)malloc((n + 1) * sizeof(char *));
-       if (n)
-           {
-               *s = (char *)malloc(n * sizeof(struct in_addr));
-               if(!*s)
-                   {
-#ifdef ARLIB_DEBUG
-                       fprintf(stderr, "no memory for IP#'s (%d)\n", n);
-#endif
-                       h_errno = TRY_AGAIN;
-                       goto getres_err;
-                   }
-               bcopy((char *)&rptr->re_he.h_addr_list[0].s_addr, *s,
-                       sizeof(struct in_addr));
-               s++;
-               for (i = 1; i < n; i++, s++)
-                   {
-                       *s = hp->h_addr + i * sizeof(struct in_addr);
-                       bcopy((char *)&rptr->re_he.h_addr_list[i].s_addr, *s,
-                               sizeof(struct in_addr));
-                   }
-           }
-       *s = NULL;
-#ifdef ARLIB_DEBUG
-       ar_dump_hostent("ar_answer: (snap) store IP#'s", hp);
-#endif
-
-       /*
-        * Count CNAMEs
-        */
-       for (i = 0, n = 0; i < MAXADDRS; i++, n++)
-               if (!rptr->re_he.h_aliases[i])
-                       break;
-       s = hp->h_aliases = (char **)malloc((n + 1) * sizeof(char *));
-       if (!s)
-           {
-#ifdef ARLIB_DEBUG
-               fprintf(stderr, "no memory for aliases (%d)\n", n);
-#endif
-               h_errno = TRY_AGAIN;
-               goto getres_err;
-           }
-       for (i = 0; i < n; i++)
-           {
-               *s++ = rptr->re_he.h_aliases[i];
-               rptr->re_he.h_aliases[i] = NULL;
-           }
-       *s = NULL;
-#ifdef ARLIB_DEBUG
-       ar_dump_hostent("ar_answer: (snap) store CNAMEs", hp);
-       ar_dump_hostent("ar_answer: new one", hp);
-#endif
-
-       if (a > 0)
-               (void)ar_remrequest(rptr);
-       else
-               if (!rptr->re_sent)
-                       (void)ar_remrequest(rptr);
-       return hp;
-
-getres_err:
-       if (rptr)
-           {
-               if (reip && rptr->re_rinfo.ri_ptr && size)
-                       bcopy(rptr->re_rinfo.ri_ptr, reip,
-                               MIN(rptr->re_rinfo.ri_size, size));
-               if ((h_errno != TRY_AGAIN) &&
-                   (_res.options & (RES_DNSRCH|RES_DEFNAMES) ==
-                    (RES_DNSRCH|RES_DEFNAMES) ))
-                       if (_res.dnsrch[rptr->re_srch])
-                           {
-                               rptr->re_retries = _res.retry;
-                               rptr->re_sends = 1;
-                               rptr->re_resend = 1;
-                               (void)ar_resend_query(rptr);
-                               rptr->re_srch++;
-                           }
-               return NULL;
-           }
-       return NULL;
-}
-
-
-#ifdef ARLIB_DEBUG
-void ar_dump_hostent(prefix, hp)
-char *prefix;
-struct hostent *hp;
-{
-       register char **s;
-
-       fflush(stdout);
-
-       fprintf(stderr, "%s\n", prefix);
-       fprintf(stderr, "  hp %p\n", hp);
-       fprintf(stderr, "    h_name %p '%s'\n",
-       hp->h_name, hp->h_name);
-       if (s = hp->h_aliases)
-           {
-               fprintf(stderr, "    h_aliases %p\n",
-               hp->h_aliases);
-               while (*s)
-                   {
-                       fprintf(stderr, "      element %p\n", *s);
-                       s++;
-                   }
-           }
-       if (s = hp->h_addr_list)
-           {
-               fprintf(stderr, "    h_addr_list %p\n",
-               hp->h_addr_list);
-               while (*s)
-                   {
-                       fprintf(stderr, "      element %p\n", *s);
-                       s++;
-                   }
-           }
-
-       fflush(stderr);
-}
-
-
-void ar_dump_reslist(FILE* fp)
-{
-       register struct reslist *rptr;
-       int c;
-
-       c = 0;
-       for (rptr = ar_first; rptr; rptr = rptr->re_next)
-           {
-               fprintf(fp, "%4d [%p] %4d [%p]: %s\n", rptr->re_id, rptr,
-                       *(rptr->re_rinfo.ri_ptr), rptr->re_rinfo.ri_ptr,
-                       rptr->re_name);
-           }
-}
-#endif
diff --git a/arlib/arlib.h b/arlib/arlib.h
deleted file mode 100644 (file)
index a295b88..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * arlib.h (C)opyright 1992 Darren Reed.
- */
-
-#define        ARES_INITLIST   1
-#define        ARES_CALLINIT   2
-#define ARES_INITSOCK  4
-#define ARES_INITDEBG  8
-#define ARES_INITCACH  16
-
-#ifdef __STDC__
-extern struct  hostent *ar_answer(char *, int);
-extern void    ar_close();
-extern int     ar_delete(char *, int);
-extern int     ar_gethostbyname(char *, char *, int);
-extern int     ar_gethostbyaddr(char *, char *, int);
-extern int     ar_init(int);
-extern int     ar_open();
-extern long    ar_timeout(time_t, char *, int);
-#else
-extern struct  hostent *ar_answer();
-extern void    ar_close();
-extern int     ar_delete();
-extern int     ar_gethostbyname();
-extern int     ar_gethostbyaddr();
-extern int     ar_init();
-extern int     ar_open();
-extern long    ar_timeout();
-#endif
diff --git a/arlib/arplib.h b/arlib/arplib.h
deleted file mode 100644 (file)
index 8f905d1..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * arplib.h (C)opyright 1992 Darren Reed.
- */
-
-#define MAXPACKET      1024
-#define MAXALIASES     35
-#define MAXADDRS       35
-
-#define        RES_CHECKPTR    0x0400
-
-struct hent {
-       char    *h_name;        /* official name of host */
-       char    *h_aliases[MAXALIASES]; /* alias list */
-       int     h_addrtype;     /* host address type */
-       int     h_length;       /* length of address */
-       /* list of addresses from name server */
-       struct  in_addr h_addr_list[MAXADDRS];
-#define        h_addr  h_addr_list[0]  /* address, for backward compatiblity */
-};
-
-struct resinfo {
-       char    *ri_ptr;
-       int     ri_size;
-};
-
-struct reslist {
-       int     re_id;
-       char    re_type;
-       char    re_retries;
-       char    re_resend;      /* send flag. 0 == dont resend */
-       char    re_sends;
-       char    re_srch;
-       int     re_sent;
-       u_long  re_sentat;
-       u_long  re_timeout;
-       struct  in_addr re_addr;
-       struct  resinfo re_rinfo;
-       struct  hent re_he;
-       struct  reslist *re_next, *re_prev;
-       char    re_name[65];
-};
-
-#ifndef        MIN
-#define        MIN(a,b)        ((a) > (b) ? (b) : (a))
-#endif
diff --git a/arlib/configure.in b/arlib/configure.in
deleted file mode 100644 (file)
index 5335bb8..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-# Process this file with autoconf to produce a configure script.
-AC_INIT
-AM_INIT_AUTOMAKE(arlib, 1.0)
-AC_CONFIG_SRCDIR([arlib.c])
-#AM_CONFIG_HEADER([config.h])
-
-# Checks for programs.
-AC_PROG_CC
-AC_PROG_RANLIB
-
-# Checks for libraries.
-AC_CHECK_FUNC([gethostent], ,
-       [AC_SEARCH_LIBS([gethostent], [nsl], , , [-lsocket])])
-AC_SEARCH_LIBS([setsockopt], [socket xnet])
-AC_SEARCH_LIBS([res_init], [resolv], , , [-lsocket -lnsl])
-AC_CHECK_FUNCS(res_init __res_init)
-
-
-# Checks for header files.
-dnl AC_CHECK_HEADERS([errno.h fcntl.h netdb.h netinet/in.h strings.h sys/socket.h sys/time.h])
-
-# Checks for typedefs, structures, and compiler characteristics.
-dnl AC_HEADER_TIME
-
-AC_CHECK_TYPE(u_int32_t, ,
-       [AC_DEFINE(u_int32_t, [unsigned int], [Unsigned 32-bit type])],[
-#include <sys/types.h>
-#include <netinet/in.h>])
-
-AC_CACHE_CHECK([for name of NS address list], [ac_cv_var_ns_addr_list],
-       [ac_cv_var_ns_addr_list=''
-# Normal
-AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>], [ return sizeof(_res.nsaddr_list);],
-[ac_cv_var_ns_addr_list=nsaddr_list],
-[# Ultrix
-AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>], [ return sizeof(_res.ns_list);],
-[ac_cv_var_ns_addr_list=ns_list])])
-       case "$ac_cv_var_ns_addr_list" in
-        '') AC_MSG_RESULT([???])
-            AC_MSG_ERROR([Can't find nameserver address list in _res])
-            ;;
-       esac])
-AC_DEFINE_UNQUOTED(NS_ADDR_LIST, $ac_cv_var_ns_addr_list, [The name of the NS address list in _res])
-
-# Checks for library functions.
-dnl AC_HEADER_STDC
-dnl AC_FUNC_MALLOC
-dnl AC_CHECK_FUNCS([bzero inet_ntoa select socket])
-
-AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
diff --git a/arlib/sample.c b/arlib/sample.c
deleted file mode 100644 (file)
index 83db6a8..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-#include <stdio.h>
-#include <strings.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <netinet/in.h>
-#include <netdb.h>
-#include "arlib.h"
-
-#ifndef        lint
-static char    sccsid[] = "@(#)sample.c        1.1 12/21/92 (C)1992 Darren Reed. ASYNC DNS";
-#endif
-
-char   line[512];
-
-int    lookup = 0, seq = 0;
-long   expire = 0;
-
-main()
-{
-       struct  in_addr adr;
-       struct  timeval tv2;
-       fd_set  rd;
-       long    now;
-       char    *s;
-       int     afd, nfd, pid = getpid(), del;
-
-       afd = ar_init(ARES_INITLIST|ARES_CALLINIT|ARES_INITSOCK);
-
-       (void)printf("afd = %d pid = %d\n",afd, pid);
-
-       while (1)
-       {
-               (void)printf("Host =>");
-               (void)fflush(stdout);
-               *line = '\0';
-               FD_ZERO(&rd);
-               FD_SET(0,&rd);
-               FD_SET(afd,&rd);
-               now = time(NULL);
-               if (expire >= now)
-                   {
-                       tv2.tv_usec = 0;
-                       tv2.tv_sec = expire - now;
-                       nfd = select(FD_SETSIZE, &rd, NULL, NULL, &tv2);
-                   }
-               else
-                       nfd = select(FD_SETSIZE, &rd, NULL, NULL, NULL);
-
-               if (FD_ISSET(0, &rd))
-               {
-                       if (!fgets(line, sizeof(line) - 1, stdin))
-                               exit(0);
-                       if (s = index(line, '\n'))
-                               *s = '\0';
-               }
-
-               if (isalpha(*line))
-               {
-                       (void)printf("Asking about [%s] #%d.\n",line, ++seq);
-                       (void)ar_gethostbyname(line, (char *)&seq,
-                                              sizeof(seq));
-                       lookup++;
-               }
-               else if (isdigit(*line))
-               {
-                       (void)printf("Asking about IP#[%s] #%d.\n",
-                               line, ++seq);
-                       adr.s_addr = inet_addr(line);
-                       (void)ar_gethostbyaddr(&adr, (char *)&seq,
-                                              sizeof(seq));
-                       lookup++;
-               }
-               if (lookup)
-                       (void)printf("Waiting for answer:\n");
-               if (FD_ISSET(afd, &rd))
-                       (void)waitonlookup(afd);
-               del = 0;
-               expire = ar_timeout(time(NULL), &del, sizeof(del));
-               if (del)
-               {
-                       (void)fprintf(stderr,"#%d failed\n", del);
-                       lookup--;
-               }
-       }
-}
-
-printhostent(hp)
-struct hostent *hp;
-{
-       struct in_addr ip;
-       int i;
-
-       (void)printf("hname = %s\n", hp->h_name);
-       for (i = 0; hp->h_aliases[i]; i++)
-               (void)printf("alias %d = %s\n", i+1, hp->h_aliases[i]);
-       for (i = 0; hp->h_addr_list[i]; i++)
-       {
-               bcopy(hp->h_addr_list[i], (char *)&ip, sizeof(ip));
-               (void)printf("IP# %d = %s\n", i+1, inet_ntoa(ip));
-       }
-}
-
-int    waitonlookup(afd)
-int    afd;
-{
-       struct  timeval delay;
-       struct  hostent *hp;
-       fd_set  rd;
-       long    now;
-       int     nfd, del;
-
-waitloop:
-       FD_ZERO(&rd);
-       now = time(NULL);
-       if (expire >= now)
-               delay.tv_sec = expire - now;
-       else
-               delay.tv_sec = 1;
-       delay.tv_usec = 0;
-       FD_SET(afd, &rd);
-       FD_SET(0, &rd);
-
-       nfd = select(FD_SETSIZE, &rd, 0, 0, &delay);
-       if (nfd == 0)
-               return 0;
-       else if (FD_ISSET(afd, &rd))
-       {
-               del = 0;
-               hp = ar_answer(&del, sizeof(del));
-
-               (void)printf("hp=%x seq=%d\n",hp,del);
-               if (hp)
-                   {
-                       (void)printhostent(hp);
-                       if (!--lookup)
-                               return 1;
-                   }
-       }
-       if (FD_ISSET(0, &rd))
-               return 2;
-       return 0;
-}
index 42c37f7b02f5f517025773a0af760a6ee510000b..021e793c0517802d2c81063eb34ab56c6e59e0b7 100644 (file)
@@ -216,22 +216,16 @@ BINSUBDIR=$use_binsubdir
 AC_SUBST(BINSUBDIR)
 AM_CONDITIONAL(NTP_BINSUBDIR_IS_BIN, test "bin" = "$BINSUBDIR")
 
-AC_MSG_CHECKING([if we want to use arlib])
-AC_ARG_WITH(arlib,
-       AC_HELP_STRING([--with-arlib], [- Compile the async resolver library?]),
+AC_MSG_CHECKING([for deprecated --with-arlib])
+AC_ARG_WITH([arlib],
+       AC_HELP_STRING([--with-arlib], [- deprecated, arlib not distributed]),
        [ans=$withval], [ans=no])
 AC_MSG_RESULT([$ans])
 
-if test -d $srcdir/arlib
-then
-    case "$ans" in
-     yes)
-       ARLIB_DIR=arlib
-       AC_CONFIG_SUBDIRS(arlib)
-       ;;
-    esac
-fi
-AC_SUBST(ARLIB_DIR)
+case "$ans" in
+ yes)
+    AC_MSG_WARN([Please do not use --with-arlib, arlib is no longer included.  In the future, --with-arlib will not be recognized.])
+esac
 
 AC_ARG_WITH(rpath,
        AC_HELP_STRING([--without-rpath], [s Disable auto-added -R linker paths]),