1#!/bin/sh 2# @(#$Id: rclaptosidman,v 1.1 2010-12-11 12:40:05 dockes Exp $ (C) 2004 J.F.Dockes 3# Parts taken from Estraier: 4#================================================================ 5# Estraier: a personal full-text search system 6# Copyright (C) 2003-2004 Mikio Hirabayashi 7#================================================================ 8#================================================================ 9# rclaptosidman 10# Strip the menu part from aptosid manual pages to improve search precision 11#================================================================ 12 13# set variables 14LANG=C ; export LANG 15LC_ALL=C ; export LC_ALL 16progname="rclaptosidman" 17filetype="aptosid manual htm" 18 19 20#RECFILTCOMMONCODE 21############################################################################## 22# !! Leave the previous line unmodified!! Code imported from the 23# recfiltcommon file 24 25# Utility code common to all shell filters. This could be sourced at run 26# time, but it's slightly more efficient to include the code in the 27# filters at build time (with a sed script). 28 29# Describe error in a way that can be interpreted by our caller 30senderror() 31{ 32 echo RECFILTERROR $* 33 # Also alert on stderr just in case 34 echo ":2:$progname::: $*" 1>&2 35 exit 1 36} 37 38iscmd() 39{ 40 cmd=$1 41 case $cmd in 42 */*) 43 if test -x $cmd -a ! -d $cmd ; then return 0; else return 1; fi ;; 44 *) 45 oldifs=$IFS; IFS=":"; set -- $PATH; IFS=$oldifs 46 for d in $*;do test -x $d/$cmd -a ! -d $d/$cmd && return 0;done 47 return 1 ;; 48 esac 49} 50 51checkcmds() 52{ 53 for cmd in $*;do 54 if iscmd $cmd 55 then 56 a=1 57 else 58 senderror HELPERNOTFOUND $cmd 59 fi 60 done 61} 62 63# show help message 64if test $# -ne 1 -o "$1" = "--help" 65then 66 echo "Convert a $filetype file to HTML text for Recoll indexing." 67 echo "Usage: $progname [infile]" 68 exit 1 69fi 70 71infile="$1" 72 73# check the input file existence (may be '-' for stdin) 74if test "X$infile" != X- -a ! -f "$infile" 75then 76 senderror INPUTNOSUCHFILE "$infile" 77fi 78 79# protect access to our temp files and directories 80umask 77 81 82############################################################################## 83# !! Leave the following line unmodified ! 84#ENDRECFILTCOMMONCODE 85 86checkcmds sed 87# Delete everything from <div id="menu"> to <div id="main-page"> 88# This prints an additional blank line at top which does not matter 89sed -n -e '1,/<div id="menu">/{x;p' -e '}' \ 90 -e '/<div id="main-page">/,$p' < "$infile" 91 92# exit normally 93exit 0 94