#!/bin/sh
# This script is called by ACEDB Pick_me_to_call records.
# It copies the file to a temporary file in the current working directory, 
# and then runs the appropriate viewer. After viewing, the 
# temporary file is deleted.  
# $ACE_Viewer is the name of the program. 
# $1 is the file for the program to use.

# RM_CMD - command to be used for removing files and directories
if [ -f /usr/bin/rm ]
	then
   RM_CMD=/usr/bin/rm
else
   if [ -f /bin/rm ]
   	then
      RM_CMD=/bin/rm
   else
      RM_CMD=rm
   fi
fi

#Choose a .pdf viewer
if [ -z ${ACE_PS_COMMAND} ]
  then
    ACE_PS_COMMAND=gv
fi
export ACE_PS_COMMAND

echo Copying $1

tempfile=acedb_$$
cp $1 ./$tempfile

#ls -l ./$tempfile

($ACE_PS_COMMAND $tempfile; $RM_CMD -f $tempfile) &
