2 # file: ~/bin/TeXFiles.sh
3 # all files -> without option
4 # TeX class files -> option cls
5 # TeX style files -> option sty
6 # bibtex style files -> option bst
9 # of kpsewhich and creates a
10 # bstFiles.lst, clsFiles.lst, styFiles.lst
11 # without any parameter all files are created.
13 # Herbert Voss <voss@perce.org>
15 # Updates from Jean-Marc Lasgouttes.
17 CLS_STYLEFILE=clsFiles.lst
18 STY_STYLEFILE=styFiles.lst
19 BST_STYLEFILE=bstFiles.lst
20 version='$Id: TeXFiles.sh,v 0.2 2001-10-15'
21 progname=`echo $0 | sed 's%.*/%%'`
22 usage="Usage: TeXFiles.sh [-version | cls | sty | bst]
23 Default is without any Parameters,
24 so that all files will be created"
27 test -z "$types" && types="cls sty bst"
30 # MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use ';' to separate
31 # directories in path lists whereas Unixes uses ':'.
32 # $SEP holds the right character to be used by the scripts.
35 # never used this one with windows and what happens with mac??
38 if test -z "$COMSPEC" && test -z "$ComSpec"; then SEP=':'; else SEP=';'; fi
41 # A copy of some stuff from mktex.opt, so we can run in the presence of
42 # terminally damaged ls-R files.
44 if test "x$1" = x--help || test "x$1" = x-help; then
47 elif test "x$1" = x--version || test "x$1" = x-version; then
48 echo "`basename $0` $version"
53 for type in $types ; do
54 echo "Indexing files of type $type"
56 cls) outfile=$CLS_STYLEFILE
58 sty) outfile=$STY_STYLEFILE
60 bst) outfile=$BST_STYLEFILE
62 *) echo "ERROR: unknown type $type"
69 dirs=`kpsewhich --show-path=$kpsetype 2>/dev/null | tr "$SEP" " " | sed -e 's%///%/%' -e 's%//%/%g' -e 's%!!%%g'`
72 find $dir -follow -name "*.$type" >>$outfile 2>/dev/null
76 #echo "list saved in $STYLEFILE"
77 #echo `wc -l $CLS_STYLEFILE` # only for information
79 # this is the end my friends ... Jim Morrison and the Doors in "The End"