/[lkdp]/lkdp/cook
ViewVC logotype

Diff of /lkdp/cook

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by nayaniabhishek, Sat Jun 8 09:34:44 2002 UTC revision 1.4 by nayaniabhishek, Thu Jun 13 13:02:32 2002 UTC
# Line 13  LATEX=latex Line 13  LATEX=latex
13  MAKEINDEX=makeindex  MAKEINDEX=makeindex
14  PDF_CMD=dvipdfm  PDF_CMD=dvipdfm
15  PS_CMD=dvips  PS_CMD=dvips
16    PS_OPTS=" -o"
17  HTML_CMD=latex2html  HTML_CMD=latex2html
18  HTML_OPTS=" -html_version 4 -bottom_navigation -antialias -antialias_text -mkdir"  HTML_OPTS=" -html_version 4 -bottom_navigation -antialias -antialias_text -mkdir"
19  INDEX=0  INDEX=0
20  RUNS=0  RUNS=0
21  OP=pdf  # default action  OP=pdf  # default action
22  TEMP=`getopt -o a:n:i -n 'cook' -- "$@"`  FULL=0
23    TEMP=`getopt -o a:n:o:fih -n 'cook' -- "$@"`
24    
25  if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi  if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
26    
# Line 32  while true ; do Line 34  while true ; do
34                      shift 2 ;;                      shift 2 ;;
35                  -a) OP=$2                  -a) OP=$2
36                      shift 2 ;;                      shift 2 ;;
37                    -o) ODIR=$2
38                        export ODIR
39                        shift 2 ;;
40                    -f) FULL=1
41                        shift ;;
42                    -h) echo "Usage:"
43                        echo " -a  => Action to perform "
44                        echo "        options = pdf, ps, html, all, clean "
45                        echo "        (if running from lkdp, specify books to cook, * also works)"
46                        echo " -o  => Output directory (Absolute Path) "
47                        echo " -n  => Number of LaTeX runs "
48                        echo " -i  => Run Makeindex "
49                        echo " -f  => Make all formats in all books (only from lkdp) "
50                        echo " -h  => Help "
51                        shift ;;
52                  --) shift ; break ;;                  --) shift ; break ;;
53                  *) echo "Internal error!" ; exit 1 ;;                  *) echo "Internal error!" ; exit 1 ;;
54          esac          esac
# Line 70  function core() Line 87  function core()
87    
88  }  }
89    
90  for arg do  
91          if [ -d $arg ] && [ -a $arg/cook ]  function loop()
92    {
93            if [ -d $1 ] && [ -a $1/cook ]
94          then              then    
95                  echo 'Entering '$arg;                    echo 'Entering '$1;  
96                  cd "$arg"; ./cook -a $OP -i -n $RUNS                  cd "$1"; shift; ./cook $@
97                  cd ..                  cd ..
98          fi          fi
99  done  
100    }
101    
102    
103    
104    function move()
105    {
106            if [[ $ODIR != `pwd` ]]
107            then
108                    echo Moving ${BOOK}$1 to ${ODIR}/$2
109                    mkdir -p ${ODIR}/
110                    mv ${BOOK}$1 ${ODIR}/$2
111            fi
112    }
113    
114            
115  function action()  function action()
116  {  {
117    
# Line 87  function action() Line 119  function action()
119                  html)                  html)
120                          core                          core
121                          $HTML_CMD $HTML_OPTS $BOOK                          $HTML_CMD $HTML_OPTS $BOOK
122                          echo html;;                          move "" ${BOOK}_html;;
123                  ps)                      ps)    
124                          core                          core
125                          $PS_CMD $BOOK                          $PS_CMD $BOOK $PS_OPTS
126                          echo ps;;                          move .ps;;
127                  clean)                  clean)
128                          rm -f *.aux *.log *.toc *.i* *.out                          rm -f *.aux *.log *.toc *.i* *.out
129                          echo Cleaned;;                          echo Cleaned;;
130                  pdf)                  pdf)
131                          core                          core
132                          $PDF_CMD $BOOK;;                          $PDF_CMD $BOOK
133                            move .pdf;;
134                    all)
135                            core
136                            $PDF_CMD $BOOK && move .pdf
137                            $PS_CMD $BOOK $PS_OPTS && move .ps
138                            $HTML_CMD $HTML_OPTS $BOOK && move "" ${BOOK}_html;;
139          esac              esac    
140    
141  }  }
142    
143    
144    if [ -z $ODIR ]
145    then
146            export ODIR=`pwd`
147    fi      
148    
149    if [ $FULL == 0 ]
150    then    
151            OPTS=" -a $OP -i -n $RUNS -o $ODIR"
152            for arg do
153                    loop $arg $OPTS
154            done
155    else
156            OPTS=" -a all -i -n $RUNS -o $ODIR"
157            for arg in *; do        
158                    loop $arg $OPTS
159            done
160    fi      
161            

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26