1 | #! /bin/sh |
1 | #! /bin/sh |
|
|
2 | |
|
|
3 | # Work around a BASH bug (prints a directory even in a non-interactive shell) |
|
|
4 | unset CDPATH |
2 | |
5 | |
3 | if test "$#" -lt 3 ; then |
6 | if test "$#" -lt 3 ; then |
4 | echo "Syntax: $0 psiconv_dir output_dir files..." |
7 | echo "Syntax: $0 psiconv_dir output_dir files..." |
5 | exit 1 |
8 | exit 1 |
6 | fi |
9 | fi |
7 | |
10 | |
8 | if ! test -d "$1"/program/psiconv ; then |
11 | if test ! -d "$1"/program/psiconv ; then |
9 | echo "First parameter should be base psiconv directory!" |
12 | echo "First parameter should be base psiconv directory!" |
10 | exit 1 |
13 | exit 1 |
11 | fi |
14 | fi |
12 | basedir=`cd $1; pwd` |
15 | basedir=`cd $1; pwd` |
13 | |
16 | |
14 | if ! test -d "$2" ; then |
17 | if test ! -d "$2" ; then |
15 | echo "Output directory does not exist!" |
18 | echo "Output directory does not exist!" |
16 | exit 1 |
19 | exit 1 |
17 | fi |
20 | fi |
18 | outputdir=`cd $2; pwd` |
21 | outputdir=`cd $2; pwd` |
19 | |
22 | |
… | |
… | |
26 | psiconv=$basedir/program/psiconv/psiconv |
29 | psiconv=$basedir/program/psiconv/psiconv |
27 | indexfile=$outputdir/index |
30 | indexfile=$outputdir/index |
28 | tempdir=$outputdir/.temp |
31 | tempdir=$outputdir/.temp |
29 | mkindex=$basedir/formats/index_html.sh |
32 | mkindex=$basedir/formats/index_html.sh |
30 | index=$tempdir/index |
33 | index=$tempdir/index |
31 | mkdef=$basedir/formats/html_links.sh |
34 | mkdef=$basedir/formats/html4_links.sh |
|
|
35 | config="$basedir/formats/psiconv.conf" |
32 | |
36 | |
33 | |
37 | |
34 | echo "Going to create the intermediate files..." |
38 | echo "Going to create the intermediate files..." |
35 | rm -rf $tempdir |
39 | rm -rf $tempdir |
36 | mkdir $tempdir |
40 | mkdir $tempdir |
37 | for file in "$@"; do |
41 | for file in "$@"; do |
38 | echo "Going to process $file..." |
42 | echo "Going to process $file..." |
39 | outputfile=$tempdir/`basename $file|sed s,'.psi$','.html,'` |
43 | outputfile=$tempdir/`basename $file|sed s,'.psi$','.html,'` |
40 | echo $libtool --mode=execute $psiconv -o $outputfile -Thtml4 $file |
44 | echo $libtool --mode=execute $psiconv -c $config -o $outputfile -Thtml4 -eASCII $file |
41 | $libtool --mode=execute $psiconv -o $outputfile -Thtml4 $file |
45 | $libtool --mode=execute $psiconv -c $config -o $outputfile -Thtml4 -eASCII $file |
42 | done |
46 | done |
43 | |
47 | |
44 | echo "Going to produce the index..." |
48 | echo "Going to produce the index..." |
45 | ( |
49 | ( |
46 | cd $tempdir |
50 | cd $tempdir |