-#
-# find the directories with kpsewhich. TeX has files ls-R to hold
-# the tex-tree
-#
-test $# = 0 && {
- OIFS=$IFS; IFS=$SEP; set x `kpsewhich --show-path=ls-R 2>/dev/null`; shift; IFS=$OIFS
-}
-echo 'Delete old *files.lst, if present'
-case "$1" in
- "cls")
- rm -f $CLS_STYLEFILE
- touch $CLS_STYLEFILE # create new file
- ;;
- "sty")
- rm -f $STY_STYLEFILE
- touch $STY_STYLEFILE # create new file
- ;;
- "bst")
- rm -f $BST_STYLEFILE
- touch $BST_STYLEFILE # create new file
- ;;
- *) # all other
- rm -f $CLS_STYLEFILE $STY_STYLEFILE $BST_STYLEFILE
- touch $CLS_STYLEFILE $STY_STYLEFILE $BST_STYLEFILE
- ;;
-esac
-echo "looking for all bst-style files in the latex tree";
-for TEXMFLSR in "$@"; do # go through the dirs
- case "$TEXMFLSR" in # Prepend cwd if the directory was relative.
- "") continue ;; # it is an error if this case is taken.
- /* | [A-z]:/*) ;; # leading /
- *) TEXMFLSR="`pwd`/$TEXMFLS_R" # all other
+
+for type in $types ; do
+ echo "Indexing files of type $type"
+ case $type in
+ cls) outfile=$CLS_STYLEFILE
+ kpsetype=.tex;;
+ sty) outfile=$STY_STYLEFILE
+ kpsetype=.tex;;
+ bst) outfile=$BST_STYLEFILE
+ kpsetype=.bst;;
+ *) echo "ERROR: unknown type $type"
+ exit 1;;