#!/usr/bin/ksh
#
# $Id: sipc,v 1.1 2006/06/16 14:03:49 laskait Exp $
#
MODE=0

for i in "$@"
do
  if [ "$i" = "1" ]
  then 
    MODE=1;
  fi
  if [ "$i" = "2" ]
  then 
    MODE=2;
  fi
done

if [ $MODE = 1 ]
then
  export PGWCONFIG=$PGW1CONFIG
else
  if [ $MODE = 2 ]
  then
    export PGWCONFIG=$PGW2CONFIG
  else
    echo "Usage: sipc <1|2>"
    exit -1
  fi
fi

actuser=`whoami`
if [ -z "$PGWCONFIG" ]
then
  echo "The PGWCONFIG is not set!"
  exit
fi

key=`awk -F= '/^ipckey/ {print $2}' $PGWCONFIG`

ipcs -s | grep $key
ipcs -m | grep $key

exit 0
