#!/bin/sh

# create an initialization table from a list of .o files
# use for linux, SunOS and 68K/based HPUX machines; for other machines, 
# rename the appropriate munch.XXXX files to be munch

pattern=$1
shift

nm $* > munch.temp

echo '#include <p2c/p2c.h>'
echo '#include "logstuff.h"'
echo ''
echo '/* Do not modify this file.  It is created automatically by "munch". */'
echo ''
sed -n -e 's/^[^U]*[_ ]\('$pattern'\).*$/extern Void \1();/p' munch.temp | sort
echo ''
echo 'struct ext_proc ext_proc_table[] = {'
cat munch.temp | sed -n -e 's/^[^U]*[_ ]\('$pattern'\).*$/  "\1", \1,/p' | sort
echo '  NULL, NULL'
echo '};'
echo ''

