Package: wv / 1.2.9-4.1

wvmime.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#! /bin/sh /usr/share/dpatch/dpatch-run
## wvmime.dpatch by Matej Vela <vela@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: wvMime:
## DP: - If available, use see(1) from mime-support.
## DP: - Look for kghostview.
## DP: - Make the script whitespace-safe.
## DP: - Use wvPS rather than make_epses.sh (now gone).

@DPATCH@
diff -urNad wv-1.2.1~/wvMime wv-1.2.1/wvMime
--- wv-1.2.1~/wvMime	2006-03-18 19:16:28.000000000 +0100
+++ wv-1.2.1/wvMime	2006-03-18 19:18:54.000000000 +0100
@@ -12,64 +12,37 @@
 	exit 1
 fi
 
-# viewer application
-GV=""
-
-# check for gnome ghost-view first
-type ggv >/dev/null 2>&1
-if [ ${?} -eq "0" ]; then
-	GV="ggv"
-else
-	# TODO: does kde have something?
-
-	# try to default back onto gv
-	type gv >/dev/null 2>&1
-	if [ ${?} -eq "0" ]; then
-		GV="gv"
-	else
-		# old solaris systems
-		type ghostview >/dev/null 2>&1
-		if [ ${?} -eq "0" ]; then
-			GV="ghostview"
-		else
-			# unrecoverable error
-			echo "Could not find a suitable PostScript viewer."
-			echo "Please install ggv, gv, or ghostview"
-			exit 1
-		fi
+if [ -z "$GV" ]; then
+	# determine the viewer application:
+	# - see (let mailcap decide)
+	# - ggv (GNOME Ghostview)
+	# - kghostview (KDE Ghostview)
+	# - gv (Xaw3d Ghostview)
+	# - ghostview (the classic Ghostscript frontend)
+	for GV in see ggv kghostview gv ghostview; do
+		type "$GV" >/dev/null 2>&1 && break
+	done
+	if [ ${?} -ne "0" ]; then
+		# unrecoverable error
+		echo "Could not find a suitable PostScript viewer."
+		echo "Please install ggv, kghostview, gv, or ghostview"
+		exit 1
 	fi
 fi
 
-# temporary PS file, mangled to get some sort
-# of semi-uniqueness
-FILE=`basename ${1}`
-TMPDIR="/tmp/${FILE}-${USER}-${$}"
-TMPPS="$TMPDIR/${FILE}-${USER}-${$}.ps" 
-
-mkdir $TMPDIR
-
-# Make sure all graphics go into /tmp as well
-cp ${1} $TMPDIR/$FILE
-
-# Extract graphics
-wvLatex "$TMPDIR/$FILE" "$TMPDIR/$FILE.tex" 2>/dev/null >/dev/null
+# temporary target directory
+t_dir=${TMPDIR:-/tmp}/wvMime-$USER-$$
+mkdir -m 700 "$t_dir" || exit
+trap 'rm -rf "$t_dir"' 0 1 2 3 15
 
-# Graphics conversion if make_epses.sh installed:
-STEM=$TMPDIR/`basename ${1} .doc`
-type make_epses.sh 2>&1 >/dev/null
-  if [ ${?} -eq "0" ]; then
-    (cd $TMPDIR; make_epses.sh $STEM)
-  fi
+# PS file
+name=`basename "$1" .doc`.ps
 
-wvPS $TMPDIR/$FILE ${TMPPS}
+wvPS --targetdir="$t_dir" "$1" "$name"
 if [ ${?} -ne "0" ]; then 
 	echo "Could not translate into Postscript" 
 	exit 1 
 fi 
 
 # call our ghost-viewer
-${GV} ${TMPPS}
-rm -f ${TMPPS}
-
-cd /
-rm -rf $TMPDIR
+$GV "$t_dir/$name"