#! /bin/sh

pipedir=/tmp/geomview

case "$1" in
  -M) pipedir=$2; shift 2 ;;
  -M*) pipedir="`expr "$1" : "-M\(.*\)"`"; shift ;;
  -*) shift $# ;;
esac

if [ $# = 0 ]; then
    echo "Usage: $0  [-Mpipedirectory]  symbolname   [ OOGLfilename ]
Write geometric data to the given symbol.  Reads from stdin if no file given.
In typical use, a program pipes data to 'geomstuff somename',
while you run    geomview -M somename     to see the result.
Pipes created by default in $pipedir." >&2
    exit 1
fi
    

pipe=$pipedir/$1
shift

if [ ! -d $pipedir ] ; then
  mkdir $pipedir
  chmod a+w $pipedir
fi
if [ ! -p $pipe ] ; then
  /bin/rm -f $pipe
  /etc/mknod $pipe p
fi

cat $@ > $pipe

#echo Finished stuffing to $pipe, status $? >&2

