#!/bin/bash # --------------------------------------------------------------------------- # # list : Printing of ASCII files (typically source codes) using the # # program w3print.f This program is provided as a part of # # WAVEWATCH III and get is printer setup from the file # # $ww3_env (set in 1.b) in the users home directory. # # # # Hendrik L. Tolman # # May 2009 # # # # Copyright 2009 National Weather Service (NWS), # # National Oceanic and Atmospheric Administration. All rights # # reserved. WAVEWATCH III is a trademark of the NWS. # # No unauthorized use without permission. # # # # --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- # # 1. Preparations # # --------------------------------------------------------------------------- # # 1.a Check input if test "$#" = '0' then echo "usage: list filename(s)" 1>&2 ; exit 1 fi input="$*" dir=`pwd` # 1.b Get data from setup file - - - - - - - - - - - - - - - - - - - - - - - - source $(dirname $0)/w3_setenv main_dir=$WWATCH3_DIR temp_dir=$WWATCH3_TMP source=$WWATCH3_SOURCE list=$WWATCH3_LIST # --------------------------------------------------------------------------- # # 2. Loop over files # # --------------------------------------------------------------------------- # # 2.a Loop control cd $dir set $input while test "$#" != '0' do if test ! -f $1 then echo "file $1 not found" else echo "processing $1" # 2.b Run w3prnt - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - rm -f w3prnt.out echo "$1" | $main_dir/bin/w3prnt 2> /dev/null # 2.c Spool to printer - - - - - - - - - - - - - - - - - - - - - - - - - - - - if test -f w3prnt.out then if test -z "$printer" then lpr w3prnt.out else lpr -P $printer w3prnt.out fi rm -f w3prnt.out else echo "listing not found" fi fi shift done # End of list --------------------------------------------------------------- #