ching@amd.AMD.COM (Mike Ching) (11/07/87)
I'm posting a script that came across the net a year ago for the
benefit of new readers. It converts a BinHex file (may be multiple
parts) to a macbinary file. I chose to use a different source
directory than comp.sources.mac so that I could be selective about
the files I wanted and cat the multiple part programs.
mike ching
--- cut here ---
#! /bin/sh
# Shellscript for xbin'ing and macbin'ing new net.sources.mac
# posts to one directory for macbinary xmodem
# Gets files to xbin from comm'ing the file '.lastls' in the download
# directory and the new net.sources.mac directory.
#
# This shellscript will ignore directories and files that are unreadable,
# as well as any files without the line "(This file must be converted...)"
#
# The header and trailer of multiple part files will be filtered by bhcomb.
# After xbin'ing the script will macbin the .info, .data, and .rsrc
# files into one .bin file and remove the .info, .data, and .rsrc files
#
# Upon termination of the operation, the Macintosh bell will ring
# two times. This is your clue to wake up and see what is waiting.
# This requires you add the ^G's to the "echo -n"'s at the end of the
# script if you wish the bells to ring.
#
# Done on 1 June 1985 by
# Chris Borton, UC San Diego Undergraduate CS
#{ucbvax,decvax,akgua,dcdwest}!sdcsvax!sdcc6!ix924
#
# Modified March 6, 1986 by
# Jim Budler, Advanced Micro Devices, Inc.
# {ihnp4,decwrl}!amdcad!jimb
#
# Added bhcomb on July 3, 1986
# Mike Ching, AMD
#
# User modifications necessary:
#
# DLDIR: replace "Download directory" with the full path to the
# directory you wish to put the files to download.
# SOURCES: replace "/usr/spool/news/net/sources/mac" with the path to your
# net.sources.mac if it is different.
# Make sure bhcomb, xbin and macbin are in your PATH
#
DLDIR="/u/ching/download"
SOURCES="/u/ching/News/hqx"
ls $SOURCES > $DLDIR/.thisls
mesg n
for f in `comm -23 $DLDIR/.thisls $DLDIR/.lastls`
do
if [ -f $SOURCES/$f ] && [ -r $SOURCES/$f ]
then
fgrep "(This file must be " $SOURCES/$f > /tmp/BinHextest
if [ -s /tmp/BinHextest ]
then
rm /tmp/BinHextest
cp $SOURCES/$f $DLDIR
cd $DLDIR
bhcomb <$f >$f.bh
xbin $f.bh
rm $f $f.bh
cd $SOURCES
else
rm /tmp/BinHextest
fi
fi
done
mv $DLDIR/.thisls $DLDIR/.lastls
rm -f $DLDIR/.thisls
cd $DLDIR
set `echo *.info`
if [ s$1 != s*.info ]
then
while [ s$1 != s ]
do
tmp="`echo $1 |sed s/.info//`"
macbin $tmp
rm -f $tmp.info $tmp.data $tmp.rsrc
shift
done
fi
echo "Downloads ready!"
echo -n
echo -n
mesg y