#!/bin/sh
# $Id: t-sockmap-0.sh,v 1.3 2004/12/29 20:53:14 ca Exp $
# Copyright (c) 2004 Sendmail, Inc. and its suppliers.
#	All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
# ----------------------------------------
# Test for socketmap.
# Uses
# perl (how to find that?)
# contrib/socketmapServer.pl
# t-sockmapr-0
# ----------------------------------------
#
test -s stop && exit 1
#

SD=`dirname $0`
if test "${SD}" = "."
then
   SD=../libsmmap
fi

ERRS=0

SOCKSRV=${SD}/t-sockmapsrv.pl
PIDS=pids

killit()
{
if test -s ${PIDS}
then
  for i in `cat ${PIDS}`
  do
    kill ${i}
  done
fi
}
trap killit 2 15

if test -x ${SOCKSRV}
then
  perl ${SOCKSRV} tcp:127.0.0.1:1289 &
  echo $! > ${PIDS}
  sleep 3

  ./t-sockmapr-0 || ERRS=`expr ${ERRS} + 1`

  for i in `cat ${PIDS}`
  do
    kill ${i}
  done
  rm -f ${PIDS}
else
  echo $0: ${SOCKSRV} not found
  exit 1
fi
exit ${ERRS}


syntax highlighted by Code2HTML, v. 0.9.1