Listing 5
#################################################################
#!/usr/bin/sh
#
# (c) Copyright 1993~1995 Hewlett-Packard Company.  All Rights Reserved.
#
# $Header: hpnp.model.sol,v 1.1 96/02/14 15:14:33 hpnp Exp $
#
# HP-UX Network Peripheral Model Script
#
# This script invokes the original model script
# from the subdirectory model.orig and pipes its
# output to hpnpf.
#
###################################################################

                               .
                               .
                               .

#####
#
# Set some globally used variables and functions.
#####

: ${TMP:=/var/tmp}
: ${SPOOLDIR:=/usr/spool/lp}

: ${LOCALPATH:=${SPOOLDIR}/bin}
####################################################
# The /etc/lp/interfaces is added to the PATH to   #
# let PrnQt_lib.sh reachable.                      #
####################################################
PATH="/bin:/usr/bin:/etc/lp/interfaces:${LOCALPATH}"

                               .
                               .
                               .


#####
#
# This program is invoked as
#
# ${SPOOLDIR}/.../printer request-id user title copies options files...
#
# The first three arguments are simply reprinted on the banner page,
# the fourth (copies) is used to control the number of copies to print,
# the fifth (options) is a blank separated list (in a single argument)
# of user or Spooler supplied options (without the -o prefix),
# and the last arguments are the files to print.
#####

if [ $# -lt 5 ]
then
	errmsg ERROR ${E_IP_ARGS} \
		"wrong number of arguments to interface program" \
		"consult your system administrator"
	exit 1
fi
printer=`basename $0`

MODEL=`basename $0`
REALMODEL=`echo $0 | sed -e "s%$MODEL%model.orig/$MODEL%"`
LPLOG=/var/spool/lp/logs/lpsched
LOG=$TMP/jalog.$$
DEFOUT=$TMP/jadump
HPNPFLOG=""

MANPATH=$MANPATH:/opt/hpnp/man
export MANPATH

# default: "/opt/SUNWmotif/lib:/usr/openwin/lib"
templiary=""
export LD_LIBRARY_PATH
OPENWINHOME=/usr/openwin
export OPENWINHOME
# 
HPNPBIN=/opt/hpnp/bin
HPNPF=$HPNPBIN/hpnpf
# PORT, PERIPH, TEOJ are all configurable
xPORT=
PERIPH=case-lj20
DEVTYPE="PJL"
TEOJ="-w"
JRECOV="yes"     
STATUSLOG="/tmp/eb1328ps1.log"
HPNPFOPT=
TOJMON=""  
ONUSTATUS="" 

if [ -z "$PERIPH" ]
then
     PERIPH=$MODEL
fi

# job monitor related
jobm="no"       
userjobm="yes"
jstay=""
defdsplay="`uname -n`:0"
dsplay=""
debugf=""
dsplayfile="/opt/hpnp/etc/hpnpdisplay"
XJETMON=$HPNPBIN/xjjm

# LP job parameters
job=$1
    # presever original string, for passing to net_ljxx
user1=$2
user=`echo $2 | line | cut -d! -f2`
sysname=`echo $2 | line | cut -d! -f1`
title=$3
copy=$4
options=$5
shift 5
files="$*"

PAGEF=$TMP/pg.${job}
JMLOCK=$TMP/jm.${job}

                                .
                                .
                                .

########################################
###      Begin Quota Check           ###
########################################
### Conversion from uppercase to lowercase
lowername=`echo $user|nawk '{ print tolower($1) }'`
user=$lowername
### The library file, PrnQt_lib.sh, must reside in a directory 
### serached by PATH.
. PrnQt_lib.sh
### 
Usermatch
###
if [ -f $UserPrnQtFile ]
then
  ChkPrnQt
else
  InitUserPrnQtFile
fi
########################################
###      End of Quota Check          ###
########################################
# 
HPNPFOPT="-j $job+$user $TEOJ $TOJMON $DEFOUT $ONUSTATUS $xPORT -x $PERIPH $HPNPFLOG"
if [ -n "$STATUSLOG" ]
then
  HPNPFOPT="$HPNPFOPT -s $STATUSLOG"
fi

                               .
                               .
                               .

########################################
###      Read Page Printed           ###
########################################
PAGES=`awk -F% '/status:  User/{print $3}' $STATUSLOG | cut -d" " -f9`
########################################
###   End of Read Page Printed       ###
########################################
########################################
###      Update Print Quota          ###
########################################
UpdatePrnQtFile $PAGES 1
########################################
###    End of Update Print Quota     ###
########################################
#
rm -f $STATUSLOG
exit_code=0 exit 0

