#!/bin/sh
#
# FILE NAME: aix/ftp_piobe
#
# This shell script is to be used instead of 'piobe' in an AIX environment
# when using ftp with a printer server.
#
# (C) Copyright 1992-1994, Axis Communications AB, LUND, SWEDEN
#
# Version 1.3, 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 "ftp_path" to the full pathname of your ftp program.
#
ftp_path=/usr/ucb/ftp
#
# 4. The lines below should normally NOT be changed, they set
#    the username and password to be used for FTP login on the
#    print server.
#
password=none
if test "X$LOGNAME" = "X"; then
   login_name=anyone
else
   login_name=$LOGNAME
   if test "$login_name" = root; then
      login_name=unix_root 
   fi
fi
# 
# 5. Some early AIX versions 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 ---
#
/usr/lpd/piobe $* > /tmp/pr-$$.axis
/bin/cat > /tmp/ftp-$$.axis << endftp
user $login_name $password
binary
put /tmp/pr-$$.axis $logical_printer
quit
endftp
$ftp_path -n $internet_address < /tmp/ftp-$$.axis > /dev/null
status=$?
/bin/rm /tmp/pr-$$.axis /tmp/ftp-$$.axis
exit $status
