#!/bin/sh
#
# FILE NAME: aix/pros_piobe
#
# This shell script is to be used as a backend in an AIX environment when
# using PROS to communicate with a print server.
#
# (C) Copyright 1992-1994, Axis Communications AB, LUND, SWEDEN
#
# Version 1.4, Apr 22, 1994 RW/EE
#
# Before installing, the following variables must be set up:
#
# 1. Set "internet_address" to the internet address of your print server.
#    If you have assigned the print server a name in /etc/hosts, you can 
#    use that name instead.
#
internet_address=192.36.253.80
#
# 2. Set "logical_printer" to the logical printer you wish to use on the
#    print server.
#
logical_printer=pr1
#
# 3. Set "pros_path" to the full pathname of your pros executable
#
pros_path=/usr/lpd/axis/prosaix
#
# 4. Set "hostname" to the name of the host on which the printer queue
#    will be set up.
#
hostname=some_host
#
# 5. Set "logfile" to the full pathname of the log file in which PROS will
#    put logging info. Do not forget to create this file and make it
#    writable to every user.
#
#    If you want the user to receive mail about each print job instead,
#    then comment out the following line instead (put a # in front of it).
#
logfile=/tmp/axislog
#
# 6. If you want printer feedback data to be sent somewhere else than
#    /dev/null, change the following line.
#
backfile=/dev/null
#
# 5. Some AIX systems may need the command below. Normally it should
#    not be used (leave it as a comment).
#
#stty -opost <&1
#
# ---- main body of script begins here ---
#
if test "X$LOGNAME" = "X"; then
   login_name=anyone
else
   login_name=$LOGNAME
fi
if [ $logfile ]
then
  /usr/lpd/piobe $* | $pros_path $hostname $login_name $internet_address $logical_printer netprinter 1>> $backfile 2>> $logfile
else
  /usr/lpd/piobe $* | $pros_path $hostname $login_name $internet_address $logical_printer netprinter 2>&1 1>> $backfile | mail $LOGNAME 
fi
exit $?
