#!/bin/csh
# PRI - S. Fayers 27/10/95
#
# This takes the arguments from the command line, checks to see if the 
# file has a .lis extension, and if it does, uses fpr to format the 
# listing file as fortran listing with page throws.
# This formatted output, as well as files not ending in .lis are passed to
# lp for printing
if ($?SAS_PRINTER == 0 ) then
	echo "Please choose a printer using command myprinter"
        exit
endif
#echo "in prip"
foreach file ($argv[*]) 
#	echo "in foreach", $file
	switch ($file)
          case *.ps:
              lpr -P $SAS_PRINTER $file
              echo PRI - $file passed directly to lp
          breaksw
          case *.PS:
              lp -d $SAS_PRINTER $file
              echo PRI - $file passed directly to lp
          breaksw
	  case *.lis:
	      $SAS_DIR/fpr -f $file |lp -d $SAS_PRINTER
	      echo PRI - $file processed as fortran listing
	  breaksw
	  default:
#		echo "prip default"
#		echo $SAS_DIR"/fpr " $file "|lp -d"$SAS_PRINTER    
	      $SAS_DIR/fpr $file |lp -d $SAS_PRINTER    
	      echo PRI - $file paged to lp
	endsw
end
