]> git.lyx.org Git - lyx.git/blobdiff - lib/scripts/TeXFiles.sh
Generate python code in GraphicsConverter.C, replace convertDefault.sh by convertDefa...
[lyx.git] / lib / scripts / TeXFiles.sh
index 976c8749ac797a5c4a8e85874af334bf9d58e7c8..300bb16d6b959edb20956ef40b9758c4558146f0 100755 (executable)
@@ -1,41 +1,60 @@
 #!/bin/sh
-# file: ~/bin/TeXFiles.sh
+
+# file TeXFiles.sh
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+
+# author Herbert Voß
+# author Jean-Marc Lasgouttes
+# author Jürgen Spitzmüller
+
+# Full author contact details are available in file CREDITS.
+
 # all files            -> without option
-# TeX class files      -> option cls 
+# TeX class files      -> option cls
 # TeX style files      -> option sty
 # bibtex style files   -> option bst
+# bibtex database files -> option bib
 #
 # with the help
-# of kpsewhich and creates a 
-# bstFiles.lst, clsFiles.lst, styFiles.lst
+# of kpsewhich and creates a
+# bstFiles.lst, clsFiles.lst, styFiles.lst, bibFiles.lst
 # without any parameter all files are created.
 #
 # Herbert Voss <voss@perce.org>
 #
 # Updates from Jean-Marc Lasgouttes.
 #
+# bib support added by Juergen Spitzmueller (v0.3)
+#
 CLS_STYLEFILE=clsFiles.lst
 STY_STYLEFILE=styFiles.lst
 BST_STYLEFILE=bstFiles.lst
-version='$Id: TeXFiles.sh,v 0.2 2001-10-15'
+BIB_FILES=bibFiles.lst
+version='$Id: TeXFiles.sh,v 0.3 2003-02-14'
 progname=`echo $0 | sed 's%.*/%%'`
-usage="Usage: TeXFiles.sh [-version | cls | sty | bst
+usage="Usage: TeXFiles.sh [-version | cls | sty | bst | bib ]
        Default is without any Parameters,
        so that all files will be created"
 
 types=$1
-test -z "$types" && types="cls sty bst"
+test -z "$types" && types="cls sty bst bib"
 
 #
-# MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use ';' to separate
-# directories in path lists whereas Unixes uses ':'.
-# $SEP holds the right character to be used by the scripts.
-#
-#???????????????
-# never used this one with windows and what happens with mac??
-#???????????????
-#
-if test -z "$COMSPEC" && test -z "$ComSpec"; then SEP=':'; else SEP=';'; fi
+# MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use `;' to separate
+# directories in path lists whereas Unix uses `:'.  Make an exception for
+# Cygwin, where we could have either teTeX (using `:') or MikTeX (using `;').
+# Create a variable that holds the right character to be used by the scripts.
+DOSISH=no
+case `uname -s` in
+  CYGWIN*|Cygwin*|cygwin*)
+    # MikTeX's kpsewhich says "kpathsea emulation version x.x.x", whereas
+    # teTeX's simply "kpathsea version x.x.x".
+    if kpsewhich --version | grep emulation >/dev/null 2>&1; then DOSISH=yes; fi
+    ;;
+  *) if test -n "$COMSPEC" || test -n "$ComSpec"; then DOSISH=yes; fi
+esac
+if test "$DOSISH" = "no"; then SEP=':'; else SEP=';'; fi
 
 #
 # A copy of some stuff from mktex.opt, so we can run in the presence of
@@ -52,13 +71,15 @@ fi
 
 for type in $types ; do
   echo "Indexing files of type $type"
-  case $type in 
+  case $type in
    cls) outfile=$CLS_STYLEFILE
         kpsetype=.tex;;
    sty) outfile=$STY_STYLEFILE
         kpsetype=.tex;;
    bst) outfile=$BST_STYLEFILE
         kpsetype=.bst;;
+   bib) outfile=$BIB_FILES
+        kpsetype=.bib;;
    *)   echo "ERROR: unknown type $type"
         exit 1;;
   esac
@@ -66,7 +87,7 @@ for type in $types ; do
   rm -f $outfile
   touch $outfile
 
-  dirs=`kpsewhich --show-path=$kpsetype 2>/dev/null | tr "$SEP" " " | sed -e 's%///%/%' -e 's%//%/%g' -e 's%!!%%g'`
+  dirs=`kpsewhich --show-path=$kpsetype 2>/dev/null | tr "$SEP" " " | sed -e 's%/\{2,\}%/%g' -e 's%!!%%g'`
 
   for dir in $dirs ; do
     find $dir -follow -name "*.$type" >>$outfile 2>/dev/null