#!/bin/sh #set -x USAGE="usage: sndfaxwwb filename sendkey" DATE="2000-02-10 09:30L" #______________________________________________________________________________ # NAME : sndfaxwwb # Author : Peter Henrichsen # Purpose : This script runs the widemap or smallmap script to decode a # : NMC 6-bit packed chart and then convert the pure-raster # : file to pcl file and send it to a HP printer in the WWB! # # History : 98-11-02 Peter Henrichsen # : 99-01-26 Peter Henrichsen modify to generate sendkey from 1st # part of file name. # : 99-02-18 Peter Henrichsen modify to use either script widemap # : or smallmap. The input data control card file has been modified # : to add an additional flag to denote which script to use. This # : new flag is the seventh field on the data card and has the # : the value of "l" for wide map or "s" for small map. # : 1999-12-01 Peter Henrichsen modify to run on ncosp # : 2000-01-28 Peter Henrichsen turn on check out print. # : 2000-02-10 Peter Henrichsen fix an error. # # # Sample data cards : # ___________________________________________________________________________ # # SNDKEY subset width printer dots c fl # numbers to get from file name pein p ag # ___________________________________________________________________________ # bcmrf.j948l , 9100 9101 9103 9104 , 2048 , lj5simr ,200,1,l, # pre00.jrw200, 2820 2250 , 2048 , lj8-44 ,200,1,s, # # # Location : This script is found on hp36 as: # : /tmp_mnt/export/sgi73/peterhen/util/scripts/ibm/sndfaxwwb # : & on ncosp as : # : /nwprod/util/ush/sndfaxwwb # : /nfsuser/g02/wx12ph/util/ush/sndfaxwwb # # Usage : This script is called to convert NMC 6-bit packed charts # into HP printable format. # # The FAX file is passed as the first argument (full path). # # Arg1 is faxfile fullpath # Arg2 is "sendkey" optional # AN EXAMPLE: # # sndfaxwwb.sh /pcom/mrf/fax.bcmrfmp1.j948l bcmrf.j948l' # where: # "/pcom/mrf/fax.bcmrfmp1.j948l" is the fax file full-path. # "bcmrf.j948l" is the sendkey used to get list of subs in the file # to convert into HP printable format. # # # Remarks : If the 2nd input arg is missing the sendkey is created # from the input file name. # #_______________________________________________________________________________ integer istat istat=0 VERS="$USHutil/${smember} $DATE" print "$VERS" msg="${smember} HAS STARTED!" postmsg "$jlogfile" "$msg" echo Number of arguements passed in is $# for arg in "$@" do echo $arg done INFILE="$1" if [[ -a $INFILE ]] then # ... NMC 6bit packed file exists ... print "Given NMC6bitpacked = $INFILE " # Start loop to print the fax cuts!!!! filename=`basename ${INFILE}` faxfile=`echo ${filename} | awk 'BEGIN{FS="."} {print $1$2}'` export filename faxfile if test $# -ge 2 then sendkey="$2" else firstarg=`echo ${filename} | awk 'BEGIN{FS="."} {print $1}'` N=${#firstarg} numprt=`echo $filename | awk -F. '{print NF}'` if [ $numprt -eq 2 ] then # must create the sendkey from the file 1st part of the filename. part1=`echo ${firstarg} | cut -c1-3` let N=$N-1 part1=`echo ${firstarg} | cut -c1-3` part2=`echo ${firstarg} | cut -c$N- ` snd1=$part1$part2 else # must create the sendkey from the 1st and 2nd part of the filename. if [ $N -eq 3 ]; then lower=`echo $firstarg | tr '[A-Z]' '[a-z]' ` case $lower in "fax") one=`echo ${filename} | awk 'BEGIN{FS="."} {print $2}'` snd1=`echo ${one} | cut -c1-5` ;; "var") one=`echo ${filename} | awk 'BEGIN{FS="."} {print $2}'` snd1=`echo ${one} | cut -c1-5` ;; *) part1=$lower part2=`echo ${filename} | awk 'BEGIN{FS="."} {print $2}'` part3=`echo ${part2} | cut -c1-2` snd1=$part1$part3 esac else part1=`echo ${firstarg} | cut -c1-3` part2=`echo ${filename} | awk 'BEGIN{FS="."} {print $2}'` part3=`echo ${part2} | cut -c1-2` snd1=$part1$part3 fi fi snd2=`echo ${filename} | awk 'BEGIN{FS="."} {print $NF}'` name=$snd1.$snd2 sendkey=`echo $name | tr '[A-Z]' '[a-z]' ` fi export sendkey echo Search wwb.map table for $sendkey grep $sendkey $FIXutil/graph_wwb.maps > $DATA/argline set -x if [ -s argline ] then subs=`cat $DATA/argline | awk -F, '{print $2}'` width=`cat $DATA/argline | awk -F, '{print $3}'` lprntr=`cat $DATA/argline | awk -F, '{print $4}'` dotpin=`cat $DATA/argline | awk -F, '{print $5}'` numcp=`cat $DATA/argline | awk -F, '{print $6}'` tflag=`cat $DATA/argline | awk -F, '{print $7}'` export subs lprntr width dotpin numcp case $tflag in "s") # use smallmap to print on a small 8X11 paper ! export member=smallmap $USHutil/$member $INFILE $lprntr "${subs}" ;; *) # Start loop to convert the NMC 6-bit maps into HP format . export wmember=widemap for NUMB in $subs do msgs="${wmember} getting nmc6bit map # $NUMB from $filename!" postmsg "$jlogfile" "$msgs" # use widemap to print on a large 11X17 paper ! inargs="-a $INFILE -n $NUMB -x $width -p $lprntr -d $dotpin -c $numcp" $USHutil/$wmember ${inargs} # $utilscript/widemap ${inargs} done esac msg="$smember HAS COMPLETED NORMALLY!" postmsg "$jlogfile" "$msg" else msgs="ERROR $sendkey not in $FIXutil/graph_wwb.maps table!" postmsg "$jlogfile" "$msgs" msgs="ERROR MAPS NOT PRINTED AT WWB!" postmsg "$jlogfile" "$msgs" fi else print "Error. NMC6bit-File is non-existent: $INFILE " print "$USAGE" msgs="${member} ERROR sndfaxwwb, $INFILE not found!" postmsg "$jlogfile" "$msgs" fi