/usr/bin/wvText is in wv 1.2.9-3.
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 | #!/bin/sh
prefix=/usr
exec_prefix=${prefix}
datadir=${prefix}/share
tmpdir=${TMPDIR:-/tmp}
# argument checking
if [ ${#} -ne "2" ]; then
echo "Usage: ${0} <word document> <text output file>"
exit 1
fi
USE_DUMP=0
which elinks >/dev/null 2>&1
if [ ${?} -eq "0" ]; then
USE_DUMP=3
else
which links >/dev/null 2>&1
if [ ${?} -eq "0" ]; then
USE_DUMP=2
else
which lynx >/dev/null 2>&1
if [ ${?} -eq "0" ]; then
USE_DUMP=1
fi
fi
fi
if [ $USE_DUMP -eq "1" ]; then
echo "Could not find required program 'elinks' or 'links'"
echo "Using lynx. Output will be pretty ugly."
elif [ $USE_DUMP -eq "0" ]; then
echo "Could not find required program 'elinks', 'links', or even 'lynx'"
echo "Using wvWare -x wvText.xml. Output will be pretty bad."
fi
if [ $USE_DUMP -gt "0" ]; then
# first, test for wvHtml
which wvHtml >/dev/null 2>&1
if [ ${?} -ne "0" ]; then
echo "Could not find required program 'wvHtml'"
exit 1
fi
# intermediate file
TMP_FILE=`mktemp "$tmpdir/wv-XXXXXX"`
TMP_FILE=`basename "$TMP_FILE"`
wvHtml -1 "${1}" --targetdir="${tmpdir}" "${TMP_FILE}" >/dev/null 2>&1
if [ ${?} -ne "0" ]; then
echo "Could not convert into HTML"
exit 1
fi
if [ $USE_DUMP -eq "3" ]; then
# elinks does the best
elinks -dump -force-html "${tmpdir}/${TMP_FILE}" > "${2}"
elif [ $USE_DUMP -eq "2" ]; then
# links does a pretty good job
links -dump "${tmpdir}/${TMP_FILE}" > "${2}"
else
# lynx sucks, but does better than wvText.xml
TERM=vt100 lynx -dump -force_html "${tmpdir}/${TMP_FILE}" > "${2}"
fi;
if [ ${?} -ne "0" ]; then
echo "Could not convert into Text"
rm -f "${tmpdir}/${TMP_FILE}"
exit 1
fi
# clean up
rm -f "${tmpdir}/${TMP_FILE}"
else
# fall back onto our cruddy output
# this is, admittedly, better than running
# 'strings' on the word document though :)
wvWare -1 -x ${datadir}/wv/wvText.xml "${1}" > "${2}"
fi
|