1 |
--- ./wvMime.tmp-filename 2004-05-14 07:18:23.000000000 +0200 |
2 |
+++ ./wvMime 2004-05-14 08:18:18.000000000 +0200 |
3 |
@@ -42,34 +42,37 @@ |
4 |
|
5 |
# temporary PS file, mangled to get some sort |
6 |
# of semi-uniqueness |
7 |
-FILE=`basename ${1}` |
8 |
-TMPDIR="/tmp/${FILE}-${USER}-${$}" |
9 |
-TMPPS="$TMPDIR/${FILE}-${USER}-${$}.ps" |
10 |
- |
11 |
-mkdir $TMPDIR |
12 |
+FILE="`basename "${1}"`" |
13 |
+TMPDIR=$(mktemp -d /tmp/wvMime.XXXXXXXX) || { echo "$0: can not create temporary directory" >& 2; exit 1; } |
14 |
+TMPPS="$TMPDIR/tmp.ps" |
15 |
+TMPFILE="$TMPDIR/tmpfile" |
16 |
+TMPTEX="$TMPDIR/tmp.tex" |
17 |
+#TMPPS="$TMPDIR/${FILE}-${USER}-${$}.ps" |
18 |
|
19 |
# Make sure all graphics go into /tmp as well |
20 |
-cp ${1} $TMPDIR/$FILE |
21 |
+cp "${1}" "$TMPFILE" |
22 |
|
23 |
# Extract graphics |
24 |
-wvLatex "$TMPDIR/$FILE" "$TMPDIR/$FILE.tex" 2>/dev/null >/dev/null |
25 |
+wvLatex "$TMPFILE" "$TMPTEX" 2>/dev/null >/dev/null |
26 |
|
27 |
# Graphics conversion if make_epses.sh installed: |
28 |
-STEM=$TMPDIR/`basename ${1} .doc` |
29 |
-type make_epses.sh 2>&1 >/dev/null |
30 |
- if [ ${?} -eq "0" ]; then |
31 |
- (cd $TMPDIR; make_epses.sh $STEM) |
32 |
- fi |
33 |
+#STEM=$TMPDIR/"`basename "${1}" .doc`" |
34 |
+#type make_epses.sh >/dev/null 2>&1 |
35 |
+# if [ ${?} -eq "0" ]; then |
36 |
+# (cd $TMPDIR; make_epses.sh $STEM) |
37 |
+# fi |
38 |
|
39 |
-wvPS $TMPDIR/$FILE ${TMPPS} |
40 |
+cd $TMPDIR |
41 |
+wvPS `basename $TMPFILE` `basename ${TMPPS}` |
42 |
if [ ${?} -ne "0" ]; then |
43 |
echo "Could not translate into Postscript" |
44 |
+ rm -rf $TMPDIR |
45 |
exit 1 |
46 |
fi |
47 |
|
48 |
# call our ghost-viewer |
49 |
-${GV} ${TMPPS} |
50 |
-rm -f ${TMPPS} |
51 |
+${GV} "${TMPPS}" |
52 |
+rm -f "${TMPPS}" |
53 |
|
54 |
cd / |
55 |
rm -rf $TMPDIR |