#!/bin/csh -f
# Grabber    (c)  1994 Brian Towles & QNSnet
#
#
# This is a Shell script to run UQWK in a variety of modes
# You need to have the UQWK, zip, and unzip programs in your path
# for this to work properly.
# What this program will do is create a zip file of the files output by
# UQWK.  It will also read in your replies.
#
#
# If you enable Debug mode (set it to 1) them it will not modify your
# mail or news and just make a copy of the mail/news leaving your
# newsrc and mail on the system and intact.
set DEBUG = 0
set filenum = 1
set SIZE = 0
set version = "1.2"
if  $#argv != 0 then
 echo -n " This is Version "$version" of Grabber by Brian Towles. "
 echo "(brian@marvin.qns.com)"
 echo Usage: `basename $0`
 echo " Grabber is an offline news packager that is used with uqwk"
 echo "   it supports qwk, soup, and zipnews."
 exit
endif
set filenum = 1
onintr main
main:
clear
echo ""
echo ""
echo ""
echo "                    Grabber News Packager"
echo "                        Brian Towles"
echo ""
echo ""
echo ""
echo "  WARNING:  Please Run Choose News from the util menu to"
echo "            limit the number of news groups that you"
echo "            subscribe to.  As well please dont try to use this"
echo "            with binary groups.  The files are too big and will"
echo "            cause an error"
echo ""
echo ""
echo " Please Choose the Type of Offline News reader you wish to use."
echo ""
echo "                       [Q] QWK (not recomended for internet use)"
echo "                       [S] Soup"
echo "                       [Z] Zipnews"
echo ""
echo ""
echo ""
echo -n " Please select one of the above (or return to quit): "
set ans = $<
switch ($ans)
	case [qQ]:
qwksection:
clear
echo ""
echo ""
echo ""
echo "               QWK News and Mail Packets"
echo ""
echo ""
echo ""
echo "                 [A] Package Mail only"
echo "                 [B] Package News only"
echo "                 [C] Package Mail & News"
echo "                 [R] Read in replies"
echo ""
echo ""
echo -n " Please select one of the above (or return to quit): "
set ans = $<
switch ($ans)
case [aA]:
clear
if $DEBUG != 1 then
uqwk +m -n -B$SIZE +h
else
uqwk +m -n -B$SIZE +h +r
endif
if $status != 0  then
echo " An Error Occured while Creating your Files for Offline reading"
else
echo "Please enter the name for the Zip file"
echo -n "Do NOT include the .zip extention    : "
set FILENAME = $<
zip -k -j $FILENAME *.ndx *.dat
if $status != 0 then
echo "An error Has Occured Ziping you Files"
else
if $DEBUG != 1 then
/bin/rm -f *.ndx *.dat
endif
endif
endif
breaksw
case [bB]:
clear
if $DEBUG != 1 then
uqwk -m +n -B$SIZE +h
else
uqwk -m +n -B$SIZE +h +r
endif
if $status != 0  then
echo " An Error Occured while Creating your Files for Offline reading"
else
echo "Please enter the name for the Zip file"
echo -n "Do NOT include the .zip extention    : "
set FILENAME = $<
zip -k -j $FILENAME *.ndx *.dat
if $status != 0 then
echo "An error Has Occured Ziping you Files"
else
if $DEBUG != 1 then
/bin/rm -f *.ndx *.dat
endif
endif
endif
breaksw
case [cC]:
clear
if $DEBUG != 1 then
uqwk +m +n -B$SIZE +h
else
uqwk +m +n -B$SIZE +h +r
endif
if $status != 0  then
echo " An Error Occured while Creating your Files for Offline reading"
else
echo "Please enter the name for the Zip file"
echo -n "Do NOT include the .zip extention    : "
set FILENAME = $<
zip -k -j $FILENAME *.ndx *.dat
if $status != 0 then
echo "An error Has Occured Ziping you Files"
else
if $DEBUG != 1 then
/bin/rm -f *.ndx *.dat
endif
endif
endif
breaksw
case [rR]:
clear
echo " Please enter the Name of your Reply File"
echo -n " Remember UNIX is Case sensitive         : "
set REPLY = $<
if $REPLY == "" then
goto qwksection
else
if $DEBUG != 1 then
uqwk -m -n -R$REPLY
else
uqwk -m -n -R$REPLY +r
endif
if $status != 0 then
echo "There was an error Reading in Reply file"
else
echo "Your Replies have been read in"
endif
endif
breaksw
default:
if $ans == "" then
goto main
endif
endsw
echo "         Press Enter to Continue"
echo ""
set KEY = $<
goto qwksection
breaksw
case [sS]:
soupsection:
clear
echo ""
echo ""
echo ""
echo "               SOUP News and Mail Packets"
echo ""
echo ""
echo ""
echo "                 [A] Package Mail only"
echo "                 [B] Package News only"
echo "                 [C] Package Mail & News"
echo "                 [R] Read in replies"
echo ""
echo ""
echo -n " Please select one of the above (or return to quit): "
set ans = $<
switch ($ans)
case [aA]:
clear
if $DEBUG != 1 then
uqwk +m -n -B$SIZE +h +L
else
uqwk +m -n -B$SIZE +h +r +L
endif
if $status != 0  then
echo " An Error Occured while Creating your Files for Offline reading"
else
echo "Please enter the name for the Zip file"
echo -n "Do NOT include the .zip extention    : "
set FILENAME = $<
zip -k -j $FILENAME *.MSG AREAS
if $status != 0 then
echo "An error Has Occured Ziping you Files"
else
if $DEBUG != 1 then
/bin/rm -f *.MSG AREAS
endif
endif
endif
breaksw
case [bB]:
clear
if $DEBUG != 1 then
uqwk -m +n -B$SIZE +h +L
else
uqwk -m +n -B$SIZE +h +r +L
endif
if $status != 0  then
echo " An Error Occured while Creating your Files for Offline reading"
else
echo "Please enter the name for the Zip file"
echo -n "Do NOT include the .zip extention    : "
set FILENAME = $<
zip -k -j $FILENAME *.MSG AREAS
if $status != 0 then
echo "An error Has Occured Ziping you Files"
else
if $DEBUG != 1 then
/bin/rm -f *.MSG AREAS
endif
endif
endif
breaksw
case [cC]:
clear
if $DEBUG != 1 then
uqwk +m +n -B$SIZE +h +L
else
uqwk +m +n -B$SIZE +h +r +L
endif
if $status != 0  then
echo " An Error Occured while Creating your Files for Offline reading"
else
echo "Please enter the name for the Zip file"
echo -n "Do NOT include the .zip extention    : "
set FILENAME = $<
zip -k -j $FILENAME *.MSG AREAS
if $status != 0 then
echo "An error Has Occured Ziping you Files"
else
if $DEBUG != 1 then
/bin/rm -f *.MSG AREAS
endif
endif
endif
breaksw
case [rR]:
clear
echo -n " Are your replies in a pkzip compatable file? (y/n): "
set YNREPLY = $<
switch ($YNREPLY)
case [nN]:
echo " Please enter the Name of your Reply File"
echo -n " Remember UNIX is Case sensitive         : "
set REPLY = $<
if $REPLY == "" then
goto soupsection
else
makeupper *.msg
if $DEBUG != 1 then
uqwk -m -n -R$REPLY +L
else
uqwk -m -n -R$REPLY +r +L
endif
if $status != 0 then
echo "There was an error Reading in Reply file"
else
echo "Your Replies have been read in"
endif
endif
breaksw
case [yY]:
echo "Please enter the FULL Name of the Zip file with your Replies"
echo -n "Remember Unix IS case sensitive                            : "
set ZIPEDREPLY = $<
if $ZIPEDREPLY == "" then
goto soupsection
else
unzip -U $ZIPEDREPLY
if $DEBUG != 1 then
uqwk -m -n -RREPLIES +L
else
uqwk -m -n -RREPLIES +r +L
endif
if $status != 0 then
echo "There was an error Reading in Reply file"
else
echo "Your Replies have been read in"
endif
endif
breaksw
default:
goto soupsection
endsw
breaksw
default:
if $ans == "" then
goto main
endif
endsw
echo "         Press Enter Key to Continue"
echo ""
set KEY = $<
goto soupsection
breaksw
case [zZ]:
zipsection:
clear
echo ""
echo ""
echo ""
echo "               ZIP News and Mail Packets"
echo ""
echo ""
echo ""
echo "                 [A] Package Mail only"
echo "                 [B] Package News only"
echo "                 [C] Package Mail & News"
echo "                 [R] Read in replies"
echo ""
echo ""
echo -n " Please select one of the above (or return to quit): "
set ans = $<
switch ($ans)
case [aA]:
clear
if $DEBUG != 1 then
uqwk +m -n -B$SIZE +h +z
else
uqwk +m -n -B$SIZE +h +r +z
endif
if $status != 0  then
echo " An Error Occured while Creating your Files for Offline reading"
else
echo "Please enter the name for the Zip file"
echo -n "Do NOT include the .zip extention    : "
set FILENAME = $<
zip -k -j $FILENAME *.idx *.jn *.mai *.nws
if $status != 0 then
echo "An error Has Occured Ziping you Files"
else
if $DEBUG != 1 then
/bin/rm -f *.idx *.jn *.mai *.nws
endif
endif
endif
breaksw
case [bB]:
clear
if $DEBUG != 1 then
uqwk -m +n -B$SIZE +h +z
else
uqwk -m +n -B$SIZE +h +r +z
endif
if $status != 0  then
echo " An Error Occured while Creating your Files for Offline reading"
else
echo "Please enter the name for the Zip file"
echo -n "Do NOT include the .zip extention    : "
set FILENAME = $<
zip -k -j $FILENAME *.idx *.jn *.mai *.nws
if $status != 0 then
echo "An error Has Occured Ziping you Files"
else
if $DEBUG != 1 then
/bin/rm -f *.idx *.jn *.mai *.nws
endif
endif
endif
breaksw
case [cC]:
clear
if $DEBUG != 1 then
uqwk +m +n -B$SIZE +h +z
else
uqwk +m +n -B$SIZE +h +r +z
endif
if $status != 0  then
echo " An Error Occured while Creating your Files for Offline reading"
else
echo "Please enter the name for the Zip file"
echo -n "Do NOT include the .zip extention    : "
set FILENAME = $<
zip -k -j $FILENAME *.idx *.jn *.mai *.nws
if $status != 0 then
echo "An error Has Occured Ziping you Files"
else
if $DEBUG != 1 then
/bin/rm -f *.MSG AREAS
endif
endif
endif
breaksw
case [rR]:
clear
echo " Please enter the Name of your Reply File"
echo -n " Remember UNIX is Case sensitive         : "
set REPLY = $<
if $REPLY == "" then
goto zipsection
else
if $DEBUG != 1 then
uqwk -m -n -R$REPLY +z
else
uqwk -m -n -R$REPLY +r +z
endif
if $status != 0 then
echo "There was an error Reading in Reply file"
else
echo "Your Replies have been read in"
endif
endif
breaksw
default:
if $ans == "" then
goto main
endif
endsw
echo "         Press Enter to Continue"
echo ""
set KEY = $<
goto zipsection
breaksw
default:
if $ans == "" then
clear
echo "Thank you for using Grabber"
echo "       And Now For Something Completely Different"
exit
endif
endsw
echo "         Press Enter to Continue"
echo ""
set KEY = $<
goto main
end
end

