#!/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 graphic viewer
if [ -z ${ACE_BITMAP_VIEWER} ]
  then
   ACE_BITMAP_VIEWER=xv
fi   
export ACE_BITMAP_VIEWER

echo Copying $1

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

#ls -l ./$tempfile

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