| 1 | #!/bin/bash |
|---|
| 2 | |
|---|
| 3 | ################################################################################ |
|---|
| 4 | # Copyright 2008 Sun Microsystems, Inc., |
|---|
| 5 | # 4150 Network Circle, Santa Clara, California 95054, U.S.A. |
|---|
| 6 | # All rights reserved. |
|---|
| 7 | # |
|---|
| 8 | # U.S. Government Rights - Commercial software. |
|---|
| 9 | # Government users are subject to the Sun Microsystems, Inc. standard |
|---|
| 10 | # license agreement and applicable provisions of the FAR and its supplements. |
|---|
| 11 | # |
|---|
| 12 | # Use is subject to license terms. |
|---|
| 13 | # |
|---|
| 14 | # This distribution may include materials developed by third parties. |
|---|
| 15 | # |
|---|
| 16 | # Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered |
|---|
| 17 | # trademarks of Sun Microsystems, Inc. in the U.S. and other countries. |
|---|
| 18 | ################################################################################ |
|---|
| 19 | |
|---|
| 20 | FORTRESS_HOME="`${0%fortick}fortress_home`" |
|---|
| 21 | |
|---|
| 22 | if [ "x"$1 = "x-q" ] ; then |
|---|
| 23 | SILENCE="golden" |
|---|
| 24 | shift |
|---|
| 25 | fi |
|---|
| 26 | |
|---|
| 27 | if [ $# -ne 1 ] ; then |
|---|
| 28 | echo "Usage: fortick [-q] somefile.suffix (one file, no more, no less)" |
|---|
| 29 | echo " Replaces backtick-delimited fortress with nicely formatted fortress." |
|---|
| 30 | echo " Writes to somefile.tex (will overwrite original if suffix = \"tex\")" |
|---|
| 31 | echo " Option -q suppresses some of the command output." |
|---|
| 32 | exit 1 |
|---|
| 33 | fi |
|---|
| 34 | |
|---|
| 35 | if grep -q "usepackage{.*fortify.*}" $1 ; then |
|---|
| 36 | true |
|---|
| 37 | else |
|---|
| 38 | if [ -z "$SILENCE" ] ; then |
|---|
| 39 | echo "WARNING: input file lacks \\usepackage{fortify}" |
|---|
| 40 | fi |
|---|
| 41 | fi |
|---|
| 42 | |
|---|
| 43 | BASENAME=${1%.*} |
|---|
| 44 | |
|---|
| 45 | USE_EMACS=${USE_EMACS:-emacs} |
|---|
| 46 | [ -n "$EMACS" ] && unset EMACSLOADPATH |
|---|
| 47 | "${USE_EMACS}" -batch "$@" -l "$FORTRESS_HOME/Fortify/fortify.el" -f fortick |
|---|
| 48 | |
|---|
| 49 | if [ -z "$SILENCE" ] ; then |
|---|
| 50 | echo "Process with" |
|---|
| 51 | echo " TEXINPUTS=\".:${FORTRESS_HOME}/Fortify:\" latex \"${BASENAME}.tex\"" |
|---|
| 52 | echo "or (for pdf output) " |
|---|
| 53 | echo " TEXINPUTS=\".:${FORTRESS_HOME}/Fortify:\" pdflatex \"${BASENAME}.tex\"" |
|---|
| 54 | fi |
|---|