/usr/bin/wvPS is in wv 1.2.9-4.2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | #!/bin/sh
wv_script_name="$0"
which latex >/dev/null 2>&1
if [ ${?} -ne "0" ]; then
echo "Could not find required program 'latex'"
exit 1
fi
which dvips >/dev/null 2>&1
if [ ${?} -ne "0" ]; then
echo "Could not find required program 'dvips'"
exit 1
fi
prefix=/usr
exec_prefix=
datadir=
t_dir=.
wv_opts=
i_file=
o_file=
print_help=no
while test $# -gt 0; do
case "$1" in
-*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg= ;;
esac
case $1 in
--prefix=*)
prefix=$optarg
;;
--exec-prefix=*)
exec_prefix=$optarg
;;
--datadir=*)
datadir=$optarg
;;
--targetdir=*)
t_dir=$optarg
;;
--charset=* | --password=*)
wv_opts="$wv_opts $1"
;;
-v | --version)
echo 1.2.9
exit 0
;;
-\? | -h | --help)
cat << EOF
Usage: $wv_script_name [OPTIONS] <input-file> <output-file>
Options:
--prefix=<DIR> Set prefix (default is /usr)
--exec-prefix=<DIR> Set exec_prefix (default is ${prefix})
--datadir=<DIR> Set datadir (default is ${prefix}/share)
--targetdir=<DIR> Target directory (target is <DIR>/<output-file>)
--charset=<charset> Specify an iconv charset encoding
--password=<password> Specify password for encrypted
-v, --version Print version info and exit
Authors:
Dom Lachowicz (dominicl@seas.upenn.edu)
Caolan McNamara (original author)
Visit http://www.wvware.com/
EOF
exit 0
;;
-?*)
echo "Option '$1' not recognized."
exit 1
;;
*)
if test "x$i_file" = "x"; then
i_file=$1
elif test "x$o_file" = "x"; then
o_file=$1
else
echo "Option '$1' not recognized."
exit 1
fi
;;
esac
shift
done
if test "x$i_file" = "x-"; then
echo "error: cannot specify '-' as input"
exit 1
fi
if test -r "$i_file"; then
okay=yes
else
echo "error: '$i_file' unreadable"
exit 1
fi
if test "x$o_file" = "x"; then
echo "Usage: $1 [OPTIONS] <input-file> <output-file>"
exit 1
fi
if test "x$i_file" = "x-"; then
echo "error: cannot specify '-' as output"
exit 1
fi
name=`basename "$o_file"`
if test "x$o_file" != "x$name"; then
t_dir=`dirname "$o_file"`
o_file=$name
fi
name=`basename "$o_file" | sed "s/ /_/g"`
name=`echo $name | sed 's/\.[^\.]*$//'`
if test "x$exec_prefix" = "x"; then
exec_prefix=${prefix}
fi
wv_exec="$exec_prefix/bin/wvWare"
if test -x "$wv_exec"; then
okay=yes
else
wv_version=`wvWare -v 2>&1 | cut -f 2 -d " "`
if test "x$wv_version" = "x1.2.9"; then
wv_exec="wvWare"
else
echo "error: no executable at '$wv_exec' or in path"
exit 1
fi
fi
if test "x$datadir" = "x"; then
datadir=${prefix}/share
fi
xmlcfg="$datadir/wv/wvLaTeX.xml"
if test -r "$xmlcfg"; then
okay=yes
else
echo "error: '$xmlcfg' unreadable"
exit 1
fi
if test -d "$t_dir"; then
if test -w "$t_dir"; then
okay=yes
else
echo "error: '$t_dir' is not writable"
exit 1
fi
else
echo "error: '$t_dir' is not a directory"
exit 1
fi
# auto_wmf=`"$wv_exec" --auto-eps=wmf`
# auto_emf=`"$wv_exec" --auto-eps=emf`
# auto_png=`"$wv_exec" --auto-eps=png`
# auto_jpg=`"$wv_exec" --auto-eps=jpg`
# auto_pict=`"$wv_exec" --auto-eps=pict`
im_chk=`convert --help 2>&1 | grep ImageMagick`
if test "x$im_chk" = "x"; then
im_chk="no"
s_img=""
else
im_chk="yes"
# if we have ImageMagick's convert, then use that to convert PNG, JPEG & PICT
# to EPS. Therefore, need to suppress wvWare's desire to convert these:
s_img="png,jpg,pict"
fi
"$wv_exec" $wv_opts -x "$xmlcfg" -d "$t_dir" -b "$name" "$i_file" -s "$s_img" > "$t_dir"/"$name".tex
cd "$t_dir"
echo
echo 'Current directory: '`pwd`
# First, convert any images
i_okay=yes
for i_name in "$name"*.wmf; do
if test -r "$i_name"; then
e_name=`echo "$i_name" | sed 's/wmf$/eps/'`
if test -r "$e_name"; then
echo '"'$e_name'"' exists - skipping...
else
if test "$im_chk" = "yes"; then
convert "$i_name" "$e_name"
if test -r "$e_name"; then
echo created '"'$e_name'"'
else
echo '"'$i_name'"': conversion failed
i_okay=no
fi
else
echo unable to convert '"'$i_name'"' '(no converter)'
i_okay=no
fi
fi
fi
done
for i_name in "$name"*.emf; do
if test -r "$i_name"; then
e_name=`echo "$i_name" | sed 's/emf$/eps/'`
if test -r "$e_name"; then
echo '"'$e_name'"' exists - skipping...
else
echo unable to convert '"'$i_name'"' '(no converter)'
i_okay=no
fi
fi
done
for i_name in "$name"*.png; do
if test -r "$i_name"; then
e_name=`echo "$i_name" | sed 's/png$/eps/'`
if test -r "$e_name"; then
echo '"'$e_name'"' exists - skipping...
else
if test "$im_chk" = "yes"; then
convert "$i_name" "$e_name"
if test -r "$e_name"; then
echo created '"'$e_name'"'
else
echo '"'$i_name'"': conversion failed
i_okay=no
fi
else
echo unable to convert '"'$i_name'"' '(no converter)'
i_okay=no
fi
fi
fi
done
for i_name in "$name"*.jpg; do
if test -r "$i_name"; then
e_name=`echo "$i_name" | sed 's/jpg$/eps/'`
if test -r "$e_name"; then
echo '"'$e_name'"' exists - skipping...
else
if test "$im_chk" = "yes"; then
convert "$i_name" "$e_name"
if test -r "$e_name"; then
echo created '"'$e_name'"'
else
echo '"'$i_name'"': conversion failed
i_okay=no
fi
else
echo unable to convert '"'$i_name'"' '(no converter)'
i_okay=no
fi
fi
fi
done
for i_name in "$name"*.pict; do
if test -r "$i_name"; then
e_name=`echo "$i_name" | sed 's/pict$/eps/'`
if test -r "$e_name"; then
echo '"'$e_name'"' exists - skipping...
else
if test "$im_chk" = "yes"; then
convert "$i_name" "$e_name"
if test -r "$e_name"; then
echo created '"'$e_name'"'
else
echo '"'$i_name'"': conversion failed
i_okay=no
fi
else
echo unable to convert '"'$i_name'"' '(no converter)'
i_okay=no
fi
fi
fi
done
if test "$i_okay" = "no"; then
echo 'WARNING: Failed to convert one or more images to EPS'
fi
# "$name".tex is the LaTeX file
# use latex to convert this to DVI
latex --interaction=batchmode "$name".tex >/dev/null 2>&1
# check latex exit status and comment or clean up
if [ ${?} -ne "0" ]; then
echo "Some problem running latex."
echo "Check for Errors in $name.log"
echo "Continuing..."
else
rm -f "$name".aux "$name".log "$name".tex
fi
# latex replaces the "tex" extension with a "dvi" extension
if [ ! -f "$name".dvi ]; then
echo "Conversion into dvi failed"
exit 1
fi
dvips -o "$o_file" "$name".dvi >/dev/null 2>&1
if [ ${?} -ne "0" ]; then
echo "Could not convert into Postscript"
exit 1
fi
#clean up
rm -f "$name".dvi
|