#!/bin/sh
#
#  file: index-patent
#  auth: Brad Burdick
#  desc: Create a WAIS index of the Patent data files
#
##########################################################################
#  Copyright (c) 1994, 1995 Internet Multicasting Service
#
#  The Patent APS/Full-Text Dissemination processing software ("software")
#  was developed by the Internet Multicasting Service and may 
#  be used for academic, research, government, and internal business
#  purposes without charge.  You may not resell this code or include it
#  in a product that you are selling without prior permission of the
#  Internet Multicasting Service.
#
#  This software is provided ``as is'', without express or implied
#  warranty, and with no support nor obligation to assist in its
#  use, correction, modification or enhancement.  We assume no liability
#  with respect to the infringement of copyrights, trade secrets, or any
#  patents, and are not responsible for consequential damages.  Proper
#  use of the software is entirely the responsibility of the user.
##########################################################################

notify='bburdick'

# current day of year ... used to find patents for current year only
dofy=`/bin/date +"%j"`
# minus patents from the last week of December
dofy=`expr $dofy - 5`

index='/usr/local/wais/indexes/patent1'

waisindex='/usr/local/bin/waisindex'
indexflags="-d ${index} -nocat -nosrc -mem 192"

waisparse='/usr/local/bin/waisparse'
parseflags='-parse patent -'

# index the data
/bin/find /ftp/patent/data -type f -name '[0DHPR]*' -mtime -${dofy} -depth -print | \
${waisparse} ${parseflags} | \
${waisindex} ${indexflags}

# was WAIS index successful
if [ ! -f ${index}/index.inv0 ] ; then
	/usr/ucb/mail -s 'Patent index is finished' ${notify} < /dev/null
else
	/usr/ucb/mail -s 'Patent index error' ${notify} < /dev/null
fi

/bin/rm -f ${index}/patent1.src

exit 0

