[comp.sys.mac] Mac binary joiner

ring@cg-atla.UUCP (Steve Ring) (03/07/88)

A while ago some posted a csh script to join mac binaries. I turned this
into a bourne shell script and added some other features. Since we get
binaries in parts, I leave them in parts (z1, z2, z3, etc), save them
all in one directory, then run this script on each set.

--X---CUT HERE--X---CUT HERE--X---CUT HERE--X---CUT HERE--X---CUT HERE--X--
:
#
#	Mac binary joiner. Save Mac binary files from net in
#		files with names like t1, t2, t3...
#		or ww1, ww2, ww3, then
#		run this script as "macjoin t" or "macjoin ww"
#		Output file will be names "t.mac" or "ww.mac"
#		after which you can rename it to anything else.
#
#	Steve Ring
#	Compugraphic Corp.
#
#	

W=`basename $0`
echo "Usage:	$W file{1,2,3,...} > file.mac"

> $1.mac                                                        
echo -n "-- Mac Join: < "
for i in ${1}1 ${1}2 ${1}3 ${1}4 ${1}5 ${1}6 ${1}7 ${1}8 ${1}9 ; do
	[ -s $i ] && {
#
#	-- Note: some macbinaries may have spaces after "---"
#	-- If so, just swap the next 2 lines
#
# 	 sed -n -e '/^--- /,/^--- /  p' $i | sed -e '/^--- / d' >> $1.mac
#
	 sed -n -e '/^---/,/^---/  p' $i | sed -e '/^---/ d' >> $1.mac
 	 echo -n "$i, "
	}
done

echo ">"
echo -n "-- Re-name this $1(.mac) to ?=> "
read X

[ -s $X.mac ] && {
	echo -n "	?? \"$X.mac\" exists. Overwrite :y/n: ?=> "
	read XX
	[ "$XX" = 'n' ] && {
		echo "	..OK, $1.mac left alone"
		ls -sl $1.mac
		exit
	}
}
/bin/mv $1.mac $X.mac
echo "	..OK, moved, see $X.mac"
ls -sl $X.mac
###

-- 
...!{decvax,ima,ism780c,ulowell,laidbak,cgeuro,cg-f}!cg-atla!ring
Steve Ring 
CompuGraphic Corp. 
Wilmington, Mass., 01887, (617) 658-5600, x5092