Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Feb 1997 16:27:28 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        danny@panda.hilink.com.au (Daniel O'Callaghan)
Cc:        terry@lambert.org, jgreco@solaria.sol.net, dufault@hda.com, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Audible ping response changes to ping.c
Message-ID:  <199702062327.QAA19017@phaeton.artisoft.com>
In-Reply-To: <Pine.BSF.3.91.970207101513.427K-100000@panda.hilink.com.au> from "Daniel O'Callaghan" at Feb 7, 97 10:15:33 am

next in thread | previous in thread | raw e-mail | index | archive | help
> > > Well, I can take the sed and sh alternatives as an indication that I 
> > > should remove the -z flag from tar, but I think I'll just put the -a flag 
> > > into ping.
> > 
> > The case for the z flag in tar is the installation media argument
> > when bootstrapping a new system to run FreeBSD for the first time.
> > 
> > Also, the z flag runs an external compressor/decompressor.  By that
> > logic, you should call an external "beep" program if you are trying to
> > justify adding the flag using "the "rule of similar existing practice".
> 
> Hmmmm. :-)


Here is a revised version that transparently provides a "-a" option
to the real ping command without adding it to the real ping command:


#!/bin/sh
#
# bping.sh	first version was "aping.sh".  8-).
#
# To use:
#		mv /sbin/ping /sbin/ping.real
#		mv bping.sh /sbin/ping
#		chmod 555 /sbin/ping
#
ARGS=""
BEEP=no
PING=ping.real

# find -a, if specified
while test "x$1" != "x"
do
	if test "x$1" = "x-a"
	then
		BEEP=yes
	else
		ARGS="$ARGS $1"
	fi
	shift
done

# run the beep or non-beep version
if test "$BEEP" = "yes"
then
	$PING $ARGS | while read x
	do
		echo "$x"
	done
	exit $?
else
	$PING $ARGS
	exit $?
fi
# EOF: not reached


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702062327.QAA19017>