From 876747da2a1b3c876790579bb13673aac18ee780 Mon Sep 17 00:00:00 2001 From: dockes Date: Wed, 21 Jan 2009 11:11:03 +0000 Subject: [PATCH] try to use wvWare if present and antiword fails --- src/filters/rcldoc | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/filters/rcldoc b/src/filters/rcldoc index c74a1dc4..14c33f1b 100755 --- a/src/filters/rcldoc +++ b/src/filters/rcldoc @@ -28,8 +28,6 @@ decoder="antiword -t -i 1 -m UTF-8" #decoder="wvWare -1 -c UTF-8" - - #RECFILTCOMMONCODE ############################################################################## # !! Leave the previous line unmodified!! Code imported from the @@ -108,8 +106,11 @@ awk 'BEGIN'\ print "" print "\n\n

" cont = "" + gotdata = 0 } { + if (!($0 ~ /^[ ]*$/)) + gotdata = 1 $0 = cont $0 cont = "" @@ -133,8 +134,17 @@ awk 'BEGIN'\ print $0 "
" } END { + if (gotdata == 0) + exit(1) print "

" -}' | iconv -f UTF-8 -t UTF-8 -c -s +}' -# exit normally -exit 0 +# wvWare is much slower and we don't use it by default, but it handles +# some files that antiword won't, so use it as a last resort. Yes the +# html document will have a second header section, but this doesn't +# seem to be an issue with our brave html input handler... +if test $? -eq 1 ; then + if iscmd wvWare ; then + wvWare --nographics --charset=utf-8 $infile + fi +fi