#!/bin/csh -f
# Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
# 
# Permission to use, copy, modify, and distribute this material 
# for any purpose and without fee is hereby granted, provided 
# that the above copyright notice and this permission notice 
# appear in all copies, and that the name of Bellcore not be 
# used in advertising or publicity pertaining to this 
# material without the specific, prior written permission 
# of an authorized representative of Bellcore.  BELLCORE 
# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY 
# OF THIS MATERIAL FOR ANY PURPOSE.  IT IS PROVIDED "AS IS", 
# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
#

set xview="xloadimage -view -quiet -geometry +1+1"

if (! $?DISPLAY) then
    echo ""
    echo This message contains a picture, which can currently only be
    echo viewed when running X11.  If you read this message while running
    echo X11, you will be able to see the picture properly.
    exit 0
endif

echo NOTE:  TO MAKE THE PICTURE WINDOW GO AWAY, JUST TYPE 'q' IN IT.
echo ""
if ($1 == "uu") then
    onintr cleanup
    (echo begin 0666 /tmp/showpicture.$$ ; tail +2 $2) | uudecode
    cat /tmp/showpicture.$$  | $xview stdin
cleanup:
    rm  /tmp/showpicture.$$
else if ($1 == "file") then
    $xview `cat $2`
else if ($1 == "uu-z") then
    onintr cleanup
    (echo begin 0666 /tmp/showpicture.$$ ; tail +2 $2) | uudecode
    zcat /tmp/showpicture.$$  | $xview stdin
cleanup:
    rm  /tmp/showpicture.$$
else if ($#argv == 2) then
    ln -s $2 ${2}-PRESS-q-TO-EXIT
    $xview ${2}-PRESS-q-TO-EXIT
    rm ${2}-PRESS-q-TO-EXIT 
else if ($#argv == 1) then
    ln -s $1 ${1}-PRESS-q-TO-EXIT
    $xview ${1}-PRESS-q-TO-EXIT
    rm ${1}-PRESS-q-TO-EXIT 
else
    $xview stdin
endif
