# letter \- manual feed printing of envelope and letter, or either alone; filter # options: # -let - print text of letter only # -env - print envelope only # -g* opt - option for grops # -t* opt - option for troff # specially structured input -- see ~local/words/new # mm macros # envelope prints landscape mode; feed envelope into printer with the # address side up, right edge first SELECT=both OPTS_troff="" OPTS_grops="" FILES="" while [ $# -gt 0 ] do case $1 in -let) SELECT=$1;shift;; -env) SELECT=$1;shift;; -*manual*) OPTS_grops="$OPTS_grops -m ";shift;; -g*) shift; OPTS_grops="$OPTS_grops $1";shift;; -t*) shift; OPTS_troff="$OPTS_troff $1";shift;; -*) echo "letter: input error - bad option: $1" ;exit 1;; *) FILES="$FILES $1";shift;; esac done # should put in a trap here, but what the hell... cat $FILES >/tmp/letter$$ case $SELECT in -let) cat /tmp/letter$$ | tbl|eqn -Tps|troff -mm -i -Tps $OPTS_troff | grops -pletter $OPTS_grops ;; -env) cat /tmp/letter$$ | sed -n -e "/START ENVELOPE/,/END ENVELOPE/p" | tbl|eqn -Tps|troff -i -Tps $OPTS_troff | grops -pletter -l $OPTS_grops ;; both) cat /tmp/letter$$ | sed -n -e "/START ENVELOPE/,/END ENVELOPE/p" | tbl|eqn -Tps|troff -i -Tps $OPTS_troff | grops -pletter -l $OPTS_grops echo "" cat /tmp/letter$$ | tbl|eqn -Tps|troff -mm -i -Tps $OPTS_troff | grops -pletter $OPTS_grops ;; *) echo letter: error in selection of type of output;exit 1;; esac rm /tmp/letter$$