#sccs	"@(#)fndetc/convert:arconvert	1.3"

#
#	FILE:  arconvert
#
#	This program changes any system V.0 archive file in the directories
#	/usr/lib and /lib to system V.2 archives (flexname compatible).
#

TMPLIBDIR=/tmp/convlibs

if [ ! "$1" ] 
then
	find /lib /usr/lib -name "*.a" -print > /tmp/archives
else
	echo $1 > /tmp/archives
fi

file -f /tmp/archives | grep "5.0 archive" | cut -f1 -d':' > /tmp/oldlibs

if [ ! -d $TMPLIBDIR ]
then
	mkdir $TMPLIBDIR
fi

while read LIBRARY
do
	if convert $LIBRARY $TMPLIBDIR/newlib.a > /dev/null 2>&1
	then
		mv $LIBRARY $LIBRARY-old
		mv $TMPLIBDIR/newlib.a $LIBRARY
		echo "$LIBRARY updated to system V.2 compatiblity."
	fi
done < /tmp/oldlibs

rm -rf $TMPLIBDIR
rm -f /tmp/archives /tmp/oldlibs