#! /bin/sh
#
# Convert coff libc to a coff-encapsulated libc
# suitable for linking with the GNU linker.
#
# Extract all members of /lib/libc.a (using coff ar).
# Convert each using robotussin.
# Create new libc (using gnu ar) with members in the same order as coff libc.

# set -e makes this script exit if any command gets an error

set -e
mkdir tmp
cd tmp
/bin/ar x /lib/libc.a
for i in *.o
do
	../robotussin $i x
	mv x $i
done
rm -f ../libc.a
../ar rs ../libc.a `/bin/ar t /lib/libc.a`
cd ..
