From 2f75b9acb0838961af54461cd95a9b2f5b8ec252 Mon Sep 17 00:00:00 2001 From: dockes Date: Tue, 6 Feb 2007 15:08:23 +0000 Subject: [PATCH] factored out filter script common code --- src/filters/rcldjvu | 54 ++++++++++++++++---- src/filters/rcldoc | 56 +++++++++++++++------ src/filters/rcldvi | 85 ++++++++++++++++++++++--------- src/filters/rclgaim | 56 ++++++++++++++------- src/filters/rcllyx | 58 ++++++++++++++------- src/filters/rclman | 111 +++++++++++++++++++++++++++++++++++++++++ src/filters/rclmedia | 62 ++++++++++++++++------- src/filters/rclpdf | 59 +++++++++++++++------- src/filters/rclppt | 57 +++++++++++++++------ src/filters/rclps | 61 ++++++++++++++-------- src/filters/rclrtf | 60 +++++++++++++++------- src/filters/rclscribus | 59 +++++++++++++++------- src/filters/rclsoff | 55 +++++++++++++++----- src/filters/rclxls | 55 +++++++++++++++----- 14 files changed, 674 insertions(+), 214 deletions(-) create mode 100755 src/filters/rclman diff --git a/src/filters/rcldjvu b/src/filters/rcldjvu index 7e1b3738..a380db9d 100755 --- a/src/filters/rcldjvu +++ b/src/filters/rcldjvu @@ -1,5 +1,5 @@ #!/bin/sh -# @(#$Id: rcldjvu,v 1.3 2007-01-30 11:36:02 dockes Exp $ (C) 2005 J.F.Dockes +# @(#$Id: rcldjvu,v 1.4 2007-02-06 15:08:22 dockes Exp $ (C) 2005 J.F.Dockes # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -30,16 +30,27 @@ LANG=C ; export LANG LC_ALL=C ; export LC_ALL progname="rcldjvu" +filetype=dejavu -# show help message -if test $# -ne 1 -o "$1" = "--help" -then - printf 'Convert a djvu file to HTML text for recoll indexation.\n' - printf 'Usage: %s [infile]\n' "$progname" - exit 1 -fi -infile="$1" + +#RECFILTCOMMONCODE +############################################################################## +# !! Leave the previous line unmodified!! Code imported from the +# recfiltcommon file + +# Utility code common to all shell filters. This could be sourced at run +# time, but it's slightly more efficient to include the code in the +# filters at build time (with a sed script). + +# Describe error in a way that can be interpreted by our caller +senderror() +{ + echo RECFILTERROR $* + # Also alert on stderr just in case + echo ":2:$progname::: $*" 1>&2 + exit 1 +} iscmd() { @@ -53,6 +64,7 @@ iscmd() return 1 ;; esac } + checkcmds() { for cmd in $*;do @@ -60,11 +72,31 @@ checkcmds() then a=1 else - echo $cmd not found 1>&2 - exit 1 + senderror HELPERNOTFOUND $cmd fi done } + +# show help message +if test $# -ne 1 -o "$1" = "--help" +then + echo "Convert a $filetype file to HTML text for Recoll indexing." + echo "Usage: $progname [infile]" + exit 1 +fi + +infile="$1" + +# check the input file existence (may be '-' for stdin) +if test "X$infile" != X- -a ! -f "$infile" +then + senderror INPUTNOSUCHFILE "$infile" +fi + +############################################################################## +# !! Leave the following line unmodified ! +#ENDRECFILTCOMMONCODE + checkcmds djvutxt djvused awk # check the input file existence diff --git a/src/filters/rcldoc b/src/filters/rcldoc index 0cf46ec6..c07c4620 100755 --- a/src/filters/rcldoc +++ b/src/filters/rcldoc @@ -1,5 +1,5 @@ #!/bin/sh -# @(#$Id: rcldoc,v 1.6 2007-01-30 11:36:02 dockes Exp $ (C) 2004 J.F.Dockes +# @(#$Id: rcldoc,v 1.7 2007-02-06 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes # Parts taken from Estraier: #================================================================ # Estraier: a personal full-text search system @@ -20,20 +20,32 @@ LANG=C ; export LANG LC_ALL=C ; export LC_ALL progname="rcldoc" +filetype=ms-word + decoder="antiword -t -i 1 -m UTF-8" # Not ready to use this for now (it outputs html, so the code below has to # be simplified.) #decoder="wvWare -1 -c UTF-8" -# show help message -if test $# -ne 1 -o "$1" = "--help" -then - printf 'Convert a word file to unformatted HTML text.\n' - printf 'Usage: %s [infile]\n' "$progname" - exit 1 -fi -infile="$1" + +#RECFILTCOMMONCODE +############################################################################## +# !! Leave the previous line unmodified!! Code imported from the +# recfiltcommon file + +# Utility code common to all shell filters. This could be sourced at run +# time, but it's slightly more efficient to include the code in the +# filters at build time (with a sed script). + +# Describe error in a way that can be interpreted by our caller +senderror() +{ + echo RECFILTERROR $* + # Also alert on stderr just in case + echo ":2:$progname::: $*" 1>&2 + exit 1 +} iscmd() { @@ -47,6 +59,7 @@ iscmd() return 1 ;; esac } + checkcmds() { for cmd in $*;do @@ -54,20 +67,33 @@ checkcmds() then a=1 else - echo $cmd not found 1>&2 - exit 1 + senderror HELPERNOTFOUND $cmd fi done } -checkcmds awk antiword iconv -# check the input file existence -if test ! -f "$infile" +# show help message +if test $# -ne 1 -o "$1" = "--help" then - printf '%s: %s: no such file\n' "$progname" "$infile" + echo "Convert a $filetype file to HTML text for Recoll indexing." + echo "Usage: $progname [infile]" exit 1 fi +infile="$1" + +# check the input file existence (may be '-' for stdin) +if test "X$infile" != X- -a ! -f "$infile" +then + senderror INPUTNOSUCHFILE "$infile" +fi + +############################################################################## +# !! Leave the following line unmodified ! +#ENDRECFILTCOMMONCODE + +checkcmds awk antiword iconv + # output the result # The strange 'BEGIN' setup is to prevent 'file' from thinking this file # is an awk program diff --git a/src/filters/rcldvi b/src/filters/rcldvi index 1b7aa6e0..71c23848 100755 --- a/src/filters/rcldvi +++ b/src/filters/rcldvi @@ -1,5 +1,5 @@ #!/bin/sh -# @(#$Id: rcldvi,v 1.3 2007-01-30 11:36:02 dockes Exp $ (C) 2006 J.F.Dockes +# @(#$Id: rcldvi,v 1.4 2007-02-06 15:08:22 dockes Exp $ (C) 2006 J.F.Dockes # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,20 +22,32 @@ # or using catdvi. dvitops has given better results during tests, and is # chosen first if available, but the dvitops/rclps combination is much # slower than catdvi +# set variables +LANG=C ; export LANG +LC_ALL=C ; export LC_ALL +progname="rcldvi" +filetype=dvi -# Show help message -if test $# -ne 1 -o "$1" = "--help" -then - printf 'Convert a dvi file to unformatted HTML text for recoll indexation.\n' - printf 'Usage: %s [infile]\n' "$progname" - exit 1 -fi -# Find rclps. Note: this only works because we are always executed with a -# full path -infile="$1" -rclps=`dirname $0`/rclps + +#RECFILTCOMMONCODE +############################################################################## +# !! Leave the previous line unmodified!! Code imported from the +# recfiltcommon file + +# Utility code common to all shell filters. This could be sourced at run +# time, but it's slightly more efficient to include the code in the +# filters at build time (with a sed script). + +# Describe error in a way that can be interpreted by our caller +senderror() +{ + echo RECFILTERROR $* + # Also alert on stderr just in case + echo ":2:$progname::: $*" 1>&2 + exit 1 +} iscmd() { @@ -50,24 +62,51 @@ iscmd() esac } +checkcmds() +{ + for cmd in $*;do + if iscmd $cmd + then + a=1 + else + senderror HELPERNOTFOUND $cmd + fi + done +} + +# show help message +if test $# -ne 1 -o "$1" = "--help" +then + echo "Convert a $filetype file to HTML text for Recoll indexing." + echo "Usage: $progname [infile]" + exit 1 +fi + +infile="$1" + +# check the input file existence (may be '-' for stdin) +if test "X$infile" != X- -a ! -f "$infile" +then + senderror INPUTNOSUCHFILE "$infile" +fi + +############################################################################## +# !! Leave the following line unmodified ! +#ENDRECFILTCOMMONCODE + +# Find rclps. Note: this only works because we are always executed with a +# full path +rclps=`dirname $0`/rclps + decoder="" if iscmd dvips -a iscmd pstotext ; then decoder=dvips -else +elsif iscmd catdvi decoder=catdvi fi if test X$decoder = X ; then - echo "$progname: did not find either catdvi or dvips." 1>&2 - exit 1 -fi - - -# check the input file existence -if test ! -f "$infile" -then - printf '%s: %s: no such file\n' "$progname" "$infile" - exit 1 + senderror NOTFOUND dvips catdvi fi if test X$decoder = Xdvips ; then diff --git a/src/filters/rclgaim b/src/filters/rclgaim index 1ab88f29..d122deaf 100755 --- a/src/filters/rclgaim +++ b/src/filters/rclgaim @@ -1,5 +1,5 @@ #!/bin/sh -# @(#$Id: rclgaim,v 1.2 2005-11-21 14:32:53 dockes Exp $ (C) 2004 J.F.Dockes +# @(#$Id: rclgaim,v 1.3 2007-02-06 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes # Parts taken from Estraier: #================================================================ # Estraier: a personal full-text search system @@ -15,18 +15,28 @@ # set variables LANG=C ; export LANG LC_ALL=C ; export LC_ALL -progname="rclsoff" +progname="rclgaim" +filetype="gaim log" -# show help message -if test $# -ne 1 -o "$1" = "--help" -then - printf 'Convert a gaim log to unformatted HTML text for Recoll.\n' - printf 'Usage: %s [infile]\n' "$progname" - exit 1 -fi -infile="$1" +#RECFILTCOMMONCODE +############################################################################## +# !! Leave the previous line unmodified!! Code imported from the +# recfiltcommon file + +# Utility code common to all shell filters. This could be sourced at run +# time, but it's slightly more efficient to include the code in the +# filters at build time (with a sed script). + +# Describe error in a way that can be interpreted by our caller +senderror() +{ + echo RECFILTERROR $* + # Also alert on stderr just in case + echo ":2:$progname::: $*" 1>&2 + exit 1 +} iscmd() { @@ -48,21 +58,33 @@ checkcmds() then a=1 else - echo $cmd not found 1>&2 - exit 1 + senderror HELPERNOTFOUND $cmd fi done } -checkcmds awk iconv - -# check the input file existence -if test ! -f "$infile" +# show help message +if test $# -ne 1 -o "$1" = "--help" then - printf '%s: %s: no such file\n' "$progname" "$infile" + echo "Convert a $filetype file to HTML text for Recoll indexing." + echo "Usage: $progname [infile]" exit 1 fi +infile="$1" + +# check the input file existence (may be '-' for stdin) +if test "X$infile" != X- -a ! -f "$infile" +then + senderror INPUTNOSUCHFILE "$infile" +fi + +############################################################################## +# !! Leave the following line unmodified ! +#ENDRECFILTCOMMONCODE + +checkcmds awk iconv + awk ' # First line: parse from, to , output html header NR == 1 { diff --git a/src/filters/rcllyx b/src/filters/rcllyx index dff63eb1..b8f38cd4 100755 --- a/src/filters/rcllyx +++ b/src/filters/rcllyx @@ -1,5 +1,5 @@ #!/bin/sh -# @(#$Id: rcllyx,v 1.4 2007-01-23 07:23:12 dockes Exp $ (C) 2004 J.F.Dockes +# @(#$Id: rcllyx,v 1.5 2007-02-06 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes # There may still be code from Estraier in here: #================================================================ # Estraier: a personal full-text search system @@ -29,23 +29,27 @@ LANG=C ; export LANG LC_ALL=C ; export LC_ALL progname="rcllyx" +filetype=lyx -# show help message -if test $# -ne 1 -o "$1" = "--help" -then - printf 'Extract lyx text as basic HTML.\n' - printf 'Usage: %s [infile]\n' "$progname" - exit 1 -fi -infile="$1" -# check the input file existence -if test ! -f "$infile" -then - printf '%s: %s: no such file\n' "$progname" "$infile" - exit 1 -fi +#RECFILTCOMMONCODE +############################################################################## +# !! Leave the previous line unmodified!! Code imported from the +# recfiltcommon file + +# Utility code common to all shell filters. This could be sourced at run +# time, but it's slightly more efficient to include the code in the +# filters at build time (with a sed script). + +# Describe error in a way that can be interpreted by our caller +senderror() +{ + echo RECFILTERROR $* + # Also alert on stderr just in case + echo ":2:$progname::: $*" 1>&2 + exit 1 +} iscmd() { @@ -59,6 +63,7 @@ iscmd() return 1 ;; esac } + checkcmds() { for cmd in $*;do @@ -66,12 +71,31 @@ checkcmds() then a=1 else - echo $cmd not found 1>&2 - exit 1 + senderror HELPERNOTFOUND $cmd fi done } +# show help message +if test $# -ne 1 -o "$1" = "--help" +then + echo "Convert a $filetype file to HTML text for Recoll indexing." + echo "Usage: $progname [infile]" + exit 1 +fi + +infile="$1" + +# check the input file existence (may be '-' for stdin) +if test "X$infile" != X- -a ! -f "$infile" +then + senderror INPUTNOSUCHFILE "$infile" +fi + +############################################################################## +# !! Leave the following line unmodified ! +#ENDRECFILTCOMMONCODE + checkcmds lyx iconv # We need a temporary directory diff --git a/src/filters/rclman b/src/filters/rclman new file mode 100755 index 00000000..a7632c85 --- /dev/null +++ b/src/filters/rclman @@ -0,0 +1,111 @@ +#!/bin/sh +# @(#$Id: rclman,v 1.1 2007-02-06 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes +# Parts taken from Estraier: +#================================================================ +# Estraier: a personal full-text search system +# Copyright (C) 2003-2004 Mikio Hirabayashi +#================================================================ +#================================================================ +# rclman +# Process a manual page with groff and output html +# We'd like to use -Thtml, but this doesn't seem to be always available. +# So we use -Tutf8 and postprocess this to remove the ^H overstriking +# +#================================================================ + + +# set variables +LANG=C ; export LANG +LC_ALL=C ; export LC_ALL +progname="rclman" +filetype=man + + + +#RECFILTCOMMONCODE +############################################################################## +# !! Leave the previous line unmodified!! Code imported from the +# recfiltcommon file + +# Utility code common to all shell filters. This could be sourced at run +# time, but it's slightly more efficient to include the code in the +# filters at build time (with a sed script). + +# Describe error in a way that can be interpreted by our caller +senderror() +{ + echo RECFILTERROR $* + # Also alert on stderr just in case + echo ":2:$progname::: $*" 1>&2 + exit 1 +} + +iscmd() +{ + cmd=$1 + case $cmd in + */*) + if test -x $cmd ; then return 0; else return 1; fi ;; + *) + oldifs=$IFS; IFS=":"; set -- $PATH; IFS=$oldifs + for d in $*;do test -x $d/$cmd && return 0;done + return 1 ;; + esac +} + +checkcmds() +{ + for cmd in $*;do + if iscmd $cmd + then + a=1 + else + senderror HELPERNOTFOUND $cmd + fi + done +} + +# show help message +if test $# -ne 1 -o "$1" = "--help" +then + echo "Convert a $filetype file to HTML text for Recoll indexing." + echo "Usage: $progname [infile]" + exit 1 +fi + +infile="$1" + +# check the input file existence (may be '-' for stdin) +if test "X$infile" != X- -a ! -f "$infile" +then + senderror INPUTNOSUCHFILE "$infile" +fi + +############################################################################## +# !! Leave the following line unmodified ! +#ENDRECFILTCOMMONCODE + +checkcmds groff sed awk iconv + +# The strange 'BEGIN' setup is to prevent 'file' from thinking this file +# is an awk program +groff -man -Tutf8 < "$infile" | sed -e 's/.//g' -e 's/.//g' |\ +awk 'BEGIN'\ +' { + print "" + print "" + print "\n\n

" +} +{ + gsub(/&/, "\\&", $0) + gsub(//, "\\>", $0) + + print $0 "
" +} +END { + print "

" +}' | iconv -f UTF-8 -t UTF-8 -c -s + +# exit normally +exit 0 diff --git a/src/filters/rclmedia b/src/filters/rclmedia index faa5c480..99c30600 100755 --- a/src/filters/rclmedia +++ b/src/filters/rclmedia @@ -1,5 +1,5 @@ #!/bin/sh -# @(#$Id: rclmedia,v 1.2 2006-04-04 16:03:28 dockes Exp $ (C) 2004 J.F.Dockes +# @(#$Id: rclmedia,v 1.3 2007-02-06 15:08:22 dockes Exp $ (C) 2004 J.F.Dockes #================================================================ # rclmedia # Handle media files for recoll. This currently returns an empty @@ -9,17 +9,27 @@ # set variables LANG=C ; export LANG LC_ALL=C ; export LC_ALL -progname="rclsoff" +progname="rclmedia" +filetype=media -# show help message -if test $# -ne 1 -o "$1" = "--help" -then - printf 'Process a media file for recoll indexation.\n' - printf 'Usage: %s [infile]\n' "$progname" - exit 1 -fi -infile="$1" +#RECFILTCOMMONCODE +############################################################################## +# !! Leave the previous line unmodified!! Code imported from the +# recfiltcommon file + +# Utility code common to all shell filters. This could be sourced at run +# time, but it's slightly more efficient to include the code in the +# filters at build time (with a sed script). + +# Describe error in a way that can be interpreted by our caller +senderror() +{ + echo RECFILTERROR $* + # Also alert on stderr just in case + echo ":2:$progname::: $*" 1>&2 + exit 1 +} iscmd() { @@ -33,25 +43,39 @@ iscmd() return 1 ;; esac } + checkcmds() { - cmdsok=0 for cmd in $*;do if iscmd $cmd then - cmdsok=1 + a=1 else - cmdsok=0 + senderror HELPERNOTFOUND $cmd fi done } -# check the input file existence -if test ! -f "$infile" +# show help message +if test $# -ne 1 -o "$1" = "--help" then - printf '%s: %s: no such file\n' "$progname" "$infile" + echo "Convert a $filetype file to HTML text for Recoll indexing." + echo "Usage: $progname [infile]" exit 1 fi + +infile="$1" + +# check the input file existence (may be '-' for stdin) +if test "X$infile" != X- -a ! -f "$infile" +then + senderror INPUTNOSUCHFILE "$infile" +fi + +############################################################################## +# !! Leave the following line unmodified ! +#ENDRECFILTCOMMONCODE + checkcmds id3info # output the result @@ -60,11 +84,11 @@ echo '' echo '' echo '' echo '
'
-if test X$cmdsok = X1 ; then
-   id3info "$infile" | \
+
+id3info "$infile" | \
    sed -e 's/'
 echo ''
 
diff --git a/src/filters/rclpdf b/src/filters/rclpdf
index d6a78cd5..e60bbac8 100755
--- a/src/filters/rclpdf
+++ b/src/filters/rclpdf
@@ -1,5 +1,5 @@
 #!/bin/sh
-# @(#$Id: rclpdf,v 1.7 2007-01-30 11:36:02 dockes Exp $  (C) 2004 J.F.Dockes
+# @(#$Id: rclpdf,v 1.8 2007-02-06 15:08:22 dockes Exp $  (C) 2004 J.F.Dockes
 # This is copied almost verbatim from Estraier:
 #================================================================
 # Estraier: a personal full-text search system
@@ -31,23 +31,27 @@ optionraw=-raw
 LANG=C ; export LANG
 LC_ALL=C ; export LC_ALL
 progname="rclpdf"
+filetype=pdf
 
-# show help message
-if test $# -ne 1 -o "$1" = "--help" 
-then
-  printf 'Strip a file of PDF and extract its text as HTML.\n'
-  printf 'Usage: %s [infile]\n' "$progname"
-  exit 1
-fi
 
-infile="$1"
 
-# check the input file existence
-if test ! -f "$infile"
-then
-  printf '%s: %s: no such file\n' "$progname" "$infile"
-  exit 1
-fi
+#RECFILTCOMMONCODE
+##############################################################################
+# !! Leave the previous line unmodified!! Code imported from the
+# recfiltcommon file
+
+# Utility code common to all shell filters. This could be sourced at run
+# time, but it's slightly more efficient to include the code in the
+# filters at build time (with a sed script).
+
+# Describe error in a way that can be interpreted by our caller
+senderror()
+{
+    echo RECFILTERROR $*
+    # Also alert on stderr just in case
+    echo ":2:$progname::: $*" 1>&2
+    exit 1
+}
 
 iscmd()
 {
@@ -61,6 +65,7 @@ iscmd()
       return 1 ;;
     esac
 }
+
 checkcmds()
 {
     for cmd in $*;do
@@ -68,11 +73,31 @@ checkcmds()
       then 
         a=1
       else 
-        echo $cmd not found 1>&2 
-	exit 1
+        senderror HELPERNOTFOUND $cmd
       fi
     done
 }
+
+# show help message
+if test $# -ne 1 -o "$1" = "--help" 
+then
+  echo "Convert a $filetype file to HTML text for Recoll indexing."
+  echo "Usage: $progname [infile]"
+  exit 1
+fi
+
+infile="$1"
+
+# check the input file existence (may be '-' for stdin)
+if test "X$infile" != X- -a ! -f "$infile"
+then
+  senderror INPUTNOSUCHFILE "$infile"
+fi
+
+##############################################################################
+# !! Leave the following line unmodified !
+#ENDRECFILTCOMMONCODE
+
 checkcmds pdftotext iconv awk
 
 # Run pdftotext and fix the result (add a charset tag and fix the html escaping
diff --git a/src/filters/rclppt b/src/filters/rclppt
index d9c5140e..538652b5 100755
--- a/src/filters/rclppt
+++ b/src/filters/rclppt
@@ -1,5 +1,5 @@
 #!/bin/sh
-# @(#$Id: rclppt,v 1.1 2006-09-05 09:52:23 dockes Exp $  (C) 2004 J.F.Dockes
+# @(#$Id: rclppt,v 1.2 2007-02-06 15:08:22 dockes Exp $  (C) 2004 J.F.Dockes
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
@@ -27,17 +27,28 @@
 # set variables
 LANG=C ; export LANG
 LC_ALL=C ; export LC_ALL
-progname="rclsoff"
+progname="rclppt"
+filetype=powerpoint
 
-# show help message
-if test $# -ne 1 -o "$1" = "--help" 
-then
-  printf 'Process a powerpoint file for recoll indexation.\n'
-  printf 'Usage: %s [infile]\n' "$progname"
-  exit 1
-fi
 
-infile="$1"
+
+#RECFILTCOMMONCODE
+##############################################################################
+# !! Leave the previous line unmodified!! Code imported from the
+# recfiltcommon file
+
+# Utility code common to all shell filters. This could be sourced at run
+# time, but it's slightly more efficient to include the code in the
+# filters at build time (with a sed script).
+
+# Describe error in a way that can be interpreted by our caller
+senderror()
+{
+    echo RECFILTERROR $*
+    # Also alert on stderr just in case
+    echo ":2:$progname::: $*" 1>&2
+    exit 1
+}
 
 iscmd()
 {
@@ -51,25 +62,39 @@ iscmd()
       return 1 ;;
     esac
 }
+
 checkcmds()
 {
-    cmdsok=0
     for cmd in $*;do
       if iscmd $cmd 
       then 
-        cmdsok=1
+        a=1
       else 
-        cmdsok=0
+        senderror HELPERNOTFOUND $cmd
       fi
     done
 }
 
-# check the input file existence
-if test ! -f "$infile"
+# show help message
+if test $# -ne 1 -o "$1" = "--help" 
 then
-  printf '%s: %s: no such file\n' "$progname" "$infile"
+  echo "Convert a $filetype file to HTML text for Recoll indexing."
+  echo "Usage: $progname [infile]"
   exit 1
 fi
+
+infile="$1"
+
+# check the input file existence (may be '-' for stdin)
+if test "X$infile" != X- -a ! -f "$infile"
+then
+  senderror INPUTNOSUCHFILE "$infile"
+fi
+
+##############################################################################
+# !! Leave the following line unmodified !
+#ENDRECFILTCOMMONCODE
+
 checkcmds catppt
 if test X$cmdsok = X0 ; then
    printf "Catppt not found"
diff --git a/src/filters/rclps b/src/filters/rclps
index 875f91e9..36043996 100755
--- a/src/filters/rclps
+++ b/src/filters/rclps
@@ -1,5 +1,5 @@
 #!/bin/sh
-# @(#$Id: rclps,v 1.8 2007-01-30 11:36:02 dockes Exp $  (C) 2004 J.F.Dockes
+# @(#$Id: rclps,v 1.9 2007-02-06 15:08:23 dockes Exp $  (C) 2004 J.F.Dockes
 # Parts taken from Estraier:
 #================================================================
 # Estraier: a personal full-text search system
@@ -24,21 +24,28 @@ LC_ALL=C ; export LC_ALL
 progname="rclps"
 decoder=pstotext
 #decoder=ps2ascii
+filetype=postscript
 
-# show help message
-if test $# -ne 1 -o "$1" = "--help" 
-then
-  printf 'Convert a postscript file to unformatted HTML text.\n'
-  printf 'Usage: %s [infile]\n' "$progname"
-  exit 1
-fi
 
-infile="$1"
-if test "X$infile" = X- ; then
-  cmd=$decoder
-else
-  cmd="$decoder $1"
-fi
+
+
+#RECFILTCOMMONCODE
+##############################################################################
+# !! Leave the previous line unmodified!! Code imported from the
+# recfiltcommon file
+
+# Utility code common to all shell filters. This could be sourced at run
+# time, but it's slightly more efficient to include the code in the
+# filters at build time (with a sed script).
+
+# Describe error in a way that can be interpreted by our caller
+senderror()
+{
+    echo RECFILTERROR $*
+    # Also alert on stderr just in case
+    echo ":2:$progname::: $*" 1>&2
+    exit 1
+}
 
 iscmd()
 {
@@ -52,6 +59,7 @@ iscmd()
       return 1 ;;
     esac
 }
+
 checkcmds()
 {
     for cmd in $*;do
@@ -59,20 +67,33 @@ checkcmds()
       then 
         a=1
       else 
-        echo $cmd not found 1>&2 
-	exit 1
+        senderror HELPERNOTFOUND $cmd
       fi
     done
 }
-checkcmds $decoder iconv awk
 
-# check the input file existence
-if test "X$infile" != X- -a ! -f "$infile"
+# show help message
+if test $# -ne 1 -o "$1" = "--help" 
 then
-  printf '%s: %s: no such file\n' "$progname" "$infile"
+  echo "Convert a $filetype file to HTML text for Recoll indexing."
+  echo "Usage: $progname [infile]"
   exit 1
 fi
 
+infile="$1"
+
+# check the input file existence (may be '-' for stdin)
+if test "X$infile" != X- -a ! -f "$infile"
+then
+  senderror INPUTNOSUCHFILE "$infile"
+fi
+
+##############################################################################
+# !! Leave the following line unmodified !
+#ENDRECFILTCOMMONCODE
+
+checkcmds $decoder iconv awk
+
 # output the result
 # The strange 'BEGIN' setup is to prevent 'file' from thinking this file
 # is an awk program
diff --git a/src/filters/rclrtf b/src/filters/rclrtf
index 19776d93..c7ca7fb2 100755
--- a/src/filters/rclrtf
+++ b/src/filters/rclrtf
@@ -1,5 +1,5 @@
 #!/bin/sh
-# @(#$Id: rclrtf,v 1.3 2007-01-30 11:36:02 dockes Exp $  (C) 2004 J.F.Dockes
+# @(#$Id: rclrtf,v 1.4 2007-02-06 15:08:23 dockes Exp $  (C) 2004 J.F.Dockes
 # Some inspiration from estraier
 #================================================================
 # rclrtf
@@ -7,28 +7,31 @@
 #    http://www.gnu.org/software/unrtf/unrtf.html
 #================================================================
 
-
 # set variables
 LANG=C ; export LANG
 LC_ALL=C ; export LC_ALL
 progname="rclrtl"
+filetype=rtf
 
-# show help message
-if test $# -ne 1 -o "$1" = "--help" 
-then
-  printf 'Convert RTF to HTML for Recoll input.\n'
-  printf 'Usage: %s [infile]\n' "$progname"
-  exit 1
-fi
 
-infile="$1"
 
-# check the input file existence
-if test ! -f "$infile"
-then
-  printf '%s: %s: no such file\n' "$progname" "$infile"
-  exit 1
-fi
+#RECFILTCOMMONCODE
+##############################################################################
+# !! Leave the previous line unmodified!! Code imported from the
+# recfiltcommon file
+
+# Utility code common to all shell filters. This could be sourced at run
+# time, but it's slightly more efficient to include the code in the
+# filters at build time (with a sed script).
+
+# Describe error in a way that can be interpreted by our caller
+senderror()
+{
+    echo RECFILTERROR $*
+    # Also alert on stderr just in case
+    echo ":2:$progname::: $*" 1>&2
+    exit 1
+}
 
 iscmd()
 {
@@ -42,6 +45,7 @@ iscmd()
       return 1 ;;
     esac
 }
+
 checkcmds()
 {
     for cmd in $*;do
@@ -49,11 +53,31 @@ checkcmds()
       then 
         a=1
       else 
-        echo $cmd not found 1>&2 
-	exit 1
+        senderror HELPERNOTFOUND $cmd
       fi
     done
 }
+
+# show help message
+if test $# -ne 1 -o "$1" = "--help" 
+then
+  echo "Convert a $filetype file to HTML text for Recoll indexing."
+  echo "Usage: $progname [infile]"
+  exit 1
+fi
+
+infile="$1"
+
+# check the input file existence (may be '-' for stdin)
+if test "X$infile" != X- -a ! -f "$infile"
+then
+  senderror INPUTNOSUCHFILE "$infile"
+fi
+
+##############################################################################
+# !! Leave the following line unmodified !
+#ENDRECFILTCOMMONCODE
+
 checkcmds awk unrtf
 
 # output the result
diff --git a/src/filters/rclscribus b/src/filters/rclscribus
index bbeb4fdd..46aa4056 100755
--- a/src/filters/rclscribus
+++ b/src/filters/rclscribus
@@ -1,5 +1,5 @@
 #!/bin/sh
-# @(#$Id: rclscribus,v 1.2 2007-01-24 11:15:56 dockes Exp $  (C) 2004 J.F.Dockes
+# @(#$Id: rclscribus,v 1.3 2007-02-06 15:08:23 dockes Exp $  (C) 2004 J.F.Dockes
 # There may still be code from Estraier in here:
 #================================================================
 # Estraier: a personal full-text search system
@@ -18,23 +18,27 @@
 LANG=C ; export LANG
 LC_ALL=C ; export LC_ALL
 progname="rclscribus"
+filetype=Scribus
 
-# show help message
-if test $# -ne 1 -o "$1" = "--help" 
-then
-  printf 'Extract scribus text as basic HTML.\n'
-  printf 'Usage: %s [infile]\n' "$progname"
-  exit 1
-fi
 
-infile="$1"
 
-# check the input file existence
-if test ! -f "$infile"
-then
-  printf '%s: %s: no such file\n' "$progname" "$infile"
-  exit 1
-fi
+#RECFILTCOMMONCODE
+##############################################################################
+# !! Leave the previous line unmodified!! Code imported from the
+# recfiltcommon file
+
+# Utility code common to all shell filters. This could be sourced at run
+# time, but it's slightly more efficient to include the code in the
+# filters at build time (with a sed script).
+
+# Describe error in a way that can be interpreted by our caller
+senderror()
+{
+    echo RECFILTERROR $*
+    # Also alert on stderr just in case
+    echo ":2:$progname::: $*" 1>&2
+    exit 1
+}
 
 iscmd()
 {
@@ -48,6 +52,7 @@ iscmd()
       return 1 ;;
     esac
 }
+
 checkcmds()
 {
     for cmd in $*;do
@@ -55,11 +60,31 @@ checkcmds()
       then 
         a=1
       else 
-        echo $cmd not found 1>&2 
-	exit 1
+        senderror HELPERNOTFOUND $cmd
       fi
     done
 }
+
+# show help message
+if test $# -ne 1 -o "$1" = "--help" 
+then
+  echo "Convert a $filetype file to HTML text for Recoll indexing."
+  echo "Usage: $progname [infile]"
+  exit 1
+fi
+
+infile="$1"
+
+# check the input file existence (may be '-' for stdin)
+if test "X$infile" != X- -a ! -f "$infile"
+then
+  senderror INPUTNOSUCHFILE "$infile"
+fi
+
+##############################################################################
+# !! Leave the following line unmodified !
+#ENDRECFILTCOMMONCODE
+
 checkcmds grep awk sed
 
 # A small sed program to join lines where they are broken inside an
diff --git a/src/filters/rclsoff b/src/filters/rclsoff
index fac69cf8..56cdd0b4 100755
--- a/src/filters/rclsoff
+++ b/src/filters/rclsoff
@@ -1,5 +1,5 @@
 #!/bin/sh
-# @(#$Id: rclsoff,v 1.8 2007-01-30 11:36:02 dockes Exp $  (C) 2004 J.F.Dockes
+# @(#$Id: rclsoff,v 1.9 2007-02-06 15:08:23 dockes Exp $  (C) 2004 J.F.Dockes
 # Parts taken from Estraier:
 #================================================================
 # Estraier: a personal full-text search system
@@ -11,22 +11,32 @@
 #
 #================================================================
 
-
 # set variables
 LANG=C ; export LANG
 LC_ALL=C ; export LC_ALL
 progname="rclsoff"
+filetype=openoffice
 
 
-# show help message
-if test $# -ne 1 -o "$1" = "--help" 
-then
-  printf 'Convert an openoffice file to unformatted HTML text.\n'
-  printf 'Usage: %s [infile]\n' "$progname"
-  exit 1
-fi
 
-infile="$1"
+
+#RECFILTCOMMONCODE
+##############################################################################
+# !! Leave the previous line unmodified!! Code imported from the
+# recfiltcommon file
+
+# Utility code common to all shell filters. This could be sourced at run
+# time, but it's slightly more efficient to include the code in the
+# filters at build time (with a sed script).
+
+# Describe error in a way that can be interpreted by our caller
+senderror()
+{
+    echo RECFILTERROR $*
+    # Also alert on stderr just in case
+    echo ":2:$progname::: $*" 1>&2
+    exit 1
+}
 
 iscmd()
 {
@@ -40,6 +50,7 @@ iscmd()
       return 1 ;;
     esac
 }
+
 checkcmds()
 {
     for cmd in $*;do
@@ -47,11 +58,31 @@ checkcmds()
       then 
         a=1
       else 
-        echo $cmd not found 1>&2 
-	exit 1
+        senderror HELPERNOTFOUND $cmd
       fi
     done
 }
+
+# show help message
+if test $# -ne 1 -o "$1" = "--help" 
+then
+  echo "Convert a $filetype file to HTML text for Recoll indexing."
+  echo "Usage: $progname [infile]"
+  exit 1
+fi
+
+infile="$1"
+
+# check the input file existence (may be '-' for stdin)
+if test "X$infile" != X- -a ! -f "$infile"
+then
+  senderror INPUTNOSUCHFILE "$infile"
+fi
+
+##############################################################################
+# !! Leave the following line unmodified !
+#ENDRECFILTCOMMONCODE
+
 checkcmds awk iconv unzip
 
 # check the input file existence
diff --git a/src/filters/rclxls b/src/filters/rclxls
index 284f84d1..3fc0ad4a 100755
--- a/src/filters/rclxls
+++ b/src/filters/rclxls
@@ -1,5 +1,5 @@
 #!/bin/sh
-# @(#$Id: rclxls,v 1.2 2006-11-20 15:28:30 dockes Exp $  (C) 2004 J.F.Dockes
+# @(#$Id: rclxls,v 1.3 2007-02-06 15:08:23 dockes Exp $  (C) 2004 J.F.Dockes
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 2 of the License, or
@@ -29,16 +29,27 @@
 LANG=C ; export LANG
 LC_ALL=C ; export LC_ALL
 progname="rclxls"
+filetype=excel
 
-# show help message
-if test $# -ne 1 -o "$1" = "--help" 
-then
-  printf 'Process an excel file for recoll indexation.\n'
-  printf 'Usage: %s [infile]\n' "$progname"
-  exit 1
-fi
 
-infile="$1"
+
+#RECFILTCOMMONCODE
+##############################################################################
+# !! Leave the previous line unmodified!! Code imported from the
+# recfiltcommon file
+
+# Utility code common to all shell filters. This could be sourced at run
+# time, but it's slightly more efficient to include the code in the
+# filters at build time (with a sed script).
+
+# Describe error in a way that can be interpreted by our caller
+senderror()
+{
+    echo RECFILTERROR $*
+    # Also alert on stderr just in case
+    echo ":2:$progname::: $*" 1>&2
+    exit 1
+}
 
 iscmd()
 {
@@ -52,19 +63,39 @@ iscmd()
       return 1 ;;
     esac
 }
+
 checkcmds()
 {
-    cmdsok=0
     for cmd in $*;do
       if iscmd $cmd 
       then 
-        cmdsok=1
+        a=1
       else 
-        cmdsok=0
+        senderror HELPERNOTFOUND $cmd
       fi
     done
 }
 
+# show help message
+if test $# -ne 1 -o "$1" = "--help" 
+then
+  echo "Convert a $filetype file to HTML text for Recoll indexing."
+  echo "Usage: $progname [infile]"
+  exit 1
+fi
+
+infile="$1"
+
+# check the input file existence (may be '-' for stdin)
+if test "X$infile" != X- -a ! -f "$infile"
+then
+  senderror INPUTNOSUCHFILE "$infile"
+fi
+
+##############################################################################
+# !! Leave the following line unmodified !
+#ENDRECFILTCOMMONCODE
+
 # check the input file existence
 if test ! -f "$infile"
 then