#!/usr/bin/perl -s

# this perl script makes an include file for Forth

# usage:
#	np /usr/lib/libc.sa >libc.4

print "BASE @ HEX\n";

for ($i = 0; $i <= $#ARGV; $i++)	{
	open(symbols, "nm $ARGV[$i] |");

	while(<symbols>)	{
		if (/^([0-9a-f]+) A __((GOT)|(PLT))__*(.{1,31})$/o)	{
			($value, $keyword, $_) = ($1,$2,$5);
			if (!(/\$/o || /^[0-9]/o || /__/o))			{
				print "$value $keyword $_\n";
			}
		}
	}

}
print "BASE !\n";