#! /bin/sh
# $Id: munch,v 1.2 1990/10/30 13:28:45 jay Exp $
# create an initialization procedure from a list of .o files

echo '/* Do not modify this file.  It is created automatically by "munch". */'
echo 'void initialize_all_files () {'

if test "$1" = "-DSYSV" ; then
    shift;
    nm $* | egrep '^(.*[^a-zA-Z_]_|_)initialize_' | \
	sed -e 's/^.*\(_initialize_[a-zA-Z0-9_]*\)[^a-zA-Z0-9_].*$/   \1 ();/'
else
if test "$1" = "-DMIPS" ; then
    shift;
   nm -p $* | egrep 'T *_initialize_' | \
	sed -e 's/^.*T *_*\(.*\)/    _\1 ();/'
else
    nm -p $* | egrep 'T *__initialize_' | \
	sed -e 's/^.*T *_*\(.*\)/    _\1 ();/'
fi
fi

echo '}'
