#############################
#
# Unix Printing Interface Program
# COPYRIGHT (C) 1999-2013 RICOH COMPANY,LTD.
# All rights reserved
#
###########################
###########################
# LNX_TUB_B
# Beginning of the Body
#
# Paper Orientation (Default=Portrait)
# Delay Orientation command for 2up layout printing.
##########################
        portrait  )

	    Orientation=0
	    ;;

	landscape )

	    Orientation=1
	    ;;

        rportrait )

	    Orientation=2
	    ;;

	rlandscape )

	    Orientation=3
	    ;;

##########################
# Font Size
##########################
	fsize* )
	    fontsize=`expr $i : 'fsize\([0-9.]*\)'`
	    ;;

##########################
# Line Spacing
##########################
        lpi* )
	    lpi=`expr $i : 'lpi\([0-9]*\)'`
	    ;;

###########################
# VMI Spacing
###########################
	vmi* )
	    vmi=`expr $i : 'vmi\([0-9.]*\)'`
	    ;;
	    
	vsi* )
	    vsi=`expr $i : 'vsi\([0-9.]*\)'`
	    ;;

###########################
# HMI Spacing
###########################
	hmi* )
	    hmi=`expr $i : 'hmi\([0-9.]*\)'`
	    ;;
	    
	hsi* )
	    hsi=`expr $i : 'hsi\([0-9.]*\)'`
	    ;;

##########################
# Pitch (character per inch)
##########################
	10|12 )
		pitch=$i
		;;

	cpi* )
	    	pitch=`expr $i : 'cpi\([0-9.]*\)'`
	    	;;

	fp* )
		pitch=`expr $i : 'fp\([0-9.]*\)'`
		;;

##########################
# Character compresser
##########################
        compress|c|cpx )
	    printf "\033&k2S" >> $pcl_tmp
	    ;;

##########################
# 2-up Layout Print Mode
##########################
        2up )
	    layout=1
	    ;;

##########################
# Auto Wrap
##########################
        autowrap )
	    printf "\033&s0C" >> $pcl_tmp
	    ;;

##########################
# Job Type
##########################
	jobtype=* )
		jobtype=`parse ${i}`
		;;

###########################
#
# Resolution
#
###########################

	resolution=* )
            resolution=`parse ${i}`
            ;;

        dpi* )
		resolution=`expr $i : 'dpi\(.*\)'`
		;;

#####################
#
# Duplex
#
#####################
	duplex=* )
	    duplex=`parse ${i}`
	    ;;

	simplex )
		duplex="off"
		;;
	duplex|vd )
		duplex="long"
		;;
	hd|hduplex )
		duplex="short"
		;;

##################
#
# Mediatype
#
##################
	mediatype=* )
	    mediatype=`parse ${i}`
	    ;;

	mtype* )
		mediatype=`expr $i : 'mtype\(.*\)'|tr "[:upper:]" "[:lower:]"`
		;;

#####################
#
# Feed Input Tray
#
#####################

	itray=* )
	    itray=`parse ${i}`
	    ;;
	bypass )
		itray="bypass"
		;;
	tray1 )
		itray="${i}"
		;;

#################################
#
# Toner Saving
#
#################################

    tonersaving=* )
        tonersaving=`parse ${i}`
        ;;

#########################
#
# Paper size
#
#########################
	paper=* )
	    paper=`parse ${i}`
	    ;;
	A4|A5|A6|B5|B6|legal|letter|halfletter|executive|8x13|825x13|85x13|16k|dlenv|c5env|c6env|monenv|com10env )
		paper="${i}"
		;;
	esac
done

##############################################################
# Check some constraints here:
##############################################################
mydate=`date +'%Y/%m/%d'`
mytime=`date +'%H:%M:%S'`
ps_timeinfo=`date +'%Y%m%d%H%M'`

if [ "$vmi" -ne 0 ];then
	ln=
fi

if [ -n "$ln" ];then
    if [ "$ln" -gt 0 ];then
        case "$paper" in
        executive )
            _ln=10.5
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=7.25
            fi
            ;;
        letter )
            _ln=11
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=8.5
            fi
            ;;
        legal )
            _ln=14
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=8.5
            fi
            ;;
        12x18 )
            _ln=18
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=12
            fi
            ;;
        11x17 )
            _ln=17
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=11
            fi
            ;;
        55x85 )
            _ln=8.5
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=5.5
            fi
            ;;
        A3 )
            _ln=16.54
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=11.69
            fi
            ;;
        A4 )
            _ln=11.69
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=8.27
            fi
            ;;
        A5 )
            _ln=8.27
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=5.83
            fi
            ;;
        A6 )
            _ln=5.83
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=4.13
            fi
            ;;
        B4 )
            _ln=14.33
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=10.12
            fi
            ;;
        B5 )
            _ln=10.12
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=7.17
            fi
            ;;
        B6 )
            _ln=7.17
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=5.04
            fi
            ;;
        825x13 )
            _ln=13
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=8.25
            fi
            ;;
        85x13 )
            _ln=13
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=8.5
            fi
            ;;
        8x13 )
            _ln=13
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=8
            fi
            ;;
        8x10 )
            _ln=10
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=8
            fi
            ;;
        825x14 )
            _ln=14
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=8.25
            fi
            ;;
        10x14 )
            _ln=14
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=10
            fi
            ;;
        10x15 )
            _ln=15
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=10
            fi
            ;;
        11x14 )
            _ln=14
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=11
            fi
            ;;
        11x15 )
            _ln=15
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=11
            fi
            ;;
        126x192 )
            _ln=19.2
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=12.6
            fi
            ;;
        126x185 )
            _ln=18.5
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=12.6
            fi
            ;;
        13x18 )
            _ln=18
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=13
            fi
            ;;
        13x192 )
            _ln=19.2
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=13
            fi
            ;;
        13x19 )
            _ln=19
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=13
            fi
            ;;
        sra3 )
            _ln=17.72
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=12.6
            fi
            ;;
        sra4 )
            _ln=12.6
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=8.9
            fi
            ;;
        com10env )
            _ln=9.5
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=4.125
            fi
            ;;
        monenv )
            _ln=7.5
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=3.875
            fi
            ;;
        dlenv )
            _ln=8.66
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=4.33
            fi
            ;;
        c6env )
            _ln=6.38
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=4.49
            fi
            ;;
        c5env )
            _ln=9.02
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=6.38
            fi
            ;;
        8k )
            _ln=15.35
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=10.51
            fi
            ;;
        16k )
            _ln=10.51
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=7.68
            fi
            ;;
        226x310 )
            _ln=12.21
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=8.9
            fi
            ;;
        310x432 )
            _ln=17.01
            if [ "$Orientation" -eq 1 -o "$Orientation" -eq 3 ];then
                _ln=12.21
            fi
            ;;
        esac
        OS_NAME=`uname -s`
        case "${OS_NAME}" in
        SunOS )
            vmi=`echo $ln|/usr/xpg4/bin/awk -v l="${_ln}" '{printf("%.2f",(l-1)*48/$1)}'`
            ;;
        Linux )
            vmi=`echo $ln|gawk -v l="${_ln}" '{printf("%.2f",(l-1)*48/$1)}'`
            ;;
        * )
            vmi=`echo $ln|awk -v l="${_ln}" '{printf("%.2f",(l-1)*48/$1)}'`
            ;;
        esac
    else
        vmi=8
    fi
fi

#################################
#
# Create myecho command based on UNIX version
# For BSD UNIX myecho="echo -e",
# For SYS V UNIX myecho="echo"
#
#################################

myecho="echo"
test X`echo -e` = X && myecho="echo -e"

##############################################################
# The order below is somehow important:
#	paper have to be 1st
##############################################################
    case "$compress" in
	c )
	    	printf "\033&k2S" >> $pcl_tmp
		;;
	compress )
	    	printf "\033&k2S" >> $pcl_tmp
		;;
	cpx )
	    	printf "\033&k2S" >> $pcl_tmp		
		;;
	* )
		;;
	esac

##########################
# Print Job Type
##########################
	case "${jobtype}" in
	
	normal )
	    ;;
	    
	* )
	    ;;

	esac

##########################
# Resolution (Default=600dpi)
##########################
	case "$resolution" in

	600 )
		(
		$myecho "@PJL SET RESOLUTION=600" >> $pjl_tmp
                $myecho "@PJL SET BITSPERDOT=1" >> $pjl_tmp
		$myecho "@PJL SET RESOLUTION=600" >> $banner_pjl_tmp
                $myecho "@PJL SET BITSPERDOT=1" >> $banner_pjl_tmp
		)
		;;

	1200x600 )
		(
		$myecho "@PJL SET RESOLUTION=1200x600" >> $pjl_tmp
                $myecho "@PJL SET BITSPERDOT=1" >> $pjl_tmp
		$myecho "@PJL SET RESOLUTION=1200x600" >> $banner_pjl_tmp
                $myecho "@PJL SET BITSPERDOT=1" >> $banner_pjl_tmp
		)
		;;

	* )
		(
		$myecho "@PJL SET RESOLUTION=600" >> $pjl_tmp
                $myecho "@PJL SET BITSPERDOT=1" >> $pjl_tmp
		$myecho "@PJL SET RESOLUTION=600" >> $banner_pjl_tmp
                $myecho "@PJL SET BITSPERDOT=1" >> $banner_pjl_tmp
		)
		;;
	esac

###########################
# Duplex (Default=OFF)
##########################
	case "$duplex" in
	off )
		(
		$myecho "@PJL SET DUPLEX=OFF" >> $pjl_tmp
		)
		;;

	long )
		(
		$myecho "@PJL SET DUPLEX=ON" >> $pjl_tmp
		$myecho "@PJL SET BINDING=LONGEDGE" >> $pjl_tmp
		)
		;;

	short )
		(
		$myecho "@PJL SET DUPLEX=ON" >> $pjl_tmp
		$myecho "@PJL SET BINDING=SHORTEDGE" >> $pjl_tmp
		)
		;;
        
	* )
		(
		$myecho "@PJL SET DUPLEX=OFF" >> $pjl_tmp
		)
		;;

	esac

##########################
# Toner Saving
##########################
	case "$tonersaving" in
	off )
		(
			$myecho "@PJL SET ECONOMODE=OFF" >> $pjl_tmp
			$myecho "@PJL SET ECONOMODE=OFF" >> $banner_pjl_tmp
		)
		;;

	on )
		(
			$myecho "@PJL SET ECONOMODE=ON" >> $pjl_tmp
			$myecho "@PJL SET ECONOMODE=ON" >> $banner_pjl_tmp
		)
		;;
		
	* )
		(
			$myecho "@PJL SET ECONOMODE=OFF" >> $pjl_tmp
			$myecho "@PJL SET ECONOMODE=OFF" >> $banner_pjl_tmp
		)
		;;
	esac

##########################
# Paper Size (Default=Letter)
# For 2up printing in PCL, paper size command has been delayed.
##########################
	case "$paper" in
	A4 )
		papersize=26
		;;

	A5 )
		papersize=25
		;;

	A6 )
		papersize=24
		;;

	B5 )
		papersize=45
		;;

	B6 )
		papersize=44
		;;
	
	legal )
		papersize=3
		;;

	letter )
		papersize=2
		;;

	halfletter )
		papersize=93
		;;

	executive )
		papersize=1
		;;

	825x13 )
		papersize=2012
		;;

	8x13 )
		papersize=2011
		;;

	85x13 )
		papersize=2007
		;;
		
	16k )
		papersize=2031
		;;
	
	com10env )
		papersize=81
		;;

	monenv )
		papersize=80
		;;

	c5env )
		papersize=91
		;;

	c6env )
		papersize=92
		;;
		
	dlenv )
		papersize=90
		;;
		
	* )
		papersize=2
		;;

	esac

##########################
# Input Tray Selection	(Default=AUTOSELECT)
##########################
	case "$itray" in
	auto )
		(
		printf "\033&l7H" >> $pcl_tmp
		printf "\033&l7H" >> $banner_pcl_tmp
		)
		;;
	
	bypass )
		(
		printf "\033&l24H" >> $pcl_tmp
		printf "\033&l24H" >> $banner_pcl_tmp
		)
		;;

	tray1 )
		(
		printf "\033&l8H" >> $pcl_tmp
		printf "\033&l8H" >> $banner_pcl_tmp
		)
		;;

	* )
		(
		printf "\033&l7H" >> $pcl_tmp
		printf "\033&l7H" >> $banner_pcl_tmp
		)
		;;

	esac

##########################
# Media Type (Default=Plain&Recycled)
##########################

	case "$mediatype" in
	
	plainrecycled )
		(
		$myecho "@PJL SET MEDIATYPE=PAPER" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=PAPER" >> $banner_pjl_tmp
		)
		;;

	plain1 )
		(
		$myecho "@PJL SET MEDIATYPE=PLAIN" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=PLAIN" >> $banner_pjl_tmp
		)
		;;

	recycled )
		(
		$myecho "@PJL SET MEDIATYPE=RECYCLED" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=RECYCLED" >> $banner_pjl_tmp
		)
		;;

	color )
		(
		$myecho "@PJL SET MEDIATYPE=COLOR" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=COLOR" >> $banner_pjl_tmp
		)
		;;

	letterhead )
		(
		$myecho "@PJL SET MEDIATYPE=LETTERHEAD" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=LETTERHEAD" >> $banner_pjl_tmp
		)
		;;

	preprinted )
		(
		$myecho "@PJL SET MEDIATYPE=PREPRINTED" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=PREPRINTED" >> $banner_pjl_tmp
		)
		;;

	prepunched )
		(
		$myecho "@PJL SET MEDIATYPE=PREPUNCHED" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=PREPUNCHED" >> $banner_pjl_tmp
		)
		;;

	labels )
		(
		$myecho "@PJL SET MEDIATYPE=LABELS" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=LABELS" >> $banner_pjl_tmp
		)
		;;

	bond )
		(
		$myecho "@PJL SET MEDIATYPE=BOND" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=BOND" >> $banner_pjl_tmp
		)
		;;

	cardstock )
		(
		$myecho "@PJL SET MEDIATYPE=CARDSTOCK" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=CARDSTOCK" >> $banner_pjl_tmp
		)
		;;

	thick1 )
		(
		$myecho "@PJL SET MEDIATYPE=THICK" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=THICK" >> $banner_pjl_tmp
		)
		;;

	thick2 )
		(
		$myecho "@PJL SET MEDIATYPE=THICKPAPER" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=THICKPAPER" >> $banner_pjl_tmp
		)
		;;

	thin )
		(
		$myecho "@PJL SET MEDIATYPE=THIN" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=THIN" >> $banner_pjl_tmp
		)
		;;

	envelope )
		(
		$myecho "@PJL SET MEDIATYPE=ENVELOPE" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=ENVELOPE" >> $banner_pjl_tmp
		)
		;;

	ohp )
		(
		$myecho "@PJL SET MEDIATYPE=OHP" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=OHP" >> $banner_pjl_tmp
		)
		;;

	* )
		(
		$myecho "@PJL SET MEDIATYPE=PAPER" >> $pjl_tmp
		$myecho "@PJL SET MEDIATYPE=PAPER" >> $banner_pjl_tmp
		)
		;;

esac

##########################
# Copies 
##########################
$myecho "\\033&l${copies}X\c" >> $pcl_tmp
$myecho "\\033&l1X\c" >> $banner_pcl_tmp

##########################
# Pitch (characters per inch)
# Delay Pitch command for 2up printing.
##########################
	case $pitch in
	0 )
		pitch=10
		;;
	* )
		;;
	esac

##########################
# Font Size (characters per inch)
##########################
	case $fontsize in
	0 )
		;;
	* )
		printf "\033(s%.2fH" $fontsize >> $pcl_tmp
		my_lpi=`expr $fontsize \* 3 \/ 5`

		if [ $my_lpi -lt 2 ]
		then
		    my_lpi=1
		elif [ $my_lpi -lt 3 ]
		then
		    my_lpi=2
		elif [ $my_lpi -lt 4 ]
		then
		    my_lpi=3
		elif [ $my_lpi -lt 6 ]
		then
		    my_lpi=4
		elif [ $my_lpi -lt 8 ]
		then
		    my_lpi=6
		elif [ $my_lpi -lt 12 ]
		then
		    my_lpi=8
		elif [ $my_lpi -lt 16 ]
		then
		    my_lpi=12
		elif [ $my_lpi -lt 24 ]
		then
		    my_lpi=16
		else
		    my_lpi=24
		fi

		printf "\033&l%dD" $my_lpi >> $pcl_tmp
		;;
	esac


##########################
# lpi (text lines per inch)
##########################
	case $lpi in
	0 )
		;;
	* )
		printf "\033&l%dD" $lpi >> $pcl_tmp
		;;
	esac

############################
#
# Vertical Motion Index
#
############################
	case $vmi in
	0 )
		;;
	* )
		printf "\033&l%.4fC"  $vmi >> $pcl_tmp
		;;
	esac
	
	case $vsi in
	0 )
		;;
	* )
		printf "\033&l%.4fC"  $vsi >> $pcl_tmp
		;;
	esac

############################
#
# Horizontal Motion Index
#
############################
	case $hmi in
	0 )
		;;
	* )
		printf "\033&k%.4fH"  $hmi >> $pcl_tmp
		;;
	esac
	
	case $hsi in
	0 )
		;;
	* )
		printf "\033&k%.4fH"  $hsi >> $pcl_tmp
		;;
	esac


#######################################
#  2-up Layout (variable initialization)
#######################################

	case $layout in
	1 )
		case $papersize in
		1 )							# Executive
			width=3028
       			height=2051
			;;
		2 )							# Letter
			width=3178
       			height=2366
			;;
		3 )							# Legal
			width=4058
       			height=2366
			;;
		6 )							# 11x17
			width=4971
       			height=3139
			;;
		26 )						# A4
			width=3380
       			height=2289
			;;
		27 )						# A3
			width=4831
       			height=3359
			;;
				
		45 )						# B5
			width=2909
       			height=1987
			;;
		46 )						# B4
			width=4174
       			height=2880
			;;
		80 )						# Mon-Env.
			width=2100
       			height=1000
			;;
		81 )						# Com10Env.
			width=2700
       			height=1060
			;;
		90 )						# DL-Env.
			width=2450
       			height=1090
			;;
		91 )						# C5-Env.
			width=2550
       			height=1790
			;;
		102 )						# 12x18
			width=5021
       			height=3210
			;;
		
		25 )						# A5
			width=2359
       			height=1640
			;;
		24 )						# A6
			width=1628
       			height=1135
			;;
		2007 )						# 8.5 x 13
			width=3760
       			height=2377
			;;
		93 )						# HalfLetter
			width=2426
       			height=1549
			;;
		2011 )						# 8 x 13
			width=3760
       			height=2227
			;;
		2012 )						# 8.25 x 13
			width=3760
       			height=2302
			;;
		44 )						# B6
			width=2088
       			height=2909
			;;
		
		92)						# C6-Env.
			width=1750
       			height=1200
			;;
		2030 )						# 8k
			width=4480
       			height=3030
       			;;

		2031 )						# 16k
			width=3010
       			height=2163
       			;;
		* )							# Default (Letter)
			width=3178
        		height=2366
			;;
		esac
		;;
	* )
		;;	esac


###################################################################
#
# Make The Banner Page
# $banner_text_tmp is text file only
# $banner_ps_tmp is PCL/PJL with "\r" line return code added file
#
###################################################################


generate_custom_banner()
{
    printf "[*****************************************]\r\n" > $banner_text_tmp
    printf "[*                                       *]\r\n" >> $banner_text_tmp
    printf "[* User Name : %25.25s *]\r\n" $user_name >> $banner_text_tmp
    printf "[* Host : %30.30s *]\r\n" $host >> $banner_text_tmp
    printf "[*                                       *]\r\n" >> $banner_text_tmp
    printf "[*****************************************]\r\n" >> $banner_text_tmp
    printf "[*                                       *]\r\n" >> $banner_text_tmp
if [ -n "$title" ]; then
    printf "[* Title : %29.29s *]\r\n" "$title" >> $banner_text_tmp
fi
case `uname -s` in
HP-UX)
    printf "[* Request Id : %24.24s *]\r\n" $request_id >> $banner_text_tmp
    ;;
*)
    printf "[* Job Name : %26.26s *]\r\n" $print_file_name >> $banner_text_tmp
    ;;
esac
#    printf "[* Date : %30.30s *]\r\n" `date +'%d/%m/%Y'` >> $banner_text_tmp
    banner_date=`date |awk '{printf("%3s %02s, %4s",$2,$3,$6)}'`
    echo   "[* Date :                   $banner_date *]" >> $banner_text_tmp
    printf "\r[* Time : %30.30s *]\r\n" `date +'%H:%M:%S'` >> $banner_text_tmp
    printf "[*                                       *]\r\n" >> $banner_text_tmp
    printf "[*                                       *]\r\n" >> $banner_text_tmp
    printf "[* Unix Filter Version : %15.15s *]\r\n" $version >> $banner_text_tmp
    printf "[*                                       *]\r\n" >> $banner_text_tmp
    printf "[*****************************************]\r\n" >> $banner_text_tmp    

######################################################
#
# Make the $banner_ps_tmp file 
#
######################################################
    
    printf "\033%%-12345X" > $banner_ps_tmp
    echo "@PJL JOB NAME=\"FilterBanner\"" >> $banner_ps_tmp
    echo "@PJL SET JOBNAME=\"FilterBanner\"" >> $banner_ps_tmp
    cat $banner_pjl_tmp >> $banner_ps_tmp
    printf "\n" >> $banner_ps_tmp
    echo "@PJL ENTER LANGUAGE=PCL" >> $banner_ps_tmp
    printf "\033E" >> $banner_ps_tmp
    printf "\033&l%dA" $papersize >> $banner_ps_tmp
    	
    case $Orientation in
	0 )
	  
	    printf "\033&l0O" >> $banner_pcl_tmp
	    ;;
	1 )
	   
	    printf "\033&l1O" >> $banner_pcl_tmp
	    ;;
	2 )
	   
	    printf "\033&l2O" >> $banner_pcl_tmp
	    ;;
	3 )
	   
	    printf "\033&l3O" >> $banner_pcl_tmp
	    ;;
	* )
	   
	    printf "\033&l0O" >> $banner_pcl_tmp
	    ;;
    esac
	cat $banner_pcl_tmp >> $banner_ps_tmp
	printf "\033(8U\033(s0p%.2fh0s0b4099T" 10 >> $banner_ps_tmp
	
    echo >> $banner_ps_tmp
    cat $banner_text_tmp | awk '{print $0, "\r"}' >> $banner_ps_tmp
    printf "\033%%-12345X@PJL EOJ NAME=\"FilterBanner\"\n" >> $banner_ps_tmp
    printf "\033%%-12345X" >> $banner_ps_tmp
}

##########################
# LNX_TUB_E
#
# End of the Body
##########################
