#!/bin/csh
#
# Example shell script to retrieve your unread mail & news, package it
# into ZipNews format, and download it to your palmtop for use with the
# Palmtop News Reader.
#
# Before using this shell script do the following:
#
#   1. Modify this shell script by looking for lines with XXX and seeing
#      if it needs changing --- YOU DEFINETELY NEED TO CHANGE SOME OF THESE
#      LINES
#   2. Copy this shell script to your bin directory (or whatever directory
#      you store your UNIX programs in). Basically, it needs to be in a
#      directory specified in your path variable (echo $path)
#
# Follow these steps whenever you need to get your news & mail:
#
#   1. Type 'sendme' and tell your terminal program to download, thats it!
#

# Set username
# XXX What is your username?
set ZUNAME=mickyj

# Create temporary directory
set TMPDIR=$HOME/xtmpx
echo Creating temporary working directory $TMPDIR...
cd $HOME
/bin/rm -rf $TMPDIR
mkdir $TMPDIR
chmod 700 $TMPDIR

# Backup important files
echo Copying newsrc...
cp .newsrc .oldnewsrc
cp .newsrc $TMPDIR
# XXX Change this - it could be /usr/mail/[your username]
# XXX or /usr/spool/mail/[your username]
cp /usr/spool/mail/$ZUNAME .
# cp /usr/mail/$ZUNAME .

# Get the news in the format required
echo Getting news...
cd $TMPDIR

# -----ZipNews
# XXX -B3500 means get 3500 blocks maximum
uqwk +m +n +z -B3500 -H$TMPDIR

# Use PNRTI
# XXX If using PNRTI on your host system instead of your palmtop you need
# XXX to edit this section (upload your latest kill file to your home
# XXX directory)
#cp $HOME/$ZUNAME.kil .
#pnrti -c -u $ZUNAME
#/bin/rm -r $ZUNAME.kil

# Download file
cp .newsrc $HOME
# XXX Do you have zip on your host (UNIX) system?
zip $ZUNAME.zip $ZUNAME.*
# XXX Z-modem (sz) or X-modem (sx) ?
sz $ZUNAME.zip

# DONE
cd $HOME
echo Finished!
