#!/bin/sh
# @(#) $Header: option4,v 1.13 93/02/22 15:07:23 ss2 Exp $
#
# Make sure directory containing ping is part of PATH
#
PATH="$PATH:/etc:/usr/etc:"

trap "" 1 2 3 15

#        type  name  test
getname "option4" $1
if [ $? -ne 0 ]
then
  exit 1
fi
PNAME=`cat $TMP/NAME`
rm $TMP/NAME

echo ""
echo "========================================================="
echo "Testing network connectivity to $PNAME .... "
echo ""
echo ping -s $PNAME 56 5 
ping -s $PNAME 56 5 | tee $TMP/PCNCT 2>&1
cat $TMP/PCNCT |grep 100% > /dev/null 2>&1
RETCODE=$?
cat $TMP/PCNCT |grep 'unknown host' > /dev/null 2>&1
RETCODE2=$?
rm $TMP/PCNCT

#  RETCODE of 0 indicates 100% packet failure and RETCODE2 of 0 indicates
#  unknown host.

echo ""
if [ $RETCODE -eq 0 -o $RETCODE2 -eq 0 ]
then
  echo "$PNAME failed the network connectivity test"
else
  echo "$PNAME passed the network connectivity test"
fi
echo "========================================================="

echo ""
echo "The printer network connectivity test is complete."
$ECHO "Press the return key to continue ... $NL"
read RESP
