#!/bin/csh
# 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.
#

# postcheck -- check to see if a postscript file can be viewed onscreen or
# whether it must be printed.

# obviously there are some things which can be done to extend the
# robustness of this script. Also it may not conform to your way of
# doing things. It should be obvious how to change it though.

# assume $1 is a postscript file to be either printed or viewed.
# -- pageview doesn't take standard input for some reason.

# check to see if OPENWINHOME and DISPLAY are defined -- if so
# we assume user is running open windows. pageview will not work
# under MIT X -- it needs NeWS underneath.

if ( ( $?OPENWINHOME ) && ( $?DISPLAY ) ) then

# check to see if pageview is where we think it is

  if ( -e $OPENWINHOME/bin/pageview ) then
     $OPENWINHOME/bin/pageiew -display $DISPLAY $1
  else
    lpr $1
  endif
else
  lpr $1
endif




