#! /bin/csh -f
#
# PLEASE READ: items you will have to change
# for *your* news group begin with (+++)
# File to store a digest entry
# P. Fishwick/ Univ. of Florida/1988
#
# (+++) Specify directory for news group
set digestdir=~/sim
# Files to use
set Issue=$digestdir/issue
set Topic=$digestdir/topic
set Contents=$digestdir/contents
set Temp=$digestdir/temp
set Temp2=$digestdir/temp2
set New_Entry=$digestdir/temp3
set Category=$digestdir/category
set SmallSeparator=$digestdir/separator2
#
# if first message, then use long separator at the beginning of the
# message and a small separator at the end. If other than the
# first message, just insert a small separator at the end of
# the message
#
#set TopicNum = `cat $Topic`
#
# Let's get rid of some of the crap from the typical mail
# header.
#
cat - | \
grep -v '^From ' | \
grep -v '^Received:' | \
grep -v '^Lines:' | \
grep -i -v '^Message-Id:' | \
grep -v '^	id ' | \
grep -v '^Status:' | sed -e s/^-/' -'/ | \
cat - $SmallSeparator > $Temp
#
# Obtain the category for this message
#
echo "Enter the Category (gen,re,q,rev,soft,tr,call,dept):"
cat /dev/tty > $Category
set Category_File = `cat $Category`
if ( -e $digestdir/$Category_File ) then
  cat $digestdir/$Category_File $Temp > $Temp2
  mv $Temp2 $digestdir/$Category_File
else
  cp $Temp $digestdir/$Category_File
endif
#
# Obtain the text for the table of contents
#
echo "Enter Table of Contents Entry:"
cat /dev/tty > $Temp
set IndentedLine = `cat $Temp`
echo '  '$IndentedLine > $Temp
set Category_File2 = $digestdir/$Category_File'.c'
if (-e $Category_File2) then
 cat $Category_File2 $Temp > $Temp2
 mv $Temp2 $Category_File2
else
 cp $Temp $Category_File2
endif
#
# Attach a number to the beginning of the message
#set TopicText = `cat $Temp`
#if (`grep '*' $Temp | wc -l` == 0) then
#  set TopicNum = `cat $Topic`
#  set TopicNum = `expr $TopicNum + 1`
#  echo $TopicNum > $Topic
#  echo "($TopicNum) $TopicText" > $Temp2
#  echo "TOPIC # " $TopicNum " FILED"
#  mv $Temp2 $Temp
#  if ( -e $Contents ) then
#    cat $Contents $Temp > $Temp2
#    mv $Temp2 $Contents
#  else
#    cp $Temp $Contents
#  endif
#else
#  echo "NO TOPIC FILED"
#endif
rm -f $Temp

