#!/bin/sh

. config/paths.sh

if $TEST "$1" = "-p"; then
  shift
  STD_PORTS=$1
  shift
else
  STD_PORTS="25 53 80 139 143"
fi

FW_TIMEOUT=1
TEST_PORT=12000
TARGETS="`/bin/echo $*`"
echo > ./fwping.$$
set *=" " $*
shift
while [ "$1" ]; do
  echo `date` $1 >> ./fwping.$$
  TMP=`bin/tcp_scan -a -f 1 $1 $STD_PORTS $TEST_PORT |  \
	grep -iv timed | grep -iv "no route" | grep -iv "unreachable"`
  if [ "$TMP" ]; then
    /bin/echo "$1 is alive"
  fi 
shift
done
exit 0
