[net.sources.mac] Automacbin script

jimb@amdcad.UUCP (Jim Budler) (03/07/86)

I recently posted macbin sources to net.sources.mac.  I have received a few
questions as to it's utility.  The simplest answer is to say that if you
use a MacBinary compatible terminal emulator on the mac you can use ANY
vanilla xmodem program to download Mac files to your mac. MacBinary mode
will translate, on the fly, into a dual fork application or document and
retain all the normal information ( name, type, creator, dates).

MacBinary compatible terminal emulators include: MacTerminal 2.0, the
commercially available Versaterm, Red Ryder and others.

Vanilla Unix xmodems include xmodem, umodem, uc and sb/rb.

I use sb/rb, recently distributed on Usenet, because it uses CRC16.

To enhance the use of it I have modified the autoxbin script written
by Chris Borton to also convert the .info, .data, and .rsrc files
into one .bin file and remove the .info, .data, and .bin files.

I then "sb -X *.bin" to my Macterminal 2.0. I get a dialog box on each file
which allows me to select the disk where I wish to place it the file.
I call it automacbin.
Here it is:

NOT a shar file, an actual shell script!
---------------------< 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...)"
#
# 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
#
# 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 xbin and macbin are in your PATH
#
DLDIR="Download directory"
SOURCES="/usr/spool/news/net/sources/mac"

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
			xbin $f
			rm $f
			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


-- 
 Jim Budler
 Advanced Micro Devices, Inc.
 (408) 749-5806
 Usenet: {ucbvax,decwrl,ihnp4,allegra,intelca}!amdcad!jimb
 Compuserve:	72415,1200