#------------------------------------------------------------
#          Personal Print Printer interface script
#            (c) 1993, James River Group, Inc.
#
# This is an example of a simple interface file to print a
# file at a local PC's printer using Ftcopy and ICE.TCP from
# the James River Group.
#
# This script has two options that need to be modified.
#
# The first is the $IPADDRESS variable below. You would want
# to make this the IP address of the workstation that has
# the local printer attached.
#
# The second is the port ($PCPORT) on the PC that the printer
# is attached to.  In the script below, we used LPT1.  Possible
# options are PRN (the default DOS device), LPT1, LPT2, or
# LPT3.
#
# This script will correctly handle the "-n" option of lp to print
# multiple copies of the job.
#
# In addition to the "-n" option, you may also specify a "-o"
# option.  If no "-o" option is given, no conversions are done.
#
# The values and actions for the -o option are:
#
# -oa  This will try to determine if the print job is text or binary
#      automatically, and if it is text, it will do the cr lf 
#      conversions.  (The "a" is for auto) Note: this will not
#      work with postscript files.
#
# -ot  This flag will force cr lf conversions.  (the "t" is for Text)
#
# version 2.0
#
#---------------------------begin variables---------------------
# Set the IPADDRESS line below to the correct DOS PC address to
# which the printer is attached.  You will have to change the IP
# address.
#
IPADDRESS=192.146.151.100
#
# Change the line below to LPT2, LPT3 if necessary.
#
PCPORT=LPT1
#-----------------------------end of variables------------------

printer=`basename $0`
request=$1
name=$2
title=$3
copies=$4
options=$5
file=$6
shift; shift; shift; shift; shift;

case ${options} in
 a|" a")
   while  [ "$copies" -gt 0 ]
    do
      for file in $file
       do
         if [ `file $file | grep -c text` -eq 1 ]
            then         
              /usr/bin/ftcopy -a $IPADDRESS $file $PCPORT -t 2>&1
            else
             /usr/bin/ftcopy -a $IPADDRESS $file $PCPORT 2>&1
         fi
       done
      copies=`expr $copies - 1`
    done
  ;;

 t|" t")
   while  [ "$copies" -gt 0 ]
    do
      for file in $file
       do
         /usr/bin/ftcopy -a $IPADDRESS $file $PCPORT -t 2>&1
       done
      copies=`expr $copies - 1`
    done
 ;;

 *)
   while  [ "$copies" -gt 0 ]
    do
      for file in $file
       do
        /usr/bin/ftcopy -a $IPADDRESS $file $PCPORT 2>&1
       done
      copies=`expr $copies - 1`
    done
 ;;
esac

exit 0
#
# End of interface file
