#!/bin/sh5
# %W%   (ULTRIX) %G%

#	dolpr - implements the 'lpr' Print function in DECwindows for UWS V2
#
#	Doug Rickard
#	Digital Equipment Corp.
#
#	13-Mar-1989
#
CMD=lpr
ECHO=/bin/echo
FUNCTION=Print
DOING_FILES=0
QUIET=0
COPIES=1

set -f
for arg in $@
do
  arg=$1
  case $DOING_FILES in
    0)
      case $arg in
        -uefiles)
          DOING_FILES=1
          ;;
        *)
          CMD="$CMD $arg"
      esac
      ;;
    1)
      FILES="$FILES $arg"
  esac
  shift
done

$ECHO $FUNCTION Files: \"$FILES\" Printer: \"$PRINTER\" Copies: \"$COPIES\" >& 2
    read FILES
    case $FILES in
	?*) 
	    read PRINTER
	    case $PRINTER in
		?*)
		    read COPIES
		    case $COPIES in
			?*)
			    exec $CMD -#$COPIES -P $PRINTER $FILES 2>&1 ;;
			*)
			    exec $ECHO ERROR: No value given for Copies: 2>&1
		    esac
		    ;;
		*)
		    exec $ECHO ERROR: No printer name given 2>&1
	    esac
	    ;;
	*)
# Can't test on 'File' field - causes 'Cancel' to fail.
#	    exec $ECHO ERROR: No file name given 2>&1
    esac
