#!/bin/sh -v

# export contents of repository into an archive

pn=`basename $0`

t=/tmp/$pn.$$
trap "rm -rf $t; exit 2" 1 2 3 15
rm -rf $t
mkdir $t

if [ $# -ne 2 -o ! -d "$1" ]
then
	echo "usage: $pn repositorydir archivename"
	exit 1
fi

n=1
for i in $1/*.o
do
	cp $i $t/${n}.o
	n=`expr $n + 1`
done

rm -f $2
ar cr $2 *.o $t/*.o

rm -rf $t

exit 0
