From fa6cbdb06d05f71e1da0b189fee4265bc03a8884 Mon Sep 17 00:00:00 2001 From: David Schweikert Date: Fri, 9 Dec 2011 19:58:41 -0500 Subject: [PATCH 1/1] Import version 2.4b2_to-ipv6 --- COPYING | 15 + ChangeLog | 312 +++++ INSTALL | 185 +++ Makefile.am | 5 + Makefile.in | 397 ++++++ README | 64 + acconfig.h | 18 + aclocal.m4 | 127 ++ config.h.in | 40 + configure | 3258 +++++++++++++++++++++++++++++++++++++++++++++++++ configure.in | 32 + fping.8 | 220 ++++ fping.c | 2742 +++++++++++++++++++++++++++++++++++++++++ install-sh | 238 ++++ linux.h | 133 ++ missing | 190 +++ mkinstalldirs | 36 + options.h | 54 + stamp-h.in | 1 + 19 files changed, 8067 insertions(+) create mode 100755 COPYING create mode 100755 ChangeLog create mode 100755 INSTALL create mode 100755 Makefile.am create mode 100755 Makefile.in create mode 100755 README create mode 100755 acconfig.h create mode 100755 aclocal.m4 create mode 100755 config.h.in create mode 100755 configure create mode 100755 configure.in create mode 100755 fping.8 create mode 100755 fping.c create mode 100755 install-sh create mode 100755 linux.h create mode 100755 missing create mode 100755 mkinstalldirs create mode 100755 options.h create mode 100755 stamp-h.in diff --git a/COPYING b/COPYING new file mode 100755 index 0000000..4210b35 --- /dev/null +++ b/COPYING @@ -0,0 +1,15 @@ + +/* + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Stanford University. The name of the University may not be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ + diff --git a/ChangeLog b/ChangeLog new file mode 100755 index 0000000..83c4843 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,312 @@ +Wed Jan 16 2002 +Jeroen Massar +- Revision v2.4b2-to-IPv6 + - Added IPv6 support. + - Added -I option for selecting source IPv4/IPv6 address. + - Makefile.in now generates a Makefile which will build both + fping (IPv4) and fping6 (IPv6). Thus it makes an fping (IPv4 only) + and an fping6 (IPv6 only). + - num_unreachable was counted twice when a sendto() generated errors. + - See http://unfix.org/projects/ipv6/ + +Tue Mar 14 2001 +Jason Ewasiuk +- Revision v2.4b1 + - added -g option for generating IPs from a start to an end value + - two available options, generate IPs from start IP to end IP + or from a passed netmask, such as 192.168.1.0/24 + +Thu Feb 15 2001 +Jason Ewasiuk +- Revision v2.3b1 + - formatting changes to code layout (fping.c) + NOTE: Best viewed with a tab stop of 4 + - merged in changes from Debian c/o Herbert Xu + + - Compilation fix on alphas with glibc + - Alignment issues (note from JE: in wait_for_reply()) + - A typo with the time specified on the command line + (note from JE: bug was using 10 instead of 100) + - Drop privileges after obtaining socket + (note from JE: might be moot, since prog exits if + user is not root) + - touched all files in package to this date + - couple new #ifdefs added for future WIN32 support + (Haven't got to adding this yet, will take a lot of rewriting.) + +Fri Dec 8 10:33:13 2000 Roland Schemers + + * stop using sys_errlist and start using strerror + fixed bug in output of -C + +Wed Jan 8 11:18:37 1997 Roland Schemers + + * Created ChangeLog file. What follows was from the CHANGES file. + +* Revision 2.0 1994/10/31 21:26:23 morgan + + Substantial rewrite, including new features: + + support some traditional ping features: + loop mode + specify size of data packets + specify how many pings to send + show per-response data + interpret ICMPs other than ICMP Echo response + + also + + rewrote main loop completely + make timings in tenths of milliseconds + do exponential backoff on retries + port to more systems + add some debugging stuff + do better checking on whether received ICMP is for us + +* Revision 1.24 1993/12/10 23:11:39 schemers + + commented out seteuid(getuid()) since it isn't needed + +* Revision 1.23 1993/12/10 18:33:41 schemers + + Took out the -f option for non-root users. This can be enabled by + defining ENABLE_F_OPTION before compiling. There is a call to + access before opening the file, but there is a race condition. + Reading from stdin is much safer. + + +* Revision 1.22 1993/11/16 19:49:24 schemers + + Took out setuid(getuid()) and used access() system call to + check for access to the file specified with "-f". + +* Revision 1.21 1993/07/20 18:08:19 schemers + + commented out the test to make sure the ping packet came from the + same IP address as the one we sent to. This could cause problems on + multi-homed hosts. + +* Revision 1.20 1993/02/23 00:16:38 schemers + +fixed syntax error (should have compiled before checking in...) + +* Revision 1.19 1993/02/23 00:15:15 schemers + +turned off printing of "is alive" when -a is specified. + +* Revision 1.18 1992/07/28 15:16:44 schemers + +added a fflush(stdout) call before the summary is sent to stderr, so +everything shows up in the right order. + +* Revision 1.17 1992/07/23 03:29:42 schemers +* Revision 1.16 1992/07/22 19:24:37 schemers + +Fixed declaration of timeval_diff. Didn't notice the problem because +I use 'cc' in stead of gcc under Ultrix. Time to switch? :-) + +Modified file reaing so it would skip blank lines or lines starting +with a '#'. Now you can do something like: + +fping -ad < /etc/hosts + +* Revision 1.15 1992/07/21 17:07:18 schemers + +Put in sanity checks so only root can specify "dangerous" options. +Changed usage to show switchs in alphabetical order. +* Revision 1.14 1992/07/21 16:40:52 schemers +* Revision 1.13 1992/07/17 21:02:17 schemers + +Changed the default timeout to 2500 msec, and retry to 3. This was +due to suggestions from people with slow (WAN) networks. The default +1 sec timeout was too fast. + + +Added '-e' option for showing elapsed (round-trip) times on pakets, and +modified the -s option to include min, max, and average round-trip times, +and over all elapsed time. + +Modified action taken when a error is returned from sendto. The action +taken now considers the host unreachable and prints the hostname +followed by the errno message. The program will not exit and will continue +to try other hosts. + +* Revision 1.12 1992/07/17 16:38:54 schemers +* Revision 1.11 1992/07/17 16:28:38 schemers + + move socket create call so I could do a setuid(getuid()) before the + fopen call is made. Once the socket is created root privs aren't needed + to send stuff out on it. + + moved num_timeout counter. It really was for debug purposes and didn't + make sense to the general public :-) Now it is the number of timeouts + (pings that didn't get received with the time limit). + + +* Revision 1.10 1992/07/16 16:24:38 schemers +* Revision 1.9 1992/07/16 16:00:04 schemers +* Revision 1.8 1992/07/16 05:44:41 schemers + +Added _NO_PROTO stuff for older compilers, and _POSIX_SOURCE +for unistd.h, and _POSIX_SOURCE for stdlib.h. Also added +check for __cplusplus. + +Now compiles ok under Ultrix 3.1, and Sun4 using cc. Also compiled +ok using g++ 2.2.2. + +Changed '-a' and '-u' flags to be mutually exclusive (makes sense, since +specifiying both '-a' and '-u' is the same as not specifiying anything. +Since '-a' and '-u' are mutually exclusive, these options now only print +the hostname, and not the 'is alive' or 'is unreachable' messages. +This makes it much easier to do stuff like: + +#!/usr/local/bin/perl +$hosts_to_backup=`cat /etc/hosts.backup|fping -a`; + +Since you don't have to strip off the 'is alive' messages. + +Changed usage to and stats to print to stderr instead of stdout. + +----------------------------------------------------------------------------- + +RCS header info from original fping.c package (no longer required) + +/* + *************************************************** + * + * Standard RCS Header information (see co(1)) + * + * $Author: schemers $ + * + * $Date: 1997/01/08 20:29:33 $ + * + * $Revision: 2.2 $ + * + * $Locker: $ + * + * $Source: /afs/ir/group/networking/src/fping/fping-2.2/src/RCS/fping.c,v $ + * + * $State: Exp $ + * + * $Log: fping.c,v $ + * + * Revision 2.2 1997/01/08 20:29:33 schemers + * changes for autoconf/automake + * + * Revision 2.1 1997/01/08 19:07:18 schemers + * checked in RL "Bob"'s changes before configure'ing + * + * Revision 2.0 1994/10/31 21:26:23 schemers + * many changes by RL "Bob" Morgan + * add timing data collection, loop mode, per-packet output, etc + * + * Revision 1.24 1993/12/10 23:11:39 schemers + * commented out seteuid(getuid()) since it isn't needed + * + * Revision 1.23 1993/12/10 18:33:41 schemers + * Took out the -f option for non-root users. This can be enabled by + * defining ENABLE_F_OPTION before compiling. There is a call to + * access before opening the file, but there is a race condition. + * Reading from stdin is much safer. + * + * Revision 1.22 1993/11/16 19:49:24 schemers + * Took out setuid(getuid()) and used access() system call to + * check for access to the file specified with "-f". + * + * Revision 1.21 1993/07/20 18:08:19 schemers + * commented out the test to make sure the ping packet came from the + * same IP address as the one we sent to. This could cause problems on + * multi-homed hosts. + * + * Revision 1.20 1993/02/23 00:16:38 schemers + * fixed syntax error (should have compiled before checking in...) + * + * Revision 1.19 1993/02/23 00:15:15 schemers + * turned off printing of "is alive" when -a is specified. + * + * Revision 1.18 1992/07/28 15:16:44 schemers + * added a fflush(stdout) call before the summary is sent to stderr, so + * everything shows up in the right order. + * + * Revision 1.17 1992/07/23 03:29:42 schemers + * fixed declaration of timeval_diff. + * + * Revision 1.16 1992/07/22 19:24:37 schemers + * Modified file reading so it would skip blanks lines or lines starting + * with a '#'. Now you can do something like: + * + * fping -ad < /etc/hosts + * + * Revision 1.15 1992/07/21 17:07:18 schemers + * Put in sanity checks so only root can specify "dangerous" options. + * Changed usage to show switchs in alphabetical order. + * + * Revision 1.14 1992/07/21 16:40:52 schemers + * Now when sendto returns an error, the host is considered unreachable and + * and the error message (from errno) is displayed. + * + * Revision 1.13 1992/07/17 21:02:17 schemers + * changed default timeout to 2500 msec (for WANs), and default try + * to 3. This gives 10 second overall timeout. + * + * Added -e option for showing elapsed (round-trip) time on packets + * + * Modified -s option to inlude to round-trip stats + * + * Added #ifndef DEFAULT_* stuff its easier to change the defaults + * + * Reorganized main loop. + * + * cleaned up timeval stuff. removed set_timeval and timeval_expired + * since they aren't needed anymore. Just use timeval_diff. + * + * Revision 1.12 1992/07/17 16:38:54 schemers + * move socket create call so I could do a setuid(getuid()) before the + * fopen call is made. Once the socket is created root privs aren't needed + * to send stuff out on it. + * + * Revision 1.11 1992/07/17 16:28:38 schemers + * moved num_timeout counter. It really was for debug purposes and didn't + * make sense to the general public :-) Now it is the number of timeouts + * (pings that didn't get received with the time limit). + * + * Revision 1.10 1992/07/16 16:24:38 schemers + * changed usage() to use fprintf(stderr,"..."); + * + * Revision 1.9 1992/07/16 16:00:04 schemers + * Added _NO_PROTO stuff for older compilers, and _POSIX_SOURCE + * for unistd.h, and _POSIX_SOURCE for stdlib.h. Also added + * check for __cplusplus. + * + * Revision 1.8 1992/07/16 05:44:41 schemers + * changed -a and -u to only show hostname in results. This is + * for easier parsing. Also added -v flag + * + * Revision 1.7 1992/07/14 18:45:23 schemers + * initialized last_time in add_host function + * + * Revision 1.6 1992/07/14 18:32:40 schemers + * changed select to use FD_ macros + * + * Revision 1.5 1992/07/14 17:21:22 schemers + * standardized exit status codes + * + * Revision 1.4 1992/06/26 15:25:35 schemers + * changed name from rrping to fping + * + * Revision 1.3 1992/06/24 15:39:32 schemers + * added -d option for unreachable systems + * + * Revision 1.2 1992/06/23 03:01:23 schemers + * misc fixes from R.L. "Bob" Morgan + * + * Revision 1.1 1992/06/19 18:23:52 schemers + * Initial revision + * + *-------------------------------------------------- + * Copyright (c) 1992, 1994, 1997 Board of Trustees + * Leland Stanford Jr. University + *************************************************** + */ + + diff --git a/INSTALL b/INSTALL new file mode 100755 index 0000000..24566b5 --- /dev/null +++ b/INSTALL @@ -0,0 +1,185 @@ +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 a while. 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. + + 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. + +`--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. + + +Problems and Notes +================== + +Apr 2001 +- Making fping requires 'm4' and 'autoheader' +- fping is known not to build on Solaris. (Solaris lacks 'autoheader') +- fping has been reported to bug out if a file contains more than 3600 addresses to scan. +- If you are having problems compiling, try an earlier version (2.2b2 for example) diff --git a/Makefile.am b/Makefile.am new file mode 100755 index 0000000..1341eda --- /dev/null +++ b/Makefile.am @@ -0,0 +1,5 @@ +sbin_PROGRAMS = fping +fping_SOURCES = fping.c options.h linux.h +man_MANS = fping.8 +AUTOMAKE_OPTIONS=foreign +EXTRA_DIST = $(man_MANS) diff --git a/Makefile.in b/Makefile.in new file mode 100755 index 0000000..f6b6716 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,397 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = . + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +CC = @CC@ +CPP = @CPP@ +MAKEINFO = @MAKEINFO@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +sbin_PROGRAMS = fping +fping_SOURCES = fping.c options.h linux.h +man_MANS = fping.8 +AUTOMAKE_OPTIONS = foreign +EXTRA_DIST = $(man_MANS) +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(sbin_PROGRAMS) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +fping_OBJECTS = fping.o +fping_LDADD = $(LDADD) +fping_DEPENDENCIES = +fping_LDFLAGS = +CFLAGS = @CFLAGS@ +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +man8dir = $(mandir)/man8 +MANS = $(man_MANS) + +NROFF = nroff +DIST_COMMON = README ./stamp-h.in COPYING ChangeLog INSTALL Makefile.am \ +Makefile.in acconfig.h aclocal.m4 config.h.in configure configure.in \ +install-sh missing mkinstalldirs + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP_ENV = --best +SOURCES = $(fping_SOURCES) +OBJECTS = $(fping_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .o .s +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(ACLOCAL_M4): configure.in + cd $(srcdir) && $(ACLOCAL) + +config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck +$(srcdir)/configure: $(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) + cd $(srcdir) && $(AUTOCONF) + +config.h: stamp-h + @if test ! -f $@; then \ + rm -f stamp-h; \ + $(MAKE) stamp-h; \ + else :; fi +stamp-h: $(srcdir)/config.h.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES= CONFIG_HEADERS=config.h \ + $(SHELL) ./config.status + @echo timestamp > stamp-h 2> /dev/null +$(srcdir)/config.h.in: $(srcdir)/stamp-h.in + @if test ! -f $@; then \ + rm -f $(srcdir)/stamp-h.in; \ + $(MAKE) $(srcdir)/stamp-h.in; \ + else :; fi +$(srcdir)/stamp-h.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h + cd $(top_srcdir) && $(AUTOHEADER) + @echo timestamp > $(srcdir)/stamp-h.in 2> /dev/null + +mostlyclean-hdr: + +clean-hdr: + +distclean-hdr: + -rm -f config.h + +maintainer-clean-hdr: + +mostlyclean-sbinPROGRAMS: + +clean-sbinPROGRAMS: + -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) + +distclean-sbinPROGRAMS: + +maintainer-clean-sbinPROGRAMS: + +install-sbinPROGRAMS: $(sbin_PROGRAMS) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(sbindir) + @list='$(sbin_PROGRAMS)'; for p in $$list; do \ + if test -f $$p; then \ + echo " $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \ + $(INSTALL_PROGRAM) $$p $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + else :; fi; \ + done + +uninstall-sbinPROGRAMS: + @$(NORMAL_UNINSTALL) + list='$(sbin_PROGRAMS)'; for p in $$list; do \ + rm -f $(DESTDIR)$(sbindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \ + done + +.c.o: + $(COMPILE) -c $< + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +fping: $(fping_OBJECTS) $(fping_DEPENDENCIES) + @rm -f fping + $(LINK) $(fping_LDFLAGS) $(fping_OBJECTS) $(fping_LDADD) $(LIBS) + +install-man8: + $(mkinstalldirs) $(DESTDIR)$(man8dir) + @list='$(man8_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.8*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst"; \ + $(INSTALL_DATA) $$file $(DESTDIR)$(man8dir)/$$inst; \ + done + +uninstall-man8: + @list='$(man8_MANS)'; \ + l2='$(man_MANS)'; for i in $$l2; do \ + case "$$i" in \ + *.8*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f $(DESTDIR)$(man8dir)/$$inst"; \ + rm -f $(DESTDIR)$(man8dir)/$$inst; \ + done +install-man: $(MANS) + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-man8 +uninstall-man: + @$(NORMAL_UNINSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-man8 + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)config.h.in$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags config.h.in $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + -rm -rf $(distdir) + GZIP=$(GZIP_ENV) $(TAR) zxf $(distdir).tar.gz + mkdir $(distdir)/=build + mkdir $(distdir)/=inst + dc_install_base=`cd $(distdir)/=inst && pwd`; \ + cd $(distdir)/=build \ + && ../configure --srcdir=.. --prefix=$$dc_install_base \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) dist + -rm -rf $(distdir) + @banner="$(distdir).tar.gz is ready for distribution"; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes" +dist: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +dist-all: distdir + -chmod -R a+r $(distdir) + GZIP=$(GZIP_ENV) $(TAR) chozf $(distdir).tar.gz $(distdir) + -rm -rf $(distdir) +distdir: $(DISTFILES) + -rm -rf $(distdir) + mkdir $(distdir) + -chmod 777 $(distdir) + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$d/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +all-recursive-am: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +install-exec-am: install-sbinPROGRAMS +install-exec: install-exec-am + +install-data-am: install-man +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-sbinPROGRAMS uninstall-man +uninstall: uninstall-am +all-am: Makefile $(PROGRAMS) $(MANS) config.h +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8 + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-hdr mostlyclean-sbinPROGRAMS \ + mostlyclean-compile mostlyclean-tags \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-hdr clean-sbinPROGRAMS clean-compile clean-tags \ + clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-hdr distclean-sbinPROGRAMS distclean-compile \ + distclean-tags distclean-generic clean-am + +distclean: distclean-am + -rm -f config.status + +maintainer-clean-am: maintainer-clean-hdr maintainer-clean-sbinPROGRAMS \ + maintainer-clean-compile maintainer-clean-tags \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + -rm -f config.status + +.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \ +mostlyclean-sbinPROGRAMS distclean-sbinPROGRAMS clean-sbinPROGRAMS \ +maintainer-clean-sbinPROGRAMS uninstall-sbinPROGRAMS \ +install-sbinPROGRAMS mostlyclean-compile distclean-compile \ +clean-compile maintainer-clean-compile install-man8 uninstall-man8 \ +install-man uninstall-man tags mostlyclean-tags distclean-tags \ +clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \ +check-am installcheck-am installcheck all-recursive-am install-exec-am \ +install-exec install-data-am install-data install-am install \ +uninstall-am uninstall all-redirect all-am all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/README b/README new file mode 100755 index 0000000..08a7ca6 --- /dev/null +++ b/README @@ -0,0 +1,64 @@ +fping README +------------ + +Current maintainer: + +David Papp - david@remote.net + + +fping website: http://www.fping.com + + +Original author: Roland Schemers (schemers@stanford.edu) +Previous maintainer: RL "Bob" Morgan (morgan@stanford.edu) +IPv6 Support: Jeroen Massar (jeroen@unfix.org / jeroen@ipng.nl) + + +Suggestions and patches: + +.... + +------------------------------------------------------------------------------ + +Original README from 1992! 5 years ago? Time flies... + + fping - A tool to quickly ping N number of hosts to determine + their reachability. + + Roland J. Schemers III - Stanford University + schemers@Stanford.EDU + + fping is a ping(1) like program which uses the Internet Control + Message Protocol (ICMP) echo request to determine if a host is + up. fping is different from ping in that you can specify any + number of hosts on the command line, or specify a file containing + the lists of hosts to ping. Instead of trying one host until it + timeouts or replies, fping will send out a ping packet and move + on to the next host in a round-robin fashion. If a host replies, + it is noted and removed from the list of hosts to check. If a host + does not respond within a certain time limit and/or retry limit it + will be considered unreachable. + +Site + Stanford University has a large TCP/IP network with over 16,000 + assigned IP addresses and over 100 IP subnets. + +Problem and Issues + + With a large a number of IP addresses in use, its becomes more and + more time consuming to check on which IP addresses are actively + in use, and which critical machines (routers, bridges, servers, etc) + are reachable. One example is we have a program which goes through + all of our routers arp caches looking for IP addresses that are in + use. After finding a list of IP addresses that aren't in any arp + caches fping can then be used to see if these IP addresses really + aren't being used, or are just behind the routers. Checking 2500 + hosts (99% of which are unreachable) via ping can take hours. + + fping was written to solve the problem of pinging N number of hosts + in an efficient manner. By sending out pings in a round-robin fashion + and checking on responses as they come in at random, a large number of + hosts can be checked at once. + + Unlike ping, fping is meant to be used in scripts and its + output is easy to parse. diff --git a/acconfig.h b/acconfig.h new file mode 100755 index 0000000..e623979 --- /dev/null +++ b/acconfig.h @@ -0,0 +1,18 @@ +#ifndef CONFIG_H +#define CONFIG_H + +@TOP@ + +/* VERSION (from configure.in) */ +#undef VERSION + + +@BOTTOM@ + +/* some OSes do not define this ... lets take a wild guess */ + +#ifndef INADDR_NONE +# define INADDR_NONE 0xffffffffU +#endif + +#endif /* CONFIG_H */ diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100755 index 0000000..f23ba29 --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,127 @@ +dnl aclocal.m4 generated automatically by aclocal 1.4 + +dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without +dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A +dnl PARTICULAR PURPOSE. + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AC_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) +AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])) +AC_REQUIRE([AM_SANITY_CHECK]) +AC_REQUIRE([AC_ARG_PROGRAM]) +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_REQUIRE([AC_PROG_MAKE_SET])]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "[$]*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "[$]*" != "X $srcdir/configure conftestfile" \ + && test "[$]*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + diff --git a/config.h.in b/config.h.in new file mode 100755 index 0000000..712dc0c --- /dev/null +++ b/config.h.in @@ -0,0 +1,40 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ +#ifndef CONFIG_H +#define CONFIG_H + + +/* VERSION (from configure.in) */ +#undef VERSION + +/* Define if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_FILE_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define if you have the nsl library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the socket library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Name of package */ +#undef PACKAGE + +/* Version number of package */ +#undef VERSION + + +/* some OSes do not define this ... lets take a wild guess */ + +#ifndef INADDR_NONE +# define INADDR_NONE 0xffffffffU +#endif + +#endif /* CONFIG_H */ diff --git a/configure b/configure new file mode 100755 index 0000000..31da3b3 --- /dev/null +++ b/configure @@ -0,0 +1,3258 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by Autoconf 2.50. +# +# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +# Name of the host. +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +cross_compiling=no +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Avoid depending upon Character Ranges. +ac_cr_az='abcdefghijklmnopqrstuvwxyz' +ac_cr_AZ='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +ac_cr_09='0123456789' +ac_cr_alnum=$ac_cr_az$ac_cr_AZ$ac_cr_09 + +# Sed expression to map a string onto a valid sh and CPP variable names. +ac_tr_sh="sed y%*+%pp%;s%[^_$ac_cr_alnum]%_%g" +ac_tr_cpp="sed y%*$ac_cr_az%P$ac_cr_AZ%;s%[^_$ac_cr_alnum]%_%g" + +ac_unique_file="fping.c" + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Identity of this package. +PACKAGE_NAME= +PACKAGE_TARNAME= +PACKAGE_VERSION= +PACKAGE_STRING= +PACKAGE_BUGREPORT= + +ac_prev= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + eval "enable_$ac_feature=no" ;; + + -enable-* | --enable-*) + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_feature" : ".*[^-_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 + { (exit 1); exit 1; }; } + ac_feature=`echo $ac_feature | sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "enable_$ac_feature='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package| sed 's/-/_/g'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + eval "with_$ac_package='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_package" : ".*[^-_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 + { (exit 1); exit 1; }; } + ac_package=`echo $ac_package | sed 's/-/_/g'` + eval "with_$ac_package=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) { echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + expr "x$ac_envvar" : ".*[^_$ac_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$ac_cr_alnum]" >/dev/null && + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + { echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } +fi + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir \ + exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + NONE ) ;; + *) { echo "$as_me: error: expected an absolute path for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: should be removed in autoconf 3.0. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo "$ac_prog" | sed 's%[\\/][^\\/][^\\/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat < if you have libraries in a + nonstandard directory + CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +EOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_subdir in : $ac_subdirs_all; do test "x$ac_subdir" = x: && continue + cd $ac_subdir + # A "../" for each directory in /$ac_subdir. + ac_dots=`echo $ac_subdir | + sed 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g'` + + case $srcdir in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_subdir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_subdir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure.gnu; then + echo + $SHELL $ac_sub_srcdir/configure.gnu --help=recursive + elif test -f $ac_sub_srcdir/configure; then + echo + $SHELL $ac_sub_srcdir/configure --help=recursive + elif test -f $ac_sub_srcdir/configure.ac || + test -f $ac_sub_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_subdir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\EOF + +Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +EOF + exit 0 +fi +exec 5>config.log +cat >&5 </dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +hostinfo = `(hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +PATH = $PATH + +_ASUNAME +} >&5 + +cat >&5 <\?\"\']*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` + ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" + ac_sep=" " ;; + *) ac_configure_args="$ac_configure_args$ac_sep$ac_arg" + ac_sep=" " ;; + esac + # Get rid of the leading space. +done + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + echo >&5 + echo "## ----------------- ##" >&5 + echo "## Cache variables. ##" >&5 + echo "## ----------------- ##" >&5 + echo >&5 + # The following way of writing the cache mishandles newlines in values, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} >&5 + sed "/^$/d" confdefs.h >conftest.log + if test -s conftest.log; then + echo >&5 + echo "## ------------ ##" >&5 + echo "## confdefs.h. ##" >&5 + echo "## ------------ ##" >&5 + echo >&5 + cat conftest.log >&5 + fi + (echo; echo) >&5 + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" >&5 + echo "$as_me: exit $exit_status" >&5 + rm -rf conftest* confdefs* core core.* *.core conf$$* $ac_clean_files && + exit $exit_status + ' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_status=$?; ac_signal='$ac_signal'; { (exit $ac_status); exit $ac_status; }' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >confdefs.h + +# Let the site file select an alternate cache file if it wants to. +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + { echo "$as_me:812: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} + cat "$ac_site_file" >&5 + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { echo "$as_me:823: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . $cache_file;; + *) . ./$cache_file;; + esac + fi +else + { echo "$as_me:831: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_suggest_removing_cache=false +for ac_var in `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val="\$ac_cv_env_${ac_var}_value" + eval ac_new_val="\$ac_env_${ac_var}_value" + case $ac_old_set,$ac_new_set in + set,) + { echo "$as_me:847: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: WARNING: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_suggest_removing_cache=: ;; + ,set) + { echo "$as_me:851: WARNING: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: WARNING: \`$ac_var' was not set in the previous run" >&2;} + ac_suggest_removing_cache=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + { echo "$as_me:857: WARNING: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: WARNING: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:859: WARNING: former value: $ac_old_val" >&5 +echo "$as_me: WARNING: former value: $ac_old_val" >&2;} + { echo "$as_me:861: WARNING: current value: $ac_new_val" >&5 +echo "$as_me: WARNING: current value: $ac_new_val" >&2;} + ac_suggest_removing_cache=: + fi;; + esac +done +if $ac_suggest_removing_cache; then + { echo "$as_me:868: WARNING: changes in the environment can compromise the build" >&5 +echo "$as_me: WARNING: changes in the environment can compromise the build" >&2;} + { echo "$as_me:870: WARNING: consider removing $cache_file and starting over" >&5 +echo "$as_me: WARNING: consider removing $cache_file and starting over" >&2;} +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac +echo "#! $SHELL" >conftest.sh +echo "exit 0" >>conftest.sh +chmod +x conftest.sh +if { (echo "$as_me:889: PATH=\".;.\"; conftest.sh") >&5 + (PATH=".;."; conftest.sh) 2>&5 + ac_status=$? + echo "$as_me:892: \$? = $ac_status" >&5 + (exit $ac_status); }; then + ac_path_separator=';' +else + ac_path_separator=: +fi +PATH_SEPARATOR="$ac_path_separator" +rm -f conftest.sh + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:918: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:938: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if $as_executable_p "$ac_dir/$ac_prog"; then + if test $ac_prog = install && + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:987: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:998: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + if test "$*" != "X $srcdir/configure conftestfile" \ + && test "$*" != "X conftestfile $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:1021: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftestfile + ) +then + # Ok. + : +else + { { echo "$as_me:1034: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f conftest* +echo "$as_me:1041: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF >conftest.sed +s,\\,\\\\,g; s,\$,$$,g +EOF + program_transform_name=`echo $program_transform_name | sed -f conftest.sed` + rm -f conftest.sed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},;$program_transform_name" + +# sed with no file args requires a program. +test -z "$program_transform_name" && program_transform_name="s,x,x," + +echo "$as_me:1062: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:1082: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:1086: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +PACKAGE=fping + +VERSION=2.4b2_to + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { { echo "$as_me:1096: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +cat >>confdefs.h <>confdefs.h <&5 +echo $ECHO_N "checking for working aclocal... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$as_me:1117: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$as_me:1121: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1125: checking for working autoconf" >&5 +echo $ECHO_N "checking for working autoconf... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$as_me:1132: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$as_me:1136: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1140: checking for working automake" >&5 +echo $ECHO_N "checking for working automake... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$as_me:1147: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$as_me:1151: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1155: checking for working autoheader" >&5 +echo $ECHO_N "checking for working autoheader... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$as_me:1162: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$as_me:1166: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +echo "$as_me:1170: checking for working makeinfo" >&5 +echo $ECHO_N "checking for working makeinfo... $ECHO_C" >&6 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$as_me:1177: result: found" >&5 +echo "${ECHO_T}found" >&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$as_me:1181: result: missing" >&5 +echo "${ECHO_T}missing" >&6 +fi + +ac_config_headers="$ac_config_headers config.h" + +ac_config_commands="$ac_config_commands default-1" + +#VERSION=2.4b2 +#PACKAGE=fping + +cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}gcc" +echo "$as_me:1219: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1227: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1230: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo "$as_me:1239: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="gcc" +echo "$as_me:1254: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1262: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1265: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +echo "$as_me:1278: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="${ac_tool_prefix}cc" +echo "$as_me:1293: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1301: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1304: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1313: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="cc" +echo "$as_me:1328: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1336: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1339: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +fi + +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo "$as_me:1352: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue +fi +ac_cv_prog_CC="cc" +echo "$as_me:1372: found $ac_dir/$ac_word" >&5 +break +done + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" ${1+"$@"} + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1394: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1397: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +echo "$as_me:1408: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_CC="$ac_tool_prefix$ac_prog" +echo "$as_me:1423: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + echo "$as_me:1431: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6 +else + echo "$as_me:1434: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +echo "$as_me:1447: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else + ac_save_IFS=$IFS; IFS=$ac_path_separator +ac_dummy="$PATH" +for ac_dir in $ac_dummy; do + IFS=$ac_save_IFS + test -z "$ac_dir" && ac_dir=. + $as_executable_p "$ac_dir/$ac_word" || continue +ac_cv_prog_ac_ct_CC="$ac_prog" +echo "$as_me:1462: found $ac_dir/$ac_word" >&5 +break +done + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + echo "$as_me:1470: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6 +else + echo "$as_me:1473: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CC" && break +done + + CC=$ac_ct_CC +fi + +fi + +test -z "$CC" && { { echo "$as_me:1485: error: no acceptable cc found in \$PATH" >&5 +echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} + { (exit 1); exit 1; }; } + +cat >conftest.$ac_ext <<_ACEOF +#line 1490 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.exe" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compiler, and finding out an intuition +# of exeext. +echo "$as_me:1506: checking for C compiler default output" >&5 +echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +if { (eval echo "$as_me:1509: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:1512: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `ls a.exe conftest.exe a.* conftest conftest.* 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + a.out ) # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1529: error: C compiler cannot create executables" >&5 +echo "$as_me: error: C compiler cannot create executables" >&2;} + { (exit 77); exit 77; }; } +fi + +ac_exeext=$ac_cv_exeext +echo "$as_me:1535: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6 + +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1540: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (eval echo "$as_me:1546: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1549: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { echo "$as_me:1556: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&5 +echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'." >&2;} + { (exit 1); exit 1; }; } + fi + fi +fi +echo "$as_me:1564: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +rm -f a.out a.exe conftest$ac_cv_exeext +ac_clean_files=$ac_clean_files_save +# Check the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +echo "$as_me:1571: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 +echo "$as_me:1573: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6 + +echo "$as_me:1576: checking for executable suffix" >&5 +echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 +if { (eval echo "$as_me:1578: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:1581: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + break;; + * ) break;; + esac +done +else + { { echo "$as_me:1597: error: cannot compute EXEEXT: cannot compile and link" >&5 +echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest$ac_cv_exeext +echo "$as_me:1603: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6 + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +echo "$as_me:1609: checking for object suffix" >&5 +echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 +if test "${ac_cv_objext+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1615 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { (eval echo "$as_me:1627: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1630: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +{ { echo "$as_me:1642: error: cannot compute OBJEXT: cannot compile" >&5 +echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} + { (exit 1); exit 1; }; } +fi + +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +echo "$as_me:1649: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6 +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +echo "$as_me:1653: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 +if test "${ac_cv_c_compiler_gnu+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1659 "configure" +#include "confdefs.h" + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1674: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1677: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1680: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1683: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_compiler_gnu=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_compiler_gnu=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:1695: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 +GCC=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +CFLAGS="-g" +echo "$as_me:1701: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_g+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 1707 "configure" +#include "confdefs.h" + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1719: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1722: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1725: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1728: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_prog_cc_g=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:1738: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1765: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1768: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1771: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1774: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + ''\ + '#include ' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +#line 1786 "configure" +#include "confdefs.h" +#include +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1799: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1802: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1805: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1808: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +continue +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 1818 "configure" +#include "confdefs.h" +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:1830: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:1833: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:1836: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:1839: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +done +echo '#ifdef __cplusplus' >>confdefs.h +echo $ac_declaration >>confdefs.h +echo '#endif' >>confdefs.h + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:1868: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + # break 2 since there is a loop in there. + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 1890 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:1895: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1901: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 1924 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:1928: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1934: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break 2 +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:1971: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +#line 1981 "configure" +#include "confdefs.h" +#include + Syntax error +_ACEOF +if { (eval echo "$as_me:1986: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:1992: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +#line 2015 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:2019: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2025: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:2053: error: C preprocessor \"$CPP\" fails sanity check" >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:2076: checking for a BSD compatible install" >&5 +echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_save_IFS=$IFS; IFS=$ac_path_separator + for ac_dir in $PATH; do + IFS=$ac_save_IFS + # Account for people who put trailing slashes in PATH elements. + case $ac_dir/ in + / | ./ | .// | /cC/* \ + | /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* \ + | /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if $as_executable_p "$ac_dir/$ac_prog"; then + if test $ac_prog = install && + grep dspmsg "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$ac_dir/$ac_prog" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:2125: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:2136: checking for gethostbyname" >&5 +echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6 +if test "${ac_cv_func_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2142 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char gethostbyname (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname) +choke me +#else +f = gethostbyname; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2173: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2176: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2179: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2182: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:2192: result: $ac_cv_func_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6 + +if test $ac_cv_func_gethostbyname = no; then + +echo "$as_me:2197: checking for gethostbyname in -lnsl" >&5 +echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6 +if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lnsl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 2205 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char gethostbyname (); +int +main () +{ +gethostbyname (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2224: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2227: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2230: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2233: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_nsl_gethostbyname=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_nsl_gethostbyname=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:2244: result: $ac_cv_lib_nsl_gethostbyname" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6 +if test $ac_cv_lib_nsl_gethostbyname = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for connect... $ECHO_C" >&6 +if test "${ac_cv_func_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2262 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char connect (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +char (*f) (); + +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_connect) || defined (__stub___connect) +choke me +#else +f = connect; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2293: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2296: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2299: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2302: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_connect=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:2312: result: $ac_cv_func_connect" >&5 +echo "${ECHO_T}$ac_cv_func_connect" >&6 + +if test $ac_cv_func_connect = no; then + +echo "$as_me:2317: checking for connect in -lsocket" >&5 +echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 2325 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +int +main () +{ +connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:2344: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:2347: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:2350: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2353: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_connect=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_socket_connect=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:2364: result: $ac_cv_lib_socket_connect" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 +if test $ac_cv_lib_socket_connect = yes; then + cat >>confdefs.h <&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$ac_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 2386 "configure" +#include "confdefs.h" +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:2390: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:2396: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + eval "$ac_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + eval "$ac_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:2415: result: `eval echo '${'$ac_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$ac_ac_Header'}'`" >&6 +if test `eval echo '${'$ac_ac_Header'}'` = yes; then + cat >>confdefs.h <confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overriden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n \ + "s/^\\([_$ac_cr_alnum]*_cv_[_$ac_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + : end' >>confcache +if cmp -s $cache_file confcache; then :; else + if test -w $cache_file; then + test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/; +s/:*\${srcdir}:*/:/; +s/:*@srcdir@:*/:/; +s/^\([^=]*=[ ]*\):*/\1/; +s/:*$//; +s/^[^=]*=[ ]*$//; +}' +fi + +DEFS=-DHAVE_CONFIG_H + +: ${CONFIG_STATUS=./config.status} +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ echo "$as_me:2505: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF +#! $SHELL +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +SHELL=\${CONFIG_SHELL-$SHELL} +ac_cs_invocation="\$0 \$@" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi + +# Name of the executable. +as_me=`echo "$0" |sed 's,.*[\\/],,'` + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.file + +as_executable_p="test -f" + +# Support unset when possible. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# NLS nuisances. +$as_unset LANG || test "${LANG+set}" != set || { LANG=C; export LANG; } +$as_unset LC_ALL || test "${LC_ALL+set}" != set || { LC_ALL=C; export LC_ALL; } +$as_unset LC_TIME || test "${LC_TIME+set}" != set || { LC_TIME=C; export LC_TIME; } +$as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set || { LC_CTYPE=C; export LC_CTYPE; } +$as_unset LANGUAGE || test "${LANGUAGE+set}" != set || { LANGUAGE=C; export LANGUAGE; } +$as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set || { LC_COLLATE=C; export LC_COLLATE; } +$as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set || { LC_NUMERIC=C; export LC_NUMERIC; } +$as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set || { LC_MESSAGES=C; export LC_MESSAGES; } + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=:; export CDPATH; } + +exec 6>&1 + +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +cat >>$CONFIG_STATUS <<\EOF + +ac_cs_usage="\ +\`$as_me' instantiates files from templates according to the +current configuration. + +Usage: $0 [OPTIONS] [FILE]... + + -h, --help print this help, then exit + -V, --version print version number, then exit + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +EOF + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=*) + ac_option=`expr "x$1" : 'x\([^=]*\)='` + ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + shift + set dummy "$ac_option" "$ac_optarg" ${1+"$@"} + shift + ;; + -*);; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_need_defaults=false;; + esac + + case $1 in + # Handling of the options. +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:2681: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + shift + CONFIG_FILES="$CONFIG_FILES $1" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + shift + CONFIG_HEADERS="$CONFIG_HEADERS $1" + ac_need_defaults=false;; + + # Handling of arguments. + 'Makefile' ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + 'default-1' ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;; + 'config.h' ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + + # This is an error. + -*) { { echo "$as_me:2705: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; } ;; + *) { { echo "$as_me:2710: error: invalid argument: $1" >&5 +echo "$as_me: error: invalid argument: $1" >&2;} + { (exit 1); exit 1; }; };; + esac + shift +done + +exec 5>>config.log +cat >&5 << _ACEOF + +## ----------------------- ## +## Running config.status. ## +## ----------------------- ## + +This file was extended by $as_me 2.50, executed with + > $ac_cs_invocation +on `(hostname || uname -n) 2>/dev/null | sed 1q` + +_ACEOF +EOF + +cat >>$CONFIG_STATUS <<\EOF +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + trap '{ (exit $?); exit $?; }' 1 2 13 15 +} + +# Create a (secure) tmp directory for tmp files. +: ${TMPDIR=/tmp} +{ + tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=$TMPDIR/cs$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + { (exit 1); exit 1; } +} + +EOF + +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@DEFS@,$DEFS,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@CPP@,$CPP,;t t +CEOF + +EOF + + cat >>$CONFIG_STATUS <<\EOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +EOF +cat >>$CONFIG_STATUS <<\EOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + ac_dir_suffix="/`echo $ac_dir|sed 's,^\./,,'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo "$ac_dir_suffix" | sed 's,/[^/]*,../,g'` + else + ac_dir_suffix= ac_dots= + fi + + case $srcdir in + .) ac_srcdir=. + if test -z "$ac_dots"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_dots | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_dots$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_dots$srcdir ;; + esac + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_dots$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:2945: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + configure_input="Generated automatically from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:2963: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:2976: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +EOF +cat >>$CONFIG_STATUS <>$CONFIG_STATUS <<\EOF +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s,@configure_input@,$configure_input,;t t +s,@srcdir@,$ac_srcdir,;t t +s,@top_srcdir@,$ac_top_srcdir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:3037: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:3048: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo $f;; + *) # Relative + if test -f "$f"; then + # Build tree + echo $f + elif test -f "$srcdir/$f"; then + # Source tree + echo $srcdir/$f + else + # /dev/null tree + { { echo "$as_me:3061: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +EOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\EOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\(\([^ (][^ (]*\)([^)]*)\)[ ]*\(.*\)$,${ac_dA}\2${ac_dB}\1${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +EOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\EOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +EOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # egrep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\EOF + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated automatically by config.status. */ + if test x"$ac_file" = x-; then + echo "/* Generated automatically by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated automatically by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + { echo "$as_me:3178: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + { case "$ac_dir" in + [\\/]* | ?:[\\/]* ) as_incr_dir=;; + *) as_incr_dir=.;; +esac +as_dummy="$ac_dir" +for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do + case $as_mkdir_dir in + # Skip DOS drivespec + ?:) as_incr_dir=$as_mkdir_dir ;; + *) + as_incr_dir=$as_incr_dir/$as_mkdir_dir + test -d "$as_incr_dir" || mkdir "$as_incr_dir" + ;; + esac +done; } + + fi + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +done +EOF +cat >>$CONFIG_STATUS <<\EOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + + case $ac_dest in + default-1 ) test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h ;; + esac +done +EOF + +cat >>$CONFIG_STATUS <<\EOF + +{ (exit 0); exit 0; } +EOF +chmod +x $CONFIG_STATUS +ac_clean_files=$ac_clean_files_save + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + exec 5>/dev/null + $SHELL $CONFIG_STATUS || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || { (exit 1); exit 1; } +fi + diff --git a/configure.in b/configure.in new file mode 100755 index 0000000..59611d5 --- /dev/null +++ b/configure.in @@ -0,0 +1,32 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(fping.c) +AM_INIT_AUTOMAKE(fping, 2.4b2_to_ipv6) + +AM_CONFIG_HEADER(config.h) +#VERSION=2.4b2 +#PACKAGE=fping +AC_SUBST(PACKAGE) +AC_SUBST(VERSION) +AC_DEFINE_UNQUOTED(VERSION,"$VERSION") + +dnl Checks for programs. + +AC_PROG_CC +AC_PROG_CPP +AC_PROG_INSTALL + +dnl Checks for libraries. + +AC_CHECK_FUNC(gethostbyname) +if test $ac_cv_func_gethostbyname = no; then + AC_CHECK_LIB(nsl, gethostbyname) +fi +AC_CHECK_FUNC(connect) +if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect) +fi + +dnl Checks for header files. +AC_CHECK_HEADERS(unistd.h sys/file.h stdlib.h sys/select.h) + +AC_OUTPUT(Makefile) diff --git a/fping.8 b/fping.8 new file mode 100755 index 0000000..254804e --- /dev/null +++ b/fping.8 @@ -0,0 +1,220 @@ +.TH fping l +.SH NAME +fping \- send ICMP ECHO_REQUEST packets to network hosts +.SH SYNOPSIS +.B fping +[ \fIoptions\fR ] +[ \fIsystems...\fR ] + +.SH DESCRIPTION +.NXR "fping command" +.NXR "ICMP ECHO_REQUEST" + + +.B fping +is a +.MS ping 8 +like program which uses the Internet Control +Message Protocol (ICMP) echo request to determine if a target host is +responding. +.B fping +differs from ping in that you can specify any +number of targets on the command line, or specify a file containing +the lists of targets to ping. Instead of sending to one target until it +times out or replies, +.B fping +will send out a ping packet and move +on to the next target in a round-robin fashion. +.PP +In the default mode, if a target replies, +it is noted and removed from the list of targets to check; if a target +does not respond within a certain time limit and/or retry limit it +is designated as unreachable. +.B fping +also supports sending a specified number of pings to a target, or +looping indefinitely (as in +.B ping +). +.PP +Unlike +.B ping +, +.B fping +is meant to be used in scripts, so its output is designed to be +easy to parse. +.SH OPTIONS +.IP \fB-a\fR 5 +Show systems that are alive. +.IP \fB-A\fR 5 +Display targets by address rather than DNS name. +.IP \fB-b\fIn\fR 5 +Number of bytes of ping data to send. The minimum size (normally 12) +allows room for the data that +.B fping +needs to do its work (sequence number, timestamp). The reported +received data size includes the IP header (normally 20 bytes) and ICMP +header (8 bytes), so the minimum total size is 40 bytes. Default is +56, as in +.B ping. +Maximum is the theoretical maximum IP datagram size (64K), though most +systems limit this to a smaller, system-dependent number. +.IP \fB-B\fIn\fR 5 +In the default mode, +.B fping +sends several requests to a target before giving up, waiting longer for +a reply on each successive request. This parameter is the value by +which the wait time is multiplied on each successive request; it must +be entered as a floating-point number (x.y). The default is 1.5. +.IP \fB-c\fR 5 +Number of request packets to send to each target. In this mode, a +line is displayed for each received response (this can suppressed with +-q or -Q). Also, statistics about responses for each target are displayed +when all requests have been sent (or when interrupted). +.IP \fB-C\fR 5 +Similar to -c, but the per-target statistics are displayed in a format +designed for automated response-time statistics gathering. For +example: + +% fping -C 5 -q somehost + +somehost : 91.7 37.0 29.2 - 36.8 + +shows the response time in milliseconds for each of the five requests, +with the "-" indicating that no response was received to the fourth +request. +.IP \fB-d\fR 5 +Use DNS to lookup address of return ping packet. This allows you to give +fping a list of IP addresses as input and print hostnames in the output. +.IP \fB-e\fR 5 +Show elapsed (round-trip) time of packets. +.IP \fB-f\fR 5 +Read list of targets from a file. This option can only be used by the +root user. Regular users should pipe in the file via stdin: + +% fping < targets_file + +.IP \fB-g\fR 5 +Generate a target list from a supplied IP netmask, or a starting and ending IP. +Specify the netmask or start/end in the targets portion of the command line. + +ex. To ping the class C 192.168.1.x, the specified command line could look like either: + +fping -g 192.168.1.0/24 + +or + +fping -g 192.168.1.0 192.168.1.255 +.IP \fB-h\fR 5 +Print usage message. +.IP \fB-i\fIn\fR 5 +The minimum amount of time (in milliseconds) between sending a ping packet to any target (default is 25). +.IP \fB-l\fR 5 +Loop sending packets to each target indefinitely. Can be interrupted +with ctl-C; statistics about responses for each target are then displayed. +.IP \fB-m\fR 5 +Send pings to each of a target host's multiple interfaces. +.IP \fB-n\fR 5 +Same as -d. +.IP \fB-p\fR 5 +In looping or counting modes (-l, -c, or -C), this parameter sets the +time in milliseconds that +.B fping +waits between successive packets to an individual target. Default is +1000. +.IP \fB-q\fR 5 +Quiet. Don't show per-target results, just set final exit status. +.IP \fB-Q\fIn\fR 5 +Like -q, but show summary results every n seconds. +.IP \fB-r\fIn\fR 5 +Retry limit (default 3). This is the number of times an attempt at pinging +a target will be made, not including the first try. +.IP \fB-s\fR 5 +Print cumulative statistics upon exit. +.IP \fB-t\fIn\fR 5 +Initial target timeout in milliseconds (default 500). In the default +mode, this is the amount of time that +.B fping +waits for a response to its first request. Successive timeouts are +multiplied by the backoff factor. +.IP \fB-u\fR 5 +Show targets that are unreachable. +.IP \fB-v\fR 5 +Print +.B fping +version information. + +.SH EXAMPLES +The following perl script will check a list of hosts and send mail if +any are unreachable. It uses the open2 function which allows a program +to be opened for reading and writing. fping does not start pinging the +list of systems until it reads EOF, which it gets after INPUT is closed. +Sure the open2 usage is not needed in this example, but it's a good open2 +example none the less. +.nf + +#!/usr/local/bin/perl +require 'open2.pl'; + +$MAILTO = "root"; + +$pid = &open2("OUTPUT","INPUT","/usr/local/bin/fping -u"); + +@check=("slapshot","foo","foobar"); + +foreach(@check) { print INPUT "$_\\n"; } +close(INPUT); +@output=; + +if ($#output != -1) { + chop($date=`date`); + open(MAIL,"|mail -s 'unreachable systems' $MAILTO"); + print MAIL "\\nThe following systems are unreachable as of: $date\\n\\n"; + print MAIL @output; + close MAIL; +} + +.ni +Another good example is when you want to perform an action only on hosts +that are currently reachable. +.nf + +#!/usr/local/bin/perl + +$hosts_to_backup = `cat /etc/hosts.backup | fping -a`; + +foreach $host (split(/\\n/,$hosts_to_backup)) { + # do it +} + +.ni + +.SH AUTHORS +.nf +Roland J. Schemers III, Stanford University, concept and versions 1.x +RL "Bob" Morgan, Stanford University, versions 2.x +David Papp, versions 2.3x and up, +fping website: http://www.fping.com +.ni +.SH DIAGNOSTICS +Exit status is 0 if all the hosts are reachable, 1 if some hosts were +unreachable, 2 if any IP addresses were not found, 3 for invalid +command line arguments, and 4 for a system call failure. +.SH BUGS +Ha! If we knew of any we would have fixed them! +.SH RESTRICTIONS +If certain options are used (i.e, a low value for -i and -t, and a +high value for -r) it is possible to flood the network. This program +must be installed as setuid root in order to open up a raw socket, +or must be run by root. In order to stop mere mortals from hosing the +network (when fping is installed setuid root) , normal users can't specify +the following: +.nf + + -i n where n < 10 msec + -r n where n > 20 + -t n where n < 250 msec + +.ni +.SH SEE ALSO +netstat(1), ping(8), ifconfig(8c) + diff --git a/fping.c b/fping.c new file mode 100755 index 0000000..7d0c525 --- /dev/null +++ b/fping.c @@ -0,0 +1,2742 @@ +/* + * fping: fast-ping, file-ping, favorite-ping, funky-ping + * + * Ping a list of target hosts in a round robin fashion. + * A better ping overall. + * + * VIEWING NOTES: + * + * This file was formatted with tab indents at a tab stop of 4. + * + * It is highly recommended that your editor is set to this + * tab stop setting for viewing and editing. + * + * fping website: http://www.fping.com + * + * + * + * Current maintainers of fping: + * + * David Papp + * Suggestions and patches, please email david@remote.net + * + * + * + * Original author: Roland Schemers + * IPv6 Support: Jeroen Massar + * + * + * + * RCS header information no longer used. It has been moved to the + * ChangeLog file. + * + * Redistribution and use in source and binary forms are permitted + * provided that the above copyright notice and this paragraph are + * duplicated in all such forms and that any documentation, + * advertising materials, and other materials related to such + * distribution and use acknowledge that the software was developed + * by Stanford University. The name of the University may not be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + */ +#define IPV6 1 /* This should be a compiler option, or even better be done from the Makefile... ;) */ + +#ifndef _NO_PROTO +#if !__STDC__ && !defined( __cplusplus ) && !defined( FUNCPROTO ) \ + && !defined( _POSIX_SOURCE ) +#define _NO_PROTO +#endif /* __STDC__ */ +#endif /* _NO_PROTO */ + +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + +/* if compiling for Windows, use this separate set + (too difficult to ifdef all the autoconf defines) */ +#ifdef WIN32 + +/*** Windows includes ***/ + + +#else + +/*** autoconf includes ***/ + + +#include +#include +#include +#include + +#include + +#include "config.h" + +#ifdef HAVE_UNISTD_H +#include +#endif /* HAVE_UNISTD_H */ + +#ifdef HAVE_STDLIB_H +#include +#endif /* HAVE_STDLIB_H */ + +#include +#include + +#include +#include +#include + +#if HAVE_SYS_FILE_H +#include +#endif /* HAVE_SYS_FILE_H */ + +#ifdef IPV6 +#include +#endif +#include + +/* Linux has bizarre ip.h and ip_icmp.h */ +#if defined( __linux__ ) +#include "linux.h" +#else +#include +#include +#endif /* defined(__linux__) */ + +#include +#include + +/* RS6000 has sys/select.h */ +#ifdef HAVE_SYS_SELECT_H +#include +#endif /* HAVE_SYS_SELECT_H */ + +#endif /* WIN32 */ + +#include "options.h" + +/*** externals ***/ + +extern char *optarg; +extern int optind,opterr; +extern int h_errno; + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +/*** Constants ***/ + +#define REV_DATE "2002/01/16 00:33:42" +#define EMAIL "david@remote.net" + +/*** Ping packet defines ***/ + +/* data added after ICMP header for our nefarious purposes */ + +typedef struct ping_data +{ + int ping_count; /* counts up to -c count or 1 */ + struct timeval ping_ts; /* time sent */ + +} PING_DATA; + +#define MIN_PING_DATA sizeof( PING_DATA ) +#define MAX_IP_PACKET 65536 /* (theoretical) max IP packet size */ +#define SIZE_IP_HDR 20 +#define SIZE_ICMP_HDR ICMP_MINLEN /* from ip_icmp.h */ +#define MAX_PING_DATA ( MAX_IP_PACKET - SIZE_IP_HDR - SIZE_ICMP_HDR ) + +/* sized so as to be like traditional ping */ +#define DEFAULT_PING_DATA_SIZE ( MIN_PING_DATA + 44 ) + +/* maxima and minima */ +#define MAX_COUNT 10000 +#define MIN_INTERVAL 10 /* in millisec */ +#define MIN_PERHOST_INTERVAL 20 /* in millisec */ +#define MIN_TIMEOUT 50 /* in millisec */ +#define MAX_RETRY 20 + +/* response time array flags */ +#define RESP_WAITING -1 +#define RESP_UNUSED -2 + +/* debugging flags */ +#if defined( DEBUG ) || defined( _DEBUG ) +#define DBG_TRACE 1 +#define DBG_SENT_TIMES 2 +#define DBG_RANDOM_LOSE_FEW 4 +#define DBG_RANDOM_LOSE_MANY 8 +#define DBG_PRINT_PER_SYSTEM 16 +#define DBG_REPORT_ALL_RTTS 32 +#endif /* DEBUG || _DEBUG */ + +/* Long names for ICMP packet types */ +char *icmp_type_str[19] = +{ + "ICMP Echo Reply", /* 0 */ + "", + "", + "ICMP Unreachable", /* 3 */ + "ICMP Source Quench", /* 4 */ + "ICMP Redirect", /* 5 */ + "", + "", + "ICMP Echo", /* 8 */ + "", + "", + "ICMP Time Exceeded", /* 11 */ + "ICMP Paramter Problem", /* 12 */ + "ICMP Timestamp Request", /* 13 */ + "ICMP Timestamp Reply", /* 14 */ + "ICMP Information Request", /* 15 */ + "ICMP Information Reply", /* 16 */ + "ICMP Mask Request", /* 17 */ + "ICMP Mask Reply" /* 18 */ +}; + +char *icmp_unreach_str[16] = +{ + "ICMP Network Unreachable", /* 0 */ + "ICMP Host Unreachable", /* 1 */ + "ICMP Protocol Unreachable", /* 2 */ + "ICMP Port Unreachable", /* 3 */ + "ICMP Unreachable (Fragmentation Needed)", /* 4 */ + "ICMP Unreachable (Source Route Failed)", /* 5 */ + "ICMP Unreachable (Destination Network Unknown)", /* 6 */ + "ICMP Unreachable (Destination Host Unknown)", /* 7 */ + "ICMP Unreachable (Source Host Isolated)", /* 8 */ + "ICMP Unreachable (Communication with Network Prohibited)", /* 9 */ + "ICMP Unreachable (Communication with Host Prohibited)", /* 10 */ + "ICMP Unreachable (Network Unreachable For Type Of Service)", /* 11 */ + "ICMP Unreachable (Host Unreachable For Type Of Service)", /* 12 */ + "ICMP Unreachable (Communication Administratively Prohibited)", /* 13 */ + "ICMP Unreachable (Host Precedence Violation)", /* 14 */ + "ICMP Unreachable (Precedence cutoff in effect)" /* 15 */ +}; + +#define ICMP_UNREACH_MAXTYPE 15 +#ifndef IPV6 +#define FPING_SOCKADDR struct sockaddr_in +#define FPING_ICMPHDR struct icmp +#else +#define FPING_SOCKADDR struct sockaddr_in6 +#define FPING_ICMPHDR struct icmp6_hdr +#endif + +/* entry used to keep track of each host we are pinging */ + +typedef struct host_entry +{ + struct host_entry *prev,*next; /* doubly linked list */ + int i; /* index into array */ + char *name; /* name as given by user */ + char *host; /* text description of host */ + char *pad; /* pad to align print names */ + FPING_SOCKADDR saddr; /* internet address */ + int timeout; /* time to wait for response */ + u_char running; /* unset when through sending */ + u_char waiting; /* waiting for response */ + struct timeval last_send_time; /* time of last packet sent */ + int num_sent; /* number of ping packets sent */ + int num_recv; /* number of pings received */ + int max_reply; /* longest response time */ + int min_reply; /* shortest response time */ + int total_time; /* sum of response times */ + int num_sent_i; /* number of ping packets sent */ + int num_recv_i; /* number of pings received */ + int max_reply_i; /* longest response time */ + int min_reply_i; /* shortest response time */ + int total_time_i; /* sum of response times */ + int *resp_times; /* individual response times */ +#if defined( DEBUG ) || defined( _DEBUG ) + int *sent_times; /* per-sent-ping timestamp */ +#endif /* DEBUG || _DEBUG */ +} HOST_ENTRY; + +/*** globals ***/ + +HOST_ENTRY *rrlist = NULL; /* linked list of hosts be pinged */ +HOST_ENTRY **table = NULL; /* array of pointers to items in the list */ +HOST_ENTRY *cursor; + +char *prog; +int ident; /* our pid */ +int s; /* socket */ +u_int debugging = 0; + +/* times get *100 because all times are calculated in 10 usec units, not ms */ +u_int retry = DEFAULT_RETRY; +u_int timeout = DEFAULT_TIMEOUT * 100; +u_int interval = DEFAULT_INTERVAL * 100; +u_int perhost_interval = DEFAULT_PERHOST_INTERVAL * 100; +float backoff = DEFAULT_BACKOFF_FACTOR; +u_int select_time = DEFAULT_SELECT_TIME * 100; +u_int ping_data_size = DEFAULT_PING_DATA_SIZE; +u_int ping_pkt_size; +u_int count = 1; +u_int trials; +u_int report_interval = 0; + +/* global stats */ +long max_reply = 0; +long min_reply = 1000000; +int total_replies = 0; +double sum_replies = 0; +int max_hostname_len = 0; +int num_jobs = 0; /* number of hosts still to do */ +int num_hosts; /* total number of hosts */ +int num_alive = 0, /* total number alive */ + num_unreachable = 0, /* total number unreachable */ + num_noaddress = 0; /* total number of addresses not found */ +int num_timeout = 0, /* number of times select timed out */ + num_pingsent = 0, /* total pings sent */ + num_pingreceived = 0, /* total pings received */ + num_othericmprcvd = 0; /* total non-echo-reply ICMP received */ + +struct timeval current_time; /* current time (pseudo) */ +struct timeval start_time; +struct timeval end_time; +struct timeval last_send_time; /* time last ping was sent */ +struct timeval last_report_time; /* time last report was printed */ +struct timezone tz; + +/* switches */ +int generate_flag = 0; /* flag for IP list generation */ +int verbose_flag, quiet_flag, stats_flag, unreachable_flag, alive_flag; +int elapsed_flag, version_flag, count_flag, loop_flag; +int per_recv_flag, report_all_rtts_flag, name_flag, addr_flag, backoff_flag; +int multif_flag; +#if defined( DEBUG ) || defined( _DEBUG ) +int randomly_lose_flag, sent_times_flag, trace_flag, print_per_system_flag; +int lose_factor; +#endif /* DEBUG || _DEBUG */ + +char *filename = NULL; /* file containing hosts to ping */ + +/*** forward declarations ***/ + +#ifdef _NO_PROTO + +void add_name(); +void add_addr(); +char *na_cat(); +char *cpystr(); +void crash_and_burn(); +void errno_crash_and_burn(); +char *get_host_by_address(); +int in_cksum(); +void u_sleep(); +int recvfrom_wto (); +void remove_job(); +void send_ping(); +void usage(); +int wait_for_reply(); +long timeval_diff(); +void print_per_system_stats(); +void print_per_system_splits(); +void print_global_stats(); +void finish(); +int handle_random_icmp(); +char *sprint_tm(); + +#else + +void add_name( char *name ); +#ifndef IPV6 +void add_addr( char *name, char *host, struct in_addr ipaddr ); +#else +void add_addr( char *name, char *host, FPING_SOCKADDR *ipaddr ); +#endif +char *na_cat( char *name, struct in_addr ipaddr ); +char *cpystr( char *string ); +void crash_and_burn( char *message ); +void errno_crash_and_burn( char *message ); +char *get_host_by_address( struct in_addr in ); +int in_cksum( u_short *p, int n ); +void u_sleep( int u_sec ); +int recvfrom_wto ( int s, char *buf, int len, FPING_SOCKADDR *saddr, int timo ); +void remove_job( HOST_ENTRY *h ); +void send_ping( int s, HOST_ENTRY *h ); +long timeval_diff( struct timeval *a, struct timeval *b ); +void usage( void ); +int wait_for_reply( void ); +void print_per_system_stats( void ); +void print_per_system_splits( void ); +void print_global_stats( void ); +void finish(); +int handle_random_icmp( FPING_ICMPHDR *p, int psize, FPING_SOCKADDR *addr ); +char *sprint_tm( int t ); + +#endif /* _NO_PROTO */ + +/*** function definitions ***/ + +/************************************************************ + + Function: main + +************************************************************* + + Inputs: int argc, char** argv + + Description: + + Main program entry point + +************************************************************/ + +#ifdef _NO_PROTO +int main( argc, argv ) +int argc; char **argv; +#else +int main( int argc, char **argv ) +#endif /* _NO_PROTO */ +{ + int c, i, n; +#ifdef IPV6 + int opton = 1; +#endif + u_int lt, ht; + int advance; + struct protoent *proto; + char *buf; + uid_t uid; + /* check if we are root */ + + if( geteuid() ) + { + fprintf( stderr, + "This program can only be run by root, or it must be setuid root.\n" ); + + exit( 3 ); + + }/* IF */ + + /* confirm that ICMP is available on this machine */ +#ifndef IPV6 + if( ( proto = getprotobyname( "icmp" ) ) == NULL ) +#else + if( ( proto = getprotobyname( "ipv6-icmp" ) ) == NULL ) +#endif + crash_and_burn( "icmp: unknown protocol" ); + + /* create raw socket for ICMP calls (ping) */ +#ifndef IPV6 + s = socket( AF_INET, SOCK_RAW, proto->p_proto ); +#else + s = socket( AF_INET6, SOCK_RAW, proto->p_proto ); +#endif + + if( s < 0 ) + errno_crash_and_burn( "can't create raw socket" ); + +#ifdef IPV6 + /* + * let the kerel pass extension headers of incoming packets, + * for privileged socket options + */ +#ifdef IPV6_RECVHOPOPTS + if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVHOPOPTS, &opton, + sizeof(opton))) + err(1, "setsockopt(IPV6_RECVHOPOPTS)"); +#else /* old adv. API */ + if (setsockopt(s, IPPROTO_IPV6, IPV6_HOPOPTS, &opton, + sizeof(opton))) + err(1, "setsockopt(IPV6_HOPOPTS)"); +#endif +#ifdef IPV6_RECVDSTOPTS + if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVDSTOPTS, &opton, + sizeof(opton))) + err(1, "setsockopt(IPV6_RECVDSTOPTS)"); +#else /* old adv. API */ + if (setsockopt(s, IPPROTO_IPV6, IPV6_DSTOPTS, &opton, + sizeof(opton))) + err(1, "setsockopt(IPV6_DSTOPTS)"); +#endif +#ifdef IPV6_RECVRTHDRDSTOPTS + if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVRTHDRDSTOPTS, &opton, + sizeof(opton))) + err(1, "setsockopt(IPV6_RECVRTHDRDSTOPTS)"); +#endif +#ifdef IPV6_RECVRTHDR + if (setsockopt(s, IPPROTO_IPV6, IPV6_RECVRTHDR, &opton, + sizeof(opton))) + err(1, "setsockopt(IPV6_RECVRTHDR)"); +#else /* old adv. API */ + if (setsockopt(s, IPPROTO_IPV6, IPV6_RTHDR, &opton, + sizeof(opton))) + err(1, "setsockopt(IPV6_RTHDR)"); +#endif +#endif + + if( ( uid = getuid() ) ) + { + seteuid( getuid() ); + + }/* IF */ + + prog = argv[0]; + ident = getpid() & 0xFFFF; + + verbose_flag = 1; + backoff_flag = 1; + opterr = 1; + + /* get command line options */ + + while( ( c = getopt( argc, argv, "gedhlmnqusaAvz:t:i:p:f:r:c:b:C:Q:B:" ) ) != EOF ) + { + switch( c ) + { + case 't': + if( !( timeout = ( u_int )atoi( optarg ) * 100 ) ) + usage(); + + break; + + case 'r': + if( !( retry = ( u_int )atoi( optarg ) ) ) + usage(); + + break; + + case 'i': + if( !( interval = ( u_int )atoi( optarg ) * 100 ) ) + usage(); + + break; + + case 'p': + if( !( perhost_interval = ( u_int )atoi( optarg ) * 100 ) ) + usage(); + + break; + + case 'c': + if( !( count = ( u_int )atoi( optarg ) ) ) + usage(); + + count_flag = 1; + break; + + case 'C': + if( !( count = ( u_int )atoi( optarg ) ) ) + usage(); + + count_flag = 1; + report_all_rtts_flag = 1; + break; + + case 'b': + if( !( ping_data_size = ( u_int )atoi( optarg ) ) ) + usage(); + + break; + + case 'h': + usage(); + break; + + case 'q': + verbose_flag = 0; + quiet_flag = 1; + break; + + case 'Q': + verbose_flag = 0; + quiet_flag = 1; + if( !( report_interval = ( u_int )atoi( optarg ) * 100000 ) ) + usage(); + + break; + + case 'e': + elapsed_flag = 1; + break; + + case 'm': + multif_flag = 1; + break; + + case 'd': + case 'n': + name_flag = 1; + break; + + case 'A': + addr_flag = 1; + break; + + case 'B': + if( !( backoff = atof( optarg ) ) ) + usage(); + + break; + + case 's': + stats_flag = 1; + break; + + case 'l': + loop_flag = 1; + backoff_flag = 0; + break; + + case 'u': + unreachable_flag = 1; + break; + + case 'a': + alive_flag = 1; + break; + +#if defined( DEBUG ) || defined( _DEBUG ) + case 'z': + if( ! ( debugging = ( u_int )atoi( optarg ) ) ) + usage(); + + break; +#endif /* DEBUG || _DEBUG */ + + case 'v': + printf( "%s: Version %s $Date: %s $\n", argv[0], VERSION, REV_DATE ); + printf( "%s: comments to %s\n", argv[0], EMAIL ); + exit( 0 ); + + case 'f': +#ifdef ENABLE_F_OPTION + filename = optarg; + generate_flag = 0; + break; +#else + if( getuid() ) + { + printf( "%s: this option can only be used by root.\n", argv[0] ); + printf( "%s: fping will read from stdin by default.\n", argv[0] ); + exit( 3 ); + + }/* IF */ + else + { + filename = optarg; + generate_flag = 0; + + }/* ELSE */ + + break; +#endif /* ENABLE_F_OPTION */ + + case 'g': + /* use IP list generation */ + /* mutually exclusive with using file input or command line targets */ + generate_flag = 1; + break; + + default: + usage(); + break; + + }/* SWITCH */ + }/* WHILE */ + + /* validate various option settings */ + + if( unreachable_flag && alive_flag ) + { + fprintf( stderr, "%s: specify only one of a, u\n", argv[0] ); + usage(); + + }/* IF */ + + if( count_flag && loop_flag ) + { + fprintf( stderr, "%s: specify only one of c, l\n", argv[0] ); + usage(); + + }/* IF */ + + if( ( interval < MIN_INTERVAL * 100 || + perhost_interval < MIN_PERHOST_INTERVAL * 100 || + retry > MAX_RETRY || + timeout < MIN_TIMEOUT * 100 ) + && getuid() ) + { + fprintf( stderr, "%s: these options are too risky for mere mortals.\n", prog ); + fprintf( stderr, "%s: You need i >= %u, p >= %u, r < %u, and t >= %u\n", + prog, MIN_INTERVAL, MIN_PERHOST_INTERVAL, MAX_RETRY, MIN_TIMEOUT ); + usage(); + + }/* IF */ + + if( ( ping_data_size > MAX_PING_DATA ) || ( ping_data_size < MIN_PING_DATA ) ) + { + fprintf( stderr, "%s: data size %u not valid, must be between %u and %u\n", + prog, ping_data_size, MIN_PING_DATA, MAX_PING_DATA ); + usage(); + + }/* IF */ + + if( ( backoff > MAX_BACKOFF_FACTOR ) || ( backoff < MIN_BACKOFF_FACTOR ) ) + { + fprintf( stderr, "%s: backoff factor %.1f not valid, must be between %.1f and %.1f\n", + prog, backoff, MIN_BACKOFF_FACTOR, MAX_BACKOFF_FACTOR ); + usage(); + + }/* IF */ + + if( count > MAX_COUNT ) + { + fprintf( stderr, "%s: count %u not valid, must be less than %u\n", + prog, count, MAX_COUNT ); + usage(); + + }/* IF */ + + if( alive_flag || unreachable_flag ) + verbose_flag = 0; + + if( count_flag ) + { + if( verbose_flag ) + per_recv_flag = 1; + + alive_flag = unreachable_flag = verbose_flag = 0; + + }/* IF */ + + if( loop_flag ) + { + if( !report_interval ) + per_recv_flag = 1; + + alive_flag = unreachable_flag = verbose_flag = 0; + + }/* IF */ + + trials = ( count > retry + 1 ) ? count : retry + 1; + +#if defined( DEBUG ) || defined( _DEBUG ) + if( debugging & DBG_TRACE ) + trace_flag = 1; + + if( ( debugging & DBG_SENT_TIMES ) && !loop_flag ) + sent_times_flag = 1; + + if( debugging & DBG_RANDOM_LOSE_FEW ) + { + randomly_lose_flag = 1; + lose_factor = 1; /* ie, 1/4 */ + + }/* IF */ + + if( debugging & DBG_RANDOM_LOSE_MANY ) + { + randomly_lose_flag = 1; + lose_factor = 5; /* ie, 3/4 */ + + }/* IF */ + + if( debugging & DBG_PRINT_PER_SYSTEM ) + print_per_system_flag = 1; + + if( ( debugging & DBG_REPORT_ALL_RTTS ) && !loop_flag ) + report_all_rtts_flag = 1; + + if( trace_flag ) + { + fprintf( stderr, "%s:\n count: %u, retry: %u, interval: %u\n", + prog, count, retry, interval / 10 ); + fprintf( stderr, " perhost_interval: %u, timeout: %u\n", + perhost_interval / 10, timeout / 10 ); + fprintf( stderr, " ping_data_size = %u, trials = %u\n", + ping_data_size, trials ); + + if( verbose_flag ) fprintf( stderr, " verbose_flag set\n" ); + if( multif_flag ) fprintf( stderr, " multif_flag set\n" ); + if( name_flag ) fprintf( stderr, " name_flag set\n" ); + if( addr_flag ) fprintf( stderr, " addr_flag set\n" ); + if( stats_flag ) fprintf( stderr, " stats_flag set\n" ); + if( unreachable_flag ) fprintf( stderr, " unreachable_flag set\n" ); + if( alive_flag ) fprintf( stderr, " alive_flag set\n" ); + if( elapsed_flag ) fprintf( stderr, " elapsed_flag set\n" ); + if( version_flag ) fprintf( stderr, " version_flag set\n" ); + if( count_flag ) fprintf( stderr, " count_flag set\n" ); + if( loop_flag ) fprintf( stderr, " loop_flag set\n" ); + if( backoff_flag ) fprintf( stderr, " backoff_flag set\n" ); + if( per_recv_flag ) fprintf( stderr, " per_recv_flag set\n" ); + if( report_all_rtts_flag ) fprintf( stderr, " report_all_rtts_flag set\n" ); + if( randomly_lose_flag ) fprintf( stderr, " randomly_lose_flag set\n" ); + if( sent_times_flag ) fprintf( stderr, " sent_times_flag set\n" ); + if( print_per_system_flag ) fprintf( stderr, " print_per_system_flag set\n" ); + + }/* IF */ +#endif /* DEBUG || _DEBUG */ + + /* handle host names supplied on command line or in a file */ + /* if the generate_flag is on, then generate the IP list */ + + argv = &argv[optind]; + + /* cover allowable conditions */ + + /* file and generate are mutually exclusive */ + /* file and command line are mutually exclusive */ + /* generate requires command line parameters beyond the switches */ + if( ( *argv && filename ) || ( filename && generate_flag ) || ( generate_flag && !*argv ) ) + usage(); + + /* if no conditions are specified, then assume input from stdin */ + if( !*argv && !filename && !generate_flag ) + filename = "-"; + + if( *argv && !generate_flag ) + { + while( *argv ) + { + add_name( *argv ); + ++argv; + + }/* WHILE */ + }/* IF */ + else if( filename ) + { + FILE *ping_file; + char line[132]; + char host[132]; + char *p; + + if( strcmp( filename, "-" ) == 0 ) + ping_file = fdopen( 0, "r" ); + else + ping_file = fopen( filename, "r" ); + + if( !ping_file ) + errno_crash_and_burn( "fopen" ); + + + while( fgets( line, 132, ping_file ) ) + { + if( sscanf( line, "%s", host ) != 1 ) + continue; + + if( ( !*host ) || ( host[0] == '#' ) ) /* magic to avoid comments */ + continue; + + p = cpystr( host ); + add_name( p ); + + }/* WHILE */ + + fclose( ping_file ); + + }/* ELSE IF */ + else if( *argv && generate_flag ) + { + char* pStart; + char* pEnd; + char* pCopy; + char* pTemp; + + struct in_addr sStart; + struct in_addr sEnd; + int iBits; + int iBitpos; + int iMask = 1; + int failed = 0; + unsigned long uTemp; + + /* two possible forms are allowed here */ + + pStart = *argv; + argv++; + + /* IP mask is specified */ + if( !*argv ) + { + pCopy = ( char* )malloc( sizeof( char ) * strlen( pStart ) + 1 ); + if( pCopy ) + { + /* make a copy of the arg, so we don't damage the original */ + strcpy( pCopy, pStart ); + + /* look for token '/' */ + if( strtok( pCopy, "/" ) != NULL ) + { + /* if no token was found, the string should be unaltered */ + if( strcmp( pCopy, pStart ) != 0 ) + { + /* convert it to the starting address */ + if( inet_addr( pCopy ) != INADDR_NONE ) + { + sStart.s_addr = inet_addr( pCopy ); + + /* now find the bitmask */ + pTemp = ( char* )pStart + strlen( pCopy ) + 1; + + /* get the bits */ + iBits = 32 - atoi( pTemp ); + + if( ( iBits < 32 ) && ( iBits >= 0 ) ) + { + /* now make the end address */ + for( iBitpos = 0; iBitpos < iBits; iBitpos++ ) + iMask = iMask | 1 << iBitpos; + + sEnd.s_addr = sStart.s_addr | ntohl( iMask ); + + }/* IF */ + else + failed = 1; + + }/* IF */ + else + failed = 1; + + }/* IF */ + else + failed = 1; + + }/* IF */ + else + failed = 1; + + free( pCopy ); + + if( failed == 1 ) + usage(); + + }/* IF */ + else + crash_and_burn( "Cannot malloc copy of input string" ); + + }/* IF */ + else + { + /* IP start and end points are specified */ + pEnd = *argv; + + /* parameters should be start and end ranges */ + if( ( inet_addr( pStart ) != INADDR_NONE ) && ( inet_addr( pEnd ) != INADDR_NONE ) ) + { + sStart.s_addr = inet_addr( pStart ); + sEnd.s_addr = inet_addr( pEnd ); + + }/* IF */ + else + usage(); + + }/* ELSE */ + + /* ensure that the end point is greater or equal to the start */ + if( htonl( sEnd.s_addr ) >= htonl( sStart.s_addr ) ) + { + /* start and end points should be determined, so generate list */ + unsigned int uiDiff; + struct in_addr sTemp; + int iCount; + + uiDiff = htonl( sEnd.s_addr ) - htonl( sStart.s_addr ) + 1; + + for( iCount = 0; iCount < uiDiff; iCount++ ) + { + sTemp.s_addr = sStart.s_addr + ntohl( iCount ); + pTemp = cpystr( inet_ntoa( sTemp ) ); + add_name( pTemp ); + + }/* FOR */ + }/* IF */ + else + usage(); + + }/* ELSE IF */ + else + usage(); + + if( !num_hosts ) + exit( 2 ); + + /* allocate array to hold outstanding ping requests */ + + table = ( HOST_ENTRY** )malloc( sizeof( HOST_ENTRY* ) * num_hosts ); + if( !table ) + crash_and_burn( "Can't malloc array of hosts" ); + + cursor = rrlist; + + for( num_jobs = 0; num_jobs < num_hosts; num_jobs++ ) + { + table[num_jobs] = cursor; + cursor->i = num_jobs; + + /* as long as we're here, put this in so names print out nicely */ + if( count_flag || loop_flag ) + { + n = max_hostname_len - strlen( cursor->host ); + buf = ( char* ) malloc( n + 1 ); + if( !buf ) + crash_and_burn( "can't malloc host pad" ); + + for ( i = 0; i < n; i++ ) + buf[i] = ' '; + + buf[n] = '\0'; + cursor->pad = buf; + + }/* IF */ + + cursor=cursor->next; + + }/* FOR */ + + ping_pkt_size = ping_data_size + SIZE_ICMP_HDR; + + signal( SIGINT, finish ); + + gettimeofday( &start_time, &tz ); + current_time = start_time; + + if( report_interval ) + last_report_time = start_time; + + last_send_time.tv_sec = current_time.tv_sec - 10000; + +#if defined( DEBUG ) || defined( _DEBUG ) + if( randomly_lose_flag ) + srandom( start_time.tv_usec ); +#endif /* DEBUG || _DEBUG */ + + cursor = rrlist; + advance = 0; + + /* main loop */ + + while( num_jobs ) + { + if( num_pingsent ) + while( wait_for_reply() ); /* call wfr until we timeout */ + + if( cursor && advance ) + cursor = cursor->next; + + gettimeofday( ¤t_time, &tz ); + lt = timeval_diff( ¤t_time, &last_send_time ); + ht = timeval_diff( ¤t_time, &cursor->last_send_time ); + + if( report_interval && ( loop_flag || count_flag ) && + ( timeval_diff ( ¤t_time, &last_report_time ) > report_interval ) ) + { + print_per_system_splits(); + gettimeofday( ¤t_time, &tz ); + lt = timeval_diff( ¤t_time, &last_send_time ); + ht = timeval_diff( ¤t_time, &cursor->last_send_time ); + last_report_time = current_time; + + }/* IF */ + + advance = 1; + +#if defined( DEBUG ) || defined( _DEBUG ) + if( trace_flag ) + { + printf( + "main loop:\n [%s, wait/run/sent/recv/timeout = %u/%u/%u/%u/%u], jobs/lt/ht = %u/%u/%u\n", + cursor->host, cursor->waiting, cursor->running, cursor->num_sent, + cursor->num_recv, cursor->timeout, num_jobs, lt, ht ); + + }/* IF */ +#endif /* DEBUG || _DEBUG */ + + /* if it's OK to send while counting or looping or starting */ + if( ( lt > interval ) && ( ht > perhost_interval ) ) + { + /* send if starting or looping */ + if( ( cursor->num_sent == 0 ) || loop_flag ) + { + send_ping( s, cursor ); + continue; + + }/* IF */ + + /* send if counting and count not exceeded */ + if( count_flag ) + { + if( cursor->num_sent < count ) + { + send_ping( s, cursor ); + continue; + + }/* IF */ + }/* IF */ + }/* IF */ + + /* is-it-alive mode, and timeout exceeded while waiting for a reply */ + /* and we haven't exceeded our retries */ + if( ( lt > interval ) && !count_flag && !loop_flag && !cursor->num_recv && + ( ht > cursor->timeout ) && ( cursor->waiting < retry + 1 ) ) + { +#if defined( DEBUG ) || defined( _DEBUG ) + if( trace_flag ) + printf( "main loop: timeout for %s\n", cursor->host ); +#endif /* DEBUG || _DEBUG */ + + num_timeout++; + + /* try again */ + if( backoff_flag ) + cursor->timeout *= backoff; + + send_ping( s, cursor ); + continue; + + }/* IF */ + + /* didn't send, can we remove? */ + +#if defined( DEBUG ) || defined( _DEBUG ) + if( trace_flag ) + printf( "main loop: didn't send to %s\n", cursor->host ); +#endif /* DEBUG || _DEBUG */ + + /* never remove if looping */ + if( loop_flag ) + continue; + + /* remove if counting and count exceeded */ + /* but allow time for the last one to come in */ + if( count_flag ) + { + if( ( cursor->num_sent >= count ) && ( ht > cursor->timeout ) ) + { + remove_job( cursor ); + continue; + + }/* IF */ + }/* IF */ + else + { + /* normal mode, and we got one */ + if( cursor->num_recv ) + { + remove_job( cursor ); + continue; + + }/* IF */ + + /* normal mode, and timeout exceeded while waiting for a reply */ + /* and we've run out of retries, so node is unreachable */ + if( ( ht > cursor->timeout ) && ( cursor->waiting >= retry + 1 ) ) + { +#if defined( DEBUG ) || defined( _DEBUG ) + if( trace_flag ) + printf( "main loop: timeout for %s\n", cursor->host ); +#endif /* DEBUG || _DEBUG */ + + num_timeout++; + remove_job( cursor ); + continue; + + }/* IF */ + }/* ELSE */ + + /* could send to this host, so keep considering it */ + if( ht > interval ) + advance = 0; + + }/* WHILE */ + + finish(); + +} /* main() */ + + +/************************************************************ + + Function: finish + +************************************************************* + + Inputs: void (none) + + Description: + + Main program clean up and exit point + +************************************************************/ + +#ifdef _NO_PROTO +void finish() +#else +void finish() +#endif /* _NO_PROTO */ +{ + int i; + HOST_ENTRY *h; + + gettimeofday( &end_time, &tz ); + + /* tot up unreachables */ + for( i = 0; i < num_hosts; i++ ) + { + h = table[i]; + + if( !h->num_recv ) + { + num_unreachable++; + + if( verbose_flag || unreachable_flag ) + { + printf( "%s", h->host ); + + if( verbose_flag ) + printf( " is unreachable" ); + + printf( "\n" ); + + }/* IF */ + }/* IF */ + }/* FOR */ + + if( count_flag || loop_flag ) + print_per_system_stats(); +#if defined( DEBUG ) || defined( _DEBUG ) + else if( print_per_system_flag ) + print_per_system_stats(); +#endif /* DEBUG || _DEBUG */ + + if( stats_flag ) + print_global_stats(); + + if( num_noaddress ) + exit( 2 ); + else if( num_alive != num_hosts ) + exit( 1 ); + + exit(0); + +} /* finish() */ + + +/************************************************************ + + Function: print_per_system_stats + +************************************************************* + + Inputs: void (none) + + Description: + + +************************************************************/ + +#ifdef _NO_PROTO +void print_per_system_stats() +#else +void print_per_system_stats( void ) +#endif /* _NO_PROTO */ +{ + int i, j, k, avg; + HOST_ENTRY *h; + char *buf; + int bufsize; + int resp; + + bufsize = max_hostname_len + 1; + buf = ( char* )malloc( bufsize ); + + if( !buf ) + crash_and_burn( "can't malloc print buf" ); + + memset( buf, 0, bufsize ); + + fflush( stdout ); + + if( verbose_flag || per_recv_flag ) + fprintf( stderr, "\n" ); + + for( i = 0; i < num_hosts; i++ ) + { + h = table[i]; + fprintf( stderr, "%s%s :", h->host, h->pad ); + + if( report_all_rtts_flag ) + { + for( j = 0; j < h->num_sent; j++ ) + { + if( ( resp = h->resp_times[j] ) >= 0 ) + fprintf( stderr, " %d.%02d", resp / 100, resp % 100 ); + else + fprintf( stderr, " -" ); + + }/* FOR */ + + fprintf( stderr, "\n" ); + + }/* IF */ + else + { + if( h->num_recv <= h->num_sent ) + { + fprintf( stderr, " xmt/rcv/%%loss = %d/%d/%d%%", + h->num_sent, h->num_recv, h->num_sent > 0 ? + ( ( h->num_sent - h->num_recv ) * 100 ) / h->num_sent : 0 ); + + }/* IF */ + else + { + fprintf( stderr, " xmt/rcv/%%return = %d/%d/%d%%", + h->num_sent, h->num_recv, + ( ( h->num_recv * 100 ) / h->num_sent ) ); + + }/* ELSE */ + + if( h->num_recv ) + { + avg = h->total_time / h->num_recv; + fprintf( stderr, ", min/avg/max = %s", sprint_tm( h->min_reply ) ); + fprintf( stderr, "/%s", sprint_tm( avg ) ); + fprintf( stderr, "/%s", sprint_tm( h->max_reply ) ); + + }/* IF */ + + fprintf(stderr, "\n"); + + }/* ELSE */ + +#if defined( DEBUG ) || defined( _DEBUG ) + if( sent_times_flag ) + { + for( j = 0; j < h->num_sent; j++ ) + { + if( ( resp = h->sent_times[j] ) >= 0 ) + fprintf( stderr, " %s", sprint_tm( resp ) ); + else + fprintf( stderr, " -" ); + + fprintf( stderr, "\n" ); + + }/* FOR */ + }/* IF */ +#endif /* DEBUG || _DEBUG */ + }/* FOR */ + + free( buf ); + +} /* print_per_system_stats() */ + + +/************************************************************ + + Function: print_per_system_splits + +************************************************************* + + Inputs: void (none) + + Description: + + +************************************************************/ + +#ifdef _NO_PROTO +void print_per_system_splits() +#else +void print_per_system_splits( void ) +#endif /* _NO_PROTO */ +{ + int i, j, k, avg; + HOST_ENTRY *h; + char *buf; + int bufsize; + int resp; + struct tm *curr_tm; + + bufsize = max_hostname_len + 1; + buf = ( char* )malloc( bufsize ); + if( !buf ) + crash_and_burn( "can't malloc print buf" ); + + memset( buf, 0, bufsize ); + + fflush( stdout ); + + if( verbose_flag || per_recv_flag ) + fprintf( stderr, "\n" ); + + curr_tm = localtime( ( time_t* )¤t_time.tv_sec ); + fprintf( stderr, "[%2.2d:%2.2d:%2.2d]\n", curr_tm->tm_hour, + curr_tm->tm_min, curr_tm->tm_sec ); + + for( i = 0; i < num_hosts; i++ ) + { + h = table[i]; + fprintf( stderr, "%s%s :", h->host, h->pad ); + + if( h->num_recv_i <= h->num_sent_i ) + { + fprintf( stderr, " xmt/rcv/%%loss = %d/%d/%d%%", + h->num_sent_i, h->num_recv_i, + ( ( h->num_sent_i - h->num_recv_i ) * 100 ) / h->num_sent_i ); + + }/* IF */ + else + { + fprintf( stderr, " xmt/rcv/%%return = %d/%d/%d%%", + h->num_sent_i, h->num_recv_i, + ( ( h->num_recv_i * 100 ) / h->num_sent_i ) ); + + }/* ELSE */ + + if( h->num_recv_i ) + { + avg = h->total_time_i / h->num_recv_i; + fprintf( stderr, ", min/avg/max = %s", sprint_tm( h->min_reply_i ) ); + fprintf( stderr, "/%s", sprint_tm( avg ) ); + fprintf( stderr, "/%s", sprint_tm( h->max_reply_i ) ); + + }/* IF */ + + fprintf( stderr, "\n" ); + h->num_sent_i = h->num_recv_i = h->max_reply_i = + h->min_reply_i = h->total_time_i = 0; + + }/* FOR */ + + free( buf ); + +} /* print_per_system_splits() */ + + +/************************************************************ + + Function: print_global_stats + +************************************************************* + + Inputs: void (none) + + Description: + + +************************************************************/ + +#ifdef _NO_PROTO +void print_global_stats() +#else +void print_global_stats( void ) +#endif /* _NO_PROTO */ +{ + fflush( stdout ); + fprintf( stderr, "\n" ); + fprintf( stderr, " %7d targets\n", num_hosts ); + fprintf( stderr, " %7d alive\n", num_alive ); + fprintf( stderr, " %7d unreachable\n" ,num_unreachable ); + fprintf( stderr, " %7d unknown addresses\n", num_noaddress ); + fprintf( stderr, "\n" ); + fprintf( stderr, " %7d timeouts (waiting for response)\n", num_timeout ); + fprintf( stderr, " %7d ICMP Echos sent\n", num_pingsent ); + fprintf( stderr, " %7d ICMP Echo Replies received\n", num_pingreceived ); + fprintf( stderr, " %7d other ICMP received\n", num_othericmprcvd ); + fprintf( stderr, "\n" ); + + if( total_replies == 0 ) + { + min_reply = 0; + max_reply = 0; + total_replies = 1; + sum_replies = 0; + + }/* IF */ + + fprintf( stderr, " %s ms (min round trip time)\n", sprint_tm( min_reply ) ); + fprintf( stderr, " %s ms (avg round trip time)\n", + sprint_tm( ( int )( sum_replies / total_replies ) ) ); + fprintf( stderr, " %s ms (max round trip time)\n", sprint_tm( max_reply ) ); + fprintf( stderr, " %12.3f sec (elapsed real time)\n", + timeval_diff( &end_time, &start_time ) / 100000.0 ); + fprintf( stderr, "\n" ); + +} /* print_global_stats() */ + + +/************************************************************ + + Function: send_ping + +************************************************************* + + Inputs: int s, HOST_ENTRY *h + + Description: + + Compose and transmit an ICMP_ECHO REQUEST packet. The IP packet + will be added on by the kernel. The ID field is our UNIX process ID, + and the sequence number is an index into an array of outstanding + ping requests. The sequence number will later be used to quickly + figure out who the ping reply came from. + +************************************************************/ + +#ifdef _NO_PROTO +void send_ping( s, h ) +int s; HOST_ENTRY *h; +#else +void send_ping( int s, HOST_ENTRY *h ) +#endif /* _NO_PROTO */ +{ + char *buffer; + FPING_ICMPHDR *icp; + PING_DATA *pdp; + int n; + + buffer = ( char* )malloc( ( size_t )ping_pkt_size ); + if( !buffer ) + crash_and_burn( "can't malloc ping packet" ); + + memset( buffer, 0, ping_pkt_size * sizeof( char ) ); + icp = ( FPING_ICMPHDR* )buffer; + + gettimeofday( &h->last_send_time, &tz ); +#ifndef IPV6 + icp->icmp_type = ICMP_ECHO; + icp->icmp_code = 0; + icp->icmp_cksum = 0; + icp->icmp_seq = h->i; + icp->icmp_id = ident; + + pdp = ( PING_DATA* )( buffer + SIZE_ICMP_HDR ); + pdp->ping_ts = h->last_send_time; + pdp->ping_count = h->num_sent; + + icp->icmp_cksum = in_cksum( ( u_short* )icp, ping_pkt_size ); +#else + icp->icmp6_type = ICMP6_ECHO_REQUEST; + icp->icmp6_code = 0; + icp->icmp6_seq = h->i; + icp->icmp6_id = ident; + + pdp = ( PING_DATA* )( buffer + SIZE_ICMP_HDR ); + pdp->ping_ts = h->last_send_time; + pdp->ping_count = h->num_sent; + + icp->icmp6_cksum = 0; // The IPv6 stack calculates the checksum for us... +#endif +#if defined(DEBUG) || defined(_DEBUG) + if( trace_flag ) + printf( "sending [%d] to %s\n", h->num_sent, h->host ); +#endif /* DEBUG || _DEBUG */ + + n = sendto( s, buffer, ping_pkt_size, 0, + ( struct sockaddr* )&h->saddr, sizeof( FPING_SOCKADDR ) ); + + if( n < 0 || n != ping_pkt_size ) + { + if( verbose_flag || unreachable_flag ) + { + printf( "%s", h->host ); + if( verbose_flag ) + printf( " error while sending ping: %s\n", strerror( errno ) ); + + printf( "\n" ); + + }/* IF */ + + num_unreachable++; + remove_job( h ); + + }/* IF */ + else + { + /* mark this trial as outstanding */ + if( !loop_flag ) + h->resp_times[h->num_sent] = RESP_WAITING; + +#if defined( DEBUG ) || defined( _DEBUG ) + if( sent_times_flag ) + h->sent_times[h->num_sent] = timeval_diff( &h->last_send_time, &start_time ); +#endif /* DEBUG || _DEBUG */ + + h->num_sent++; + h->num_sent_i++; + h->waiting++; + num_pingsent++; + last_send_time = h->last_send_time; + + }/* ELSE */ + + free( buffer ); + +} /* send_ping() */ + + +/************************************************************ + + Function: wait_for_reply + +************************************************************* + + Inputs: void (none) + + Returns: int + + Description: + + +************************************************************/ + +#ifdef _NO_PROTO +int wait_for_reply() +#else +int wait_for_reply( void ) +#endif +{ + int result; + static char buffer[4096]; + FPING_SOCKADDR response_addr; + struct ip *ip; + int hlen = 0; + FPING_ICMPHDR *icp; + int n, avg; + HOST_ENTRY *h; + long this_reply; + int this_count; + struct timeval sent_time; + + result = recvfrom_wto( s, buffer, sizeof(buffer), &response_addr, select_time ); + + if( result < 0 ) + return 0; /* timeout */ + +#if defined( DEBUG ) || defined( _DEBUG ) + if( randomly_lose_flag ) + { + if( ( random() & 0x07 ) <= lose_factor ) + return 0; + + }/* IF */ +#endif /* DEBUG || _DEBUG */ + + ip = ( struct ip* )buffer; +#ifndef IPV6 +#if defined( __alpha__ ) && __STDC__ && !defined( __GLIBC__ ) + /* The alpha headers are decidedly broken. + * Using an ANSI compiler, it provides ip_vhl instead of ip_hl and + * ip_v. So, to get ip_hl, we mask off the bottom four bits. + */ + hlen = ( ip->ip_vhl & 0x0F ) << 2; +#else + hlen = ip->ip_hl << 2; +#endif /* defined(__alpha__) && __STDC__ */ + if( result < hlen + ICMP_MINLEN ) +#else + if( result < sizeof(FPING_ICMPHDR) ) +#endif + { + if( verbose_flag ) + { +#ifndef IPV6 + printf( "received packet too short for ICMP (%d bytes from %s)\n", result, + inet_ntoa( response_addr.sin_addr ) ); +#else + char buf[INET6_ADDRSTRLEN]; + inet_ntop(response_addr.sin6_family, &response_addr.sin6_addr, buf, INET6_ADDRSTRLEN); + printf( "received packet too short for ICMP (%d bytes from %s)\n", result, buf); +#endif + } + return( 1 ); /* too short */ + }/* IF */ + + icp = ( FPING_ICMPHDR* )( buffer + hlen ); +#ifndef IPV6 + if( icp->icmp_type != ICMP_ECHOREPLY ) +#else + if( icp->icmp6_type != ICMP6_ECHO_REPLY ) +#endif + { + /* handle some problem */ + if( handle_random_icmp( icp, result, &response_addr ) ) + num_othericmprcvd++; + return 1; + }/* IF */ + +#ifndef IPV6 + if( icp->icmp_id != ident ) +#else + if( icp->icmp6_id != ident ) +#endif + return 1; /* packet received, but not the one we are looking for! */ + + num_pingreceived++; + +#ifndef IPV6 + if( icp->icmp_seq >= ( n_short )num_hosts ) +#else + if( icp->icmp6_seq >= ( n_short )num_hosts ) +#endif + return( 1 ); /* packet received, don't worry about it anymore */ + +#ifndef IPV6 + n = icp->icmp_seq; +#else + n = icp->icmp6_seq; +#endif + h = table[n]; + + /* received ping is cool, so process it */ + gettimeofday( ¤t_time, &tz ); + h->waiting = 0; + h->timeout = timeout; + h->num_recv++; + h->num_recv_i++; + +#ifndef IPV6 + memcpy( &sent_time, icp->icmp_data + offsetof( PING_DATA, ping_ts ), sizeof( sent_time ) ); + memcpy( &this_count, icp->icmp_data, sizeof( this_count ) ); +#else + memcpy( &sent_time, ((char *)icp->icmp6_data32)+4+offsetof(PING_DATA, ping_ts), sizeof( sent_time ) ); + memcpy( &this_count, ((char *)icp->icmp6_data32)+4, sizeof( this_count ) ); +#endif + +#if defined( DEBUG ) || defined( _DEBUG ) + if( trace_flag ) + printf( "received [%d] from %s\n", this_count, h->host ); +#endif /* DEBUG || _DEBUG */ + + this_reply = timeval_diff( ¤t_time, &sent_time ); + if( this_reply > max_reply ) max_reply = this_reply; + if( this_reply < min_reply ) min_reply = this_reply; + if( this_reply > h->max_reply ) h->max_reply = this_reply; + if( this_reply < h->min_reply ) h->min_reply = this_reply; + if( this_reply > h->max_reply_i ) h->max_reply_i = this_reply; + if( this_reply < h->min_reply_i ) h->min_reply_i = this_reply; + sum_replies += this_reply; + h->total_time += this_reply; + h->total_time_i += this_reply; + total_replies++; + + /* note reply time in array, probably */ + if( !loop_flag ) + { + if( ( this_count >= 0 ) && ( this_count < trials ) ) + { + if( h->resp_times[this_count] != RESP_WAITING ) + { + if( !per_recv_flag ) + { + fprintf( stderr, "%s : duplicate for [%d], %d bytes, %s ms", + h->host, this_count, result, sprint_tm( this_reply ) ); +#ifndef IPV6 + if( response_addr.sin_addr.s_addr != h->saddr.sin_addr.s_addr ) + fprintf( stderr, " [<- %s]", inet_ntoa( response_addr.sin_addr ) ); +#else + if(memcmp(&response_addr.sin6_addr, &h->saddr.sin6_addr, sizeof(response_addr.sin6_addr))) + { + char buf[INET6_ADDRSTRLEN]; + inet_ntop(response_addr.sin6_family, &response_addr.sin6_addr, buf, INET6_ADDRSTRLEN); + + fprintf( stderr, " [<- %s]", buf); + } +#endif + fprintf( stderr, "\n" ); + + }/* IF */ + }/* IF */ + else + h->resp_times[this_count] = this_reply; + + }/* IF */ + else + { + /* count is out of bounds?? */ + fprintf( stderr, "%s : duplicate for [%d], %d bytes, %s ms\n", + h->host, this_count, result, sprint_tm( this_reply ) ); + + }/* ELSE */ + }/* IF */ + + if( h->num_recv == 1 ) + { + num_alive++; + if( verbose_flag || alive_flag ) + { + printf( "%s", h->host ); + + if( verbose_flag ) + printf( " is alive" ); + + if( elapsed_flag ) + printf( " (%s ms)", sprint_tm( this_reply ) ); +#ifndef IPV6 + if( response_addr.sin_addr.s_addr != h->saddr.sin_addr.s_addr ) + printf( " [<- %s]", inet_ntoa( response_addr.sin_addr ) ); +#else + if(memcmp(&response_addr.sin6_addr, &h->saddr.sin6_addr, sizeof(response_addr.sin6_addr))) + { + char buf[INET6_ADDRSTRLEN]; + inet_ntop(response_addr.sin6_family, &response_addr.sin6_addr, buf, INET6_ADDRSTRLEN); + fprintf( stderr, " [<- %s]", buf); + } +#endif + printf( "\n" ); + + }/* IF */ + }/* IF */ + + if( per_recv_flag ) + { + avg = h->total_time / h->num_recv; + printf( "%s%s : [%d], %d bytes, %s ms", + h->host, h->pad, this_count, result, sprint_tm( this_reply ) ); + printf( " (%s avg, ", sprint_tm( avg ) ); + + if( h->num_recv <= h->num_sent ) + { + printf( "%d%% loss)", + ( ( h->num_sent - h->num_recv ) * 100 ) / h->num_sent ); + + }/* IF */ + else + { + printf( "%d%% return)", + ( h->num_recv * 100 ) / h->num_sent ); + + }/* ELSE */ +#ifndef IPV6 + if( response_addr.sin_addr.s_addr != h->saddr.sin_addr.s_addr ) + printf( " [<- %s]", inet_ntoa( response_addr.sin_addr ) ); +#else + if(memcmp(&response_addr.sin6_addr, &h->saddr.sin6_addr, sizeof(response_addr.sin6_addr))) + { + char buf[INET6_ADDRSTRLEN]; + inet_ntop(response_addr.sin6_family, &response_addr.sin6_addr, buf, INET6_ADDRSTRLEN); + fprintf( stderr, " [<- %s]", buf); + } +#endif + + printf( "\n" ); + + }/* IF */ + + return num_jobs; + +} /* wait_for_reply() */ + +/************************************************************ + + Function: handle_random_icmp + +************************************************************* + + Inputs: FPING_ICMPHDR *p, int psize, FPING_SOCKADDR *addr + + Returns: int + + Description: + + +************************************************************/ + +#ifdef _NO_PROTO +int handle_random_icmp( p, psize, addr ) + FPING_ICMPHDR *p; + int psize; + FPING_SOCKADDR *addr; +#else +int handle_random_icmp( FPING_ICMPHDR *p, int psize, FPING_SOCKADDR *addr ) +#endif /* _NO_PROTO */ +{ + FPING_ICMPHDR *sent_icmp; + struct ip *sent_ip; + u_char *c; + HOST_ENTRY *h; +#ifdef IPV6 + char addr_ascii[INET6_ADDRSTRLEN]; + inet_ntop(addr->sin6_family, &addr->sin6_addr, addr_ascii, INET6_ADDRSTRLEN); +#endif + + c = ( u_char* )p; +#ifndef IPV6 + switch( p->icmp_type ) +#else + switch( p->icmp6_type ) +#endif + { + case ICMP_UNREACH: + sent_icmp = ( FPING_ICMPHDR* )( c + 28 ); + +#ifndef IPV6 + sent_icmp = ( struct icmp* )( c + 28 ); + + if( ( sent_icmp->icmp_type == ICMP_ECHO ) && + ( sent_icmp->icmp_id == ident ) && + ( sent_icmp->icmp_seq < ( n_short )num_hosts ) ) + { + /* this is a response to a ping we sent */ + h = table[sent_icmp->icmp_seq]; + + if( p->icmp_code > ICMP_UNREACH_MAXTYPE ) + { + fprintf( stderr, "ICMP Unreachable (Invalid Code) from %s for ICMP Echo sent to %s", + inet_ntoa( addr->sin_addr ), h->host ); + +#else + if( ( sent_icmp->icmp6_type == ICMP_ECHO ) && + ( sent_icmp->icmp6_id == ident ) && + ( sent_icmp->icmp6_seq < ( n_short )num_hosts ) ) + { + /* this is a response to a ping we sent */ + h = table[sent_icmp->icmp6_seq]; + + if( p->icmp6_code > ICMP_UNREACH_MAXTYPE ) + { + fprintf( stderr, "ICMP Unreachable (Invalid Code) from %s for ICMP Echo sent to %s", + addr_ascii, h->host ); +#endif + }/* IF */ + else + { + fprintf( stderr, "%s from %s for ICMP Echo sent to %s", +#ifndef IPV6 + icmp_unreach_str[p->icmp_code], inet_ntoa( addr->sin_addr ), h->host ); +#else + icmp_unreach_str[p->icmp6_code], addr_ascii, h->host ); +#endif + + }/* ELSE */ + + if( inet_addr( h->host ) == -1 ) +#ifndef IPV6 + fprintf( stderr, " (%s)", inet_ntoa( h->saddr.sin_addr ) ); +#else + fprintf( stderr, " (%s)", addr_ascii); +#endif + + fprintf( stderr, "\n" ); + + }/* IF */ + + return 1; + + case ICMP_SOURCEQUENCH: + case ICMP_REDIRECT: + case ICMP_TIMXCEED: + case ICMP_PARAMPROB: + sent_icmp = ( FPING_ICMPHDR* )( c + 28 ); +#ifndef IPV6 + if( ( sent_icmp->icmp_type = ICMP_ECHO ) && + ( sent_icmp->icmp_id = ident ) && + ( sent_icmp->icmp_seq < ( n_short )num_hosts ) ) + { + /* this is a response to a ping we sent */ + h = table[sent_icmp->icmp_seq]; + fprintf( stderr, "%s from %s for ICMP Echo sent to %s", + icmp_type_str[p->icmp_type], inet_ntoa( addr->sin_addr ), h->host ); + + if( inet_addr( h->host ) == -1 ) + fprintf( stderr, " (%s)", inet_ntoa( h->saddr.sin_addr ) ); +#else + if( ( sent_icmp->icmp6_type = ICMP_ECHO ) && + ( sent_icmp->icmp6_id = ident ) && + ( sent_icmp->icmp6_seq < ( n_short )num_hosts ) ) + { + /* this is a response to a ping we sent */ + h = table[sent_icmp->icmp6_seq]; + fprintf( stderr, "%s from %s for ICMP Echo sent to %s", + icmp_type_str[p->icmp6_type], addr_ascii, h->host ); + + if( inet_addr( h->host ) == -1 ) + fprintf( stderr, " (%s)", addr_ascii ); +#endif + + fprintf( stderr, "\n" ); + + }/* IF */ + + return 2; + + /* no way to tell whether any of these are sent due to our ping */ + /* or not (shouldn't be, of course), so just discard */ + case ICMP_TSTAMP: + case ICMP_TSTAMPREPLY: + case ICMP_IREQ: + case ICMP_IREQREPLY: + case ICMP_MASKREQ: + case ICMP_MASKREPLY: + default: + return 0; + + }/* SWITCH */ + +} /* handle_random_icmp() */ + + +/************************************************************ + + Function: in_cksum + +************************************************************* + + Inputs: u_short *p, int n + + Returns: int + + Description: + + Checksum routine for Internet Protocol family headers (C Version) + From ping examples in W.Richard Stevens "UNIX NETWORK PROGRAMMING" book. + +************************************************************/ + +#ifdef _NO_PROTO +int in_cksum( p, n ) +u_short *p; int n; +#else +int in_cksum( u_short *p, int n ) +#endif /* _NO_PROTO */ +{ + register u_short answer; + register long sum = 0; + u_short odd_byte = 0; + + while( n > 1 ) + { + sum += *p++; + n -= 2; + + }/* WHILE */ + + + /* mop up an odd byte, if necessary */ + if( n == 1 ) + { + *( u_char* )( &odd_byte ) = *( u_char* )p; + sum += odd_byte; + + }/* IF */ + + sum = ( sum >> 16 ) + ( sum & 0xffff ); /* add hi 16 to low 16 */ + sum += ( sum >> 16 ); /* add carry */ + answer = ~sum; /* ones-complement, truncate*/ + + return ( answer ); + +} /* in_cksum() */ + + +/************************************************************ + + Function: add_name + +************************************************************* + + Inputs: char* name + + Description: + + process input name for addition to target list + name can turn into multiple targets via multiple interfaces (-m) + or via NIS groups + +************************************************************/ + +#ifdef _NO_PROTO +void add_name( name ) +char *name; +#else +void add_name( char *name ) +#endif /* _NO_PROTO */ +{ +#ifndef IPV6 + struct hostent *host_ent; + u_int ipaddress; + struct in_addr *ipa = ( struct in_addr* )&ipaddress; + struct in_addr *host_add; + char *nm; + int i = 0; + + if( ( ipaddress = inet_addr( name ) ) != -1 ) + { + /* input name is an IP addr, go with it */ + if( name_flag ) + { + if( addr_flag ) + add_addr( name, na_cat( get_host_by_address( *ipa ), *ipa ), *ipa ); + else + { + nm = cpystr( get_host_by_address( *ipa ) ); + add_addr( name, nm, *ipa ); + + }/* ELSE */ + }/* IF */ + else + add_addr( name, name, *ipa ); + + return; + + }/* IF */ + + /* input name is not an IP addr, maybe it's a host name */ + host_ent = gethostbyname( name ); + if( host_ent == NULL ) + { + if( h_errno == TRY_AGAIN ) + { + u_sleep( DNS_TIMEOUT ); + host_ent = gethostbyname( name ); + + }/* IF */ + + if( host_ent == NULL ) + { +#ifdef NIS_GROUPS + + /* maybe it's the name of a NIS netgroup */ + char *machine, *user_ignored, *domain_ignored; + setnetgrent( name ); + if( getnetgrent( &machine, &user_ignored, &domain_ignored ) == 0 ) + { + endnetgrent(); + if( !quiet_flag ) + fprintf( stderr, "%s address not found\n", name ); + + num_noaddress++; + return; + + }/* IF */ + else + add_name( cpystr( machine ) ); + + while( getnetgrent( &machine, &user_ignored, &domain_ignored ) ) + add_name( cpystr( machine ) ); + + endnetgrent(); + return; +#else + if( !quiet_flag ) + fprintf( stderr, "%s address not found\n", name ); + + num_noaddress++; + return ; +#endif /* NIS_GROUPS */ + }/* IF */ + }/* IF */ + + host_add = ( struct in_addr* )*( host_ent->h_addr_list ); + if( host_add == NULL ) + { + if( !quiet_flag ) + fprintf( stderr, "%s has no address data\n", name ); + + num_noaddress++; + return; + + }/* IF */ + else + { + /* it is indeed a hostname with a real address */ + while( host_add ) + { + if( name_flag && addr_flag ) + add_addr( name, na_cat( name, *host_add ), *host_add ); + else if( addr_flag ) + { + nm = cpystr( inet_ntoa( *host_add ) ); + add_addr( name, nm, *host_add ); + }/* ELSE IF */ + else + add_addr( name, name, *host_add ); + + if( !multif_flag ) + break; + + host_add = ( struct in_addr* )( host_ent->h_addr_list[++i] ); + + }/* WHILE */ + }/* ELSE */ +#else + FPING_SOCKADDR dst; + struct addrinfo *res, hints; + int ret_ga; + char *hostname; + + /* getaddrinfo */ + bzero(&hints, sizeof(struct addrinfo)); + hints.ai_flags = AI_CANONNAME; + hints.ai_family = AF_INET6; + hints.ai_socktype = SOCK_RAW; + hints.ai_protocol = IPPROTO_ICMPV6; + + ret_ga = getaddrinfo(name, NULL, &hints, &res); + if (ret_ga) errx(1, "%s", gai_strerror(ret_ga)); + if (res->ai_canonname) hostname = res->ai_canonname; + else hostname = name; + if (!res->ai_addr) errx(1, "getaddrinfo failed"); + (void)memcpy(&dst, res->ai_addr, sizeof(FPING_SOCKADDR)); /*res->ai_addrlen);*/ + add_addr(name, name, &dst); +#endif +} /* add_name() */ + + +/************************************************************ + + Function: na_cat + +************************************************************* + + Inputs: char* name, struct in_addr ipaddr + + Returns: char* + + Description: + +************************************************************/ + +#ifdef _NO_PROTO +char *na_cat( name, ipaddr ) +char *name; +struct in_addr ipaddr; +#else +char *na_cat( char *name, struct in_addr ipaddr ) +#endif /* _NO_PROTO */ +{ + char *nm, *as; + + as = inet_ntoa( ipaddr ); + nm = ( char* )malloc( strlen( name ) + strlen( as ) + 4 ); + + if( !nm ) + crash_and_burn( "can't allocate some space for a string" ); + + strcpy( nm, name ); + strcat( nm, " (" ); + strcat( nm, as ); + strcat( nm, ")" ); + + return( nm ); + +} /* na_cat() */ + + +/************************************************************ + + Function: add_addr + +************************************************************* + + Inputs: char* name, char* host, struct in_addr ipaddr + + Description: + + add address to linked list of targets to be pinged + assume memory for *name and *host is ours!!! + +************************************************************/ + +#ifdef _NO_PROTO +void add_addr( name, host, ipaddr ) +char *name; +char *host; +#ifndef IPV6 +struct in_addr ipaddr; +#else +FPING_SOCKADDR *ipaddr; +#endif +#else +#ifndef IPV6 +void add_addr( char *name, char *host, struct in_addr ipaddr ) +#else +void add_addr( char *name, char *host, FPING_SOCKADDR *ipaddr ) +#endif +#endif /* _NO_PROTO */ +{ + HOST_ENTRY *p; + int n, *i; + + p = ( HOST_ENTRY* )malloc( sizeof( HOST_ENTRY ) ); + if( !p ) + crash_and_burn( "can't allocate HOST_ENTRY" ); + + memset( ( char* ) p, 0, sizeof( HOST_ENTRY ) ); + + p->name = name; + p->host = host; +#ifndef IPV6 + p->saddr.sin_family = AF_INET; + p->saddr.sin_addr = ipaddr; +#else + p->saddr.sin6_family = AF_INET6; + (void)memcpy(&p->saddr, ipaddr, sizeof(FPING_SOCKADDR)); +#endif + p->timeout = timeout; + p->running = 1; + p->min_reply = 10000000; + + if( strlen( p->host ) > max_hostname_len ) + max_hostname_len = strlen( p->host ); + + /* array for response time results */ + if( !loop_flag ) + { + i = ( int* )malloc( trials * sizeof( int ) ); + if( !i ) + crash_and_burn( "can't allocate resp_times array" ); + + for( n = 1; n < trials; n++ ) + i[n] = RESP_UNUSED; + + p->resp_times = i; + + }/* IF */ + +#if defined( DEBUG ) || defined( _DEBUG ) + /* likewise for sent times */ + if( sent_times_flag ) + { + i = ( int* )malloc( trials * sizeof( int ) ); + if( !i ) + crash_and_burn( "can't allocate sent_times array" ); + + for( n = 1; n < trials; n++ ) + i[n] = RESP_UNUSED; + + p->sent_times = i; + + }/* IF */ +#endif /* DEBUG || _DEBUG */ + + if( !rrlist ) + { + rrlist = p; + p->next = p; + p->prev = p; + + }/* IF */ + else + { + p->next = rrlist; + p->prev = rrlist->prev; + p->prev->next = p; + p->next->prev = p; + + }/* ELSE */ + + num_hosts++; + +} /* add_addr() */ + + +/************************************************************ + + Function: remove_job + +************************************************************* + + Inputs: HOST_ENTRY *h + + Description: + +************************************************************/ + +#ifdef _NO_PROTO +void remove_job( h ) +HOST_ENTRY *h; +#else +void remove_job( HOST_ENTRY *h ) +#endif /* _NO_PROTO */ +{ +#if defined( DEBUG ) || defined( _DEBUG ) + if( trace_flag ) + printf( "removing job for %s\n", h->host ); +#endif /* DEBUG || _DEBUG */ + + h->running = 0; + h->waiting = 0; + --num_jobs; + + if( num_jobs ) + { + /* remove us from list of active jobs */ + h->prev->next = h->next; + h->next->prev = h->prev; + if( h==cursor ) + cursor = h->next; + + }/* IF */ + else + { + cursor = NULL; + rrlist = NULL; + + }/* ELSE */ + +} /* remove_job() */ + + +/************************************************************ + + Function: get_host_by_address + +************************************************************* + + Inputs: struct in_addr in + + Returns: char* + + Description: + +************************************************************/ + +#ifdef _NO_PROTO +char *get_host_by_address( in ) +struct in_addr in; +#else +char *get_host_by_address( struct in_addr in ) +#endif /* _NO_PROTO */ +{ + struct hostent *h; +#ifndef IPV6 + h = gethostbyaddr( ( char* )&in, sizeof( struct in_addr ),AF_INET ); +#else + h = gethostbyaddr( ( char* )&in, sizeof( FPING_SOCKADDR ),AF_INET6 ); +#endif + + if( h == NULL || h->h_name == NULL ) + return inet_ntoa( in ); + else + return ( char* )h->h_name; + +} /* get_host_by_address() */ + + +/************************************************************ + + Function: cpystr + +************************************************************* + + Inputs: char* string + + Returns: char* + + Description: + +************************************************************/ + +#ifdef _NO_PROTO +char *cpystr( string ) +char *string; +#else +char *cpystr( char *string ) +#endif /* _NO_PROTO */ +{ + char *dst; + + if( string ) + { + dst = ( char* )malloc( 1 + strlen( string ) ); + if( !dst ) + crash_and_burn( "can't allocate some space for a string" ); + + strcpy( dst, string ); + return dst; + + }/* IF */ + else + return NULL; + +} /* cpystr() */ + + +/************************************************************ + + Function: crash_and_burn + +************************************************************* + + Inputs: char* message + + Description: + +************************************************************/ + +#ifdef _NO_PROTO +void crash_and_burn( message ) +char *message; +#else +void crash_and_burn( char *message ) +#endif /* _NO_PROTO */ +{ + if( verbose_flag ) + fprintf( stderr, "%s: %s\n", prog, message ); + + exit( 4 ); + +} /* crash_and_burn() */ + + +/************************************************************ + + Function: errno_crash_and_burn + +************************************************************* + + Inputs: char* message + + Description: + +************************************************************/ + +#ifdef _NO_PROTO +void errno_crash_and_burn( message ) +char *message; +#else +void errno_crash_and_burn( char *message ) +#endif /* _NO_PROTO */ +{ + if( verbose_flag ) + fprintf( stderr, "%s: %s : %s\n", prog, message, strerror( errno ) ); + + exit( 4 ); + +} /* errno_crash_and_burn() */ + + +/************************************************************ + + Function: timeval_diff + +************************************************************* + + Inputs: struct timeval *a, struct timeval *b + + Returns: long + + Description: + + timeval_diff now returns result in hundredths of milliseconds + ie, tens of microseconds + +************************************************************/ + +#ifdef _NO_PROTO +long timeval_diff( a, b ) +struct timeval *a, *b; +#else +long timeval_diff( struct timeval *a, struct timeval *b ) +#endif /* _NO_PROTO */ +{ + double temp; + + temp = ( ( ( a->tv_sec * 1000000 ) + a->tv_usec ) - + ( ( b->tv_sec * 1000000 ) + b->tv_usec ) ) / 10; + + return ( long )temp; + +} /* timeval_diff() */ + +/************************************************************ + + Function: sprint_tm + +************************************************************* + + Inputs: int t + + Returns: char* + + Description: + + render time into a string with three digits of precision + input is in tens of microseconds + +************************************************************/ + +#ifdef _NO_PROTO +char * sprint_tm( t ) +int t; +#else +char * sprint_tm( int t ) +#endif /* _NO_PROTO */ +{ + static char buf[10]; + + /* <= 0.99 ms */ + if( t < 100 ) + { + sprintf( buf, "0.%02d", t ); + return( buf ); + + }/* IF */ + + /* 1.00 - 9.99 ms */ + if( t < 1000 ) + { + sprintf( buf, "%d.%02d", t / 100, t % 100 ); + return( buf ); + + }/* IF */ + + /* 10.0 - 99.9 ms */ + if( t < 10000 ) + { + sprintf( buf, "%d.%d", t / 100, ( t % 100 ) / 10 ); + return( buf ); + + }/* IF */ + + /* >= 100 ms */ + sprintf( buf, "%d", t / 100 ); + return( buf ); + +} /* sprint_tm() */ + + +/************************************************************ + + Function: u_sleep + +************************************************************* + + Inputs: int u_sec + + Description: + +************************************************************/ + +#ifdef _NO_PROTO +void u_sleep( u_sec ) +int u_sec; +#else +void u_sleep( int u_sec ) +#endif /* _NO_PROTO */ +{ + int nfound, slen, n; + struct timeval to; + fd_set readset, writeset; + + to.tv_sec = u_sec / 1000000; + to.tv_usec = u_sec - ( to.tv_sec * 1000000 ); + + FD_ZERO( &readset ); + FD_ZERO( &writeset ); + nfound = select( 0, &readset, &writeset, NULL, &to ); + if( nfound < 0 ) + errno_crash_and_burn( "select" ); + + return; + +} /* u_sleep() */ + + +/************************************************************ + + Function: recvfrom_wto + +************************************************************* + + Inputs: int s, char* buf, int len, FPING_SOCKADDR *saddr, int timo + + Returns: int + + Description: + + receive with timeout + returns length of data read or -1 if timeout + crash_and_burn on any other errrors + +************************************************************/ + +#ifdef _NO_PROTO +int recvfrom_wto( s, buf, len, saddr, timo ) +int s; char *buf; int len; FPING_SOCKADDR *saddr; int timo; +#else +int recvfrom_wto( int s, char *buf, int len, FPING_SOCKADDR *saddr, int timo ) +#endif /* _NO_PROTO */ +{ + int nfound, slen, n; + struct timeval to; + fd_set readset, writeset; + + to.tv_sec = timo / 100000; + to.tv_usec = ( timo - ( to.tv_sec * 100000 ) ) * 10; + + FD_ZERO( &readset ); + FD_ZERO( &writeset ); + FD_SET( s, &readset ); + nfound = select( s + 1, &readset, &writeset, NULL, &to ); + if( nfound < 0 ) + errno_crash_and_burn( "select" ); + + if( nfound == 0 ) + return -1; /* timeout */ + +#ifndef IPV6 + slen = sizeof( struct sockaddr ); +#else + slen = sizeof( FPING_SOCKADDR ); +#endif + n = recvfrom( s, buf, len, 0, (struct sockaddr *)saddr, &slen ); + if( n < 0 ) + errno_crash_and_burn( "recvfrom" ); + + return n; + +} /* recvfrom_wto() */ + + +/************************************************************ + + Function: usage + +************************************************************* + + Inputs: none (void) + + Description: + +************************************************************/ + +#ifdef _NO_PROTO +void usage() +#else +void usage( void ) +#endif /* _NO_PROTO */ +{ + fprintf( stderr, "\n" ); + fprintf( stderr, "Usage: %s [options] [targets...]\n", prog ); + fprintf( stderr, " -a show targets that are alive\n" ); + fprintf( stderr, " -A show targets by address\n" ); + fprintf( stderr, " -b n amount of ping data to send, in bytes (default %d)\n", ping_data_size ); + fprintf( stderr, " -B f set exponential backoff factor to f\n" ); + fprintf( stderr, " -c n count of pings to send to each target (default %d)\n", count ); + fprintf( stderr, " -C n same as -c, report results in verbose format\n" ); + fprintf( stderr, " -e show elapsed time on return packets\n" ); + fprintf( stderr, " -f file read list of targets from a file ( - means stdin) (only if no -g specified)\n" ); + fprintf( stderr, " -g generate target list (only if no -f specified)\n" ); + fprintf( stderr, " (specify the start and end IP in the target list, or supply a IP netmask)\n" ); + fprintf( stderr, " (ex. %s -g 192.168.1.0 192.168.1.255 or %s -g 192.168.1.0/24)\n", prog, prog ); + fprintf( stderr, " -i n interval between sending ping packets (in millisec) (default %d)\n", interval / 100 ); + fprintf( stderr, " -l loop sending pings forever\n" ); + fprintf( stderr, " -m ping multiple interfaces on target host\n" ); + fprintf( stderr, " -n show targets by name (-d is equivalent)\n" ); + fprintf( stderr, " -p n interval between ping packets to one target (in millisec)\n" ); + fprintf( stderr, " (in looping and counting modes, default %d)\n", perhost_interval / 100 ); + fprintf( stderr, " -q quiet (don't show per-target/per-ping results)\n" ); + fprintf( stderr, " -Q n same as -q, but show summary every n seconds\n" ); + fprintf( stderr, " -r n number of retries (default %d)\n", retry ); + fprintf( stderr, " -s print final stats\n" ); + fprintf( stderr, " -t n individual target initial timeout (in millisec) (default %d)\n", timeout / 100 ); + fprintf( stderr, " -u show targets that are unreachable\n" ); + fprintf( stderr, " -v show version\n" ); + fprintf( stderr, " targets list of targets to check (if no -f specified)\n" ); + fprintf( stderr, "\n"); + exit( 3 ); + +} /* usage() */ diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..5871924 --- /dev/null +++ b/install-sh @@ -0,0 +1,238 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/linux.h b/linux.h new file mode 100755 index 0000000..ef265c7 --- /dev/null +++ b/linux.h @@ -0,0 +1,133 @@ +/* +** Special compatibility definitions for linux. +** +** On the linux platform, several IP-related structures have +** different names. Also some of the structure fields have +** other names, although the layout is (obviously) fixed. +** Several constants are not defined in the standard files. +** +** @(#)linux.h e07@nikhef.nl (Eric Wassenaar) 960301 +*/ + +#if defined(linux) + +#include /* to get the proper BYTE_ORDER */ + +#if !defined(BYTE_ORDER) || (BYTE_ORDER != BIG_ENDIAN && \ + BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != PDP_ENDIAN) +error "Undefined or invalid BYTE_ORDER"; +#endif + +/* + * Structure of an ip header, without options. + */ + +#define IPVERSION 4 + +struct ip { +#if (BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN) + u_char ip_hl:4, /* header length */ + ip_v:4; /* version */ +#else + u_char ip_v:4, /* version */ + ip_hl:4; /* header length */ +#endif + u_char ip_tos; /* type of service */ + short ip_len; /* total length */ + u_short ip_id; /* identification */ + short ip_off; /* fragment offset field */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +#define IP_MAXPACKET 65535 /* maximum packet size */ + +/* + * Structure of an icmp header. + */ + +struct icmp { + u_char icmp_type; /* type of message, see below */ + u_char icmp_code; /* type sub code */ + u_short icmp_cksum; /* ones complement cksum of struct */ + union { + u_char ih_pptr; /* ICMP_PARAMPROB */ + struct in_addr ih_gwaddr; /* ICMP_REDIRECT */ + struct ih_idseq { + n_short icd_id; + n_short icd_seq; + } ih_idseq; + int ih_void; + } icmp_hun; +#define icmp_pptr icmp_hun.ih_pptr +#define icmp_gwaddr icmp_hun.ih_gwaddr +#define icmp_id icmp_hun.ih_idseq.icd_id +#define icmp_seq icmp_hun.ih_idseq.icd_seq +#define icmp_void icmp_hun.ih_void + union { + struct id_ts { + n_time its_otime; + n_time its_rtime; + n_time its_ttime; + } id_ts; + struct id_ip { + struct ip idi_ip; + /* options and then 64 bits of data */ + } id_ip; + u_long id_mask; + char id_data[1]; + } icmp_dun; +#define icmp_otime icmp_dun.id_ts.its_otime +#define icmp_rtime icmp_dun.id_ts.its_rtime +#define icmp_ttime icmp_dun.id_ts.its_ttime +#define icmp_ip icmp_dun.id_ip.idi_ip +#define icmp_mask icmp_dun.id_mask +#define icmp_data icmp_dun.id_data +}; + +#define ICMP_MINLEN 8 /* abs minimum */ + +/* + * Definition of icmp type and code field values. + */ + +#define ICMP_ECHOREPLY 0 /* echo reply */ +#define ICMP_UNREACH 3 /* dest unreachable, codes: */ +#define ICMP_UNREACH_NET 0 /* bad net */ +#define ICMP_UNREACH_HOST 1 /* bad host */ +#define ICMP_UNREACH_PROTOCOL 2 /* bad protocol */ +#define ICMP_UNREACH_PORT 3 /* bad port */ +#define ICMP_UNREACH_NEEDFRAG 4 /* IP_DF caused drop */ +#define ICMP_UNREACH_SRCFAIL 5 /* src route failed */ +#define ICMP_SOURCEQUENCH 4 /* packet lost, slow down */ +#define ICMP_REDIRECT 5 /* shorter route, codes: */ +#define ICMP_REDIRECT_NET 0 /* for network */ +#define ICMP_REDIRECT_HOST 1 /* for host */ +#define ICMP_REDIRECT_TOSNET 2 /* for tos and net */ +#define ICMP_REDIRECT_TOSHOST 3 /* for tos and host */ +#define ICMP_ECHO 8 /* echo service */ +#define ICMP_TIMXCEED 11 /* time exceeded, code: */ +#define ICMP_TIMXCEED_INTRANS 0 /* ttl==0 in transit */ +#define ICMP_TIMXCEED_REASS 1 /* ttl==0 in reass */ +#define ICMP_PARAMPROB 12 /* ip header bad */ +#define ICMP_TSTAMP 13 /* timestamp request */ +#define ICMP_TSTAMPREPLY 14 /* timestamp reply */ +#define ICMP_IREQ 15 /* information request */ +#define ICMP_IREQREPLY 16 /* information reply */ +#define ICMP_MASKREQ 17 /* address mask request */ +#define ICMP_MASKREPLY 18 /* address mask reply */ + +/* + * Definitions needed for the udp header structure. + */ + +#define uh_sport source +#define uh_dport dest +#define uh_ulen len +#define uh_sum check + +#endif /* linux */ diff --git a/missing b/missing new file mode 100755 index 0000000..7789652 --- /dev/null +++ b/missing @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + makeinfo) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..cc8783e --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,36 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Last modified: 1994-03-25 +# Public domain + +errstatus=0 + +for file in ${1+"$@"} ; do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d in ${1+"$@"} ; do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? + fi + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/options.h b/options.h new file mode 100755 index 0000000..3c99d80 --- /dev/null +++ b/options.h @@ -0,0 +1,54 @@ + +/* + * Interval is the minimum amount of time between sending a ping packet to + * any host. + * + * Perhost_interval is the minimum amount of time between sending a ping + * packet to a particular responding host (when count is > 1) + * + * Timeout is the initial amount of time between sending a ping packet to + * a particular non-responding host. + * + * Retry is the number of ping packets to send to a non-responding host + * before giving up (in is-it-alive mode). + * + * Backoff factor is how much longer to wait on successive retries. + * + * + */ + +/* constants */ + +#ifndef DEFAULT_INTERVAL +#define DEFAULT_INTERVAL 25 /* default time between packets (msec) */ +#endif + +#ifndef DEFAULT_PERHOST_INTERVAL /* default time between packets */ +#define DEFAULT_PERHOST_INTERVAL 1000 /* to a particular destination */ +#endif /* in counting/looping mode */ + +#ifndef DEFAULT_TIMEOUT +#define DEFAULT_TIMEOUT 500 /* individual host timeouts */ +#endif + + +#ifndef DEFAULT_RETRY +#define DEFAULT_RETRY 3 /* number of times to retry a host */ +#endif + +#ifndef DEFAULT_SELECT_TIME +#define DEFAULT_SELECT_TIME 10 /* default time to wait during select() */ +#endif + +#ifndef DEFAULT_BACKOFF_FACTOR +#define DEFAULT_BACKOFF_FACTOR 1.5 /* exponential timeout factor */ +#endif +#define MIN_BACKOFF_FACTOR 1.0 /* exponential timeout factor */ +#define MAX_BACKOFF_FACTOR 5.0 /* exponential timeout factor */ + +#ifndef DNS_TIMEOUT +#define DNS_TIMEOUT 1000 /* time in micro_sec for dns retry */ +#endif + +/* NIS_GROUPS allows input name to be an NIS netgroup name */ +/* #define NIS_GROUPS=1 */ diff --git a/stamp-h.in b/stamp-h.in new file mode 100755 index 0000000..9788f70 --- /dev/null +++ b/stamp-h.in @@ -0,0 +1 @@ +timestamp -- 2.43.0