]> git.lyx.org Git - lyx.git/blob - lib/scripts/TeXFiles.sh
clean up french language handling
[lyx.git] / lib / scripts / TeXFiles.sh
1 #!/bin/sh
2
3 # file TeXFiles.sh
4 # This file is part of LyX, the document processor.
5 # Licence details can be found in the file COPYING.
6
7 # author Herbert Voß
8 # author Jean-Marc Lasgouttes
9 # author Jürgen Spitzmüller
10
11 # Full author contact details are available in file CREDITS.
12
13 # all files             -> without option
14 # TeX class files       -> option cls
15 # TeX style files       -> option sty
16 # bibtex style files    -> option bst
17 # bibtex database files -> option bib
18 #
19 # with the help
20 # of kpsewhich and creates a
21 # bstFiles.lst, clsFiles.lst, styFiles.lst, bibFiles.lst
22 # without any parameter all files are created.
23 #
24 # Herbert Voss <voss@perce.org>
25 #
26 # Updates from Jean-Marc Lasgouttes.
27 #
28 # bib support added by Juergen Spitzmueller (v0.3)
29 #
30 CLS_STYLEFILE=clsFiles.lst
31 STY_STYLEFILE=styFiles.lst
32 BST_STYLEFILE=bstFiles.lst
33 BIB_FILES=bibFiles.lst
34 version='$Id: TeXFiles.sh,v 0.3 2003-02-14'
35 progname=`echo $0 | sed 's%.*/%%'`
36 usage="Usage: TeXFiles.sh [-version | cls | sty | bst | bib ]
37        Default is without any Parameters,
38        so that all files will be created"
39
40 types=$1
41 test -z "$types" && types="cls sty bst bib"
42
43 #
44 # MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use ';' to separate
45 # directories in path lists whereas Unixes uses ':'.
46 # $SEP holds the right character to be used by the scripts.
47 #
48 #???????????????
49 # never used this one with windows and what happens with mac??
50 #???????????????
51 #
52 if test -z "$COMSPEC" && test -z "$ComSpec"; then SEP=':'; else SEP=';'; fi
53
54 #
55 # A copy of some stuff from mktex.opt, so we can run in the presence of
56 # terminally damaged ls-R files.
57 #
58 if test "x$1" = x--help || test "x$1" = x-help; then
59   echo "$usage"
60   exit 0
61 elif test "x$1" = x--version || test "x$1" = x-version; then
62   echo "`basename $0` $version"
63   kpsewhich --version
64   exit 0
65 fi
66
67 for type in $types ; do
68   echo "Indexing files of type $type"
69   case $type in
70    cls) outfile=$CLS_STYLEFILE
71         kpsetype=.tex;;
72    sty) outfile=$STY_STYLEFILE
73         kpsetype=.tex;;
74    bst) outfile=$BST_STYLEFILE
75         kpsetype=.bst;;
76    bib) outfile=$BIB_FILES
77         kpsetype=.bib;;
78    *)   echo "ERROR: unknown type $type"
79         exit 1;;
80   esac
81
82   rm -f $outfile
83   touch $outfile
84
85   dirs=`kpsewhich --show-path=$kpsetype 2>/dev/null | tr "$SEP" " " | sed -e 's%/\{2,\}%/%g' -e 's%!!%%g'`
86
87   for dir in $dirs ; do
88     find $dir -follow -name "*.$type" >>$outfile 2>/dev/null
89   done
90
91 done
92 #echo "list saved in $STYLEFILE"
93 #echo `wc -l $CLS_STYLEFILE`            # only for information
94 #
95 # this is the end my friends ... Jim Morrison and the Doors in "The End"