1999-10-27 01:46:14 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
2004-05-03 18:53:57 +00:00
|
|
|
#
|
2004-07-18 00:24:25 +00:00
|
|
|
# $Id$
|
2004-05-03 18:53:57 +00:00
|
|
|
#
|
|
|
|
|
1999-10-27 01:46:14 +00:00
|
|
|
#
|
2001-07-08 21:51:34 +00:00
|
|
|
# The first argument is the output filename.
|
|
|
|
#
|
|
|
|
|
|
|
|
outfile="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
#
|
|
|
|
# The second argument is the directory in which the source files live.
|
1999-10-27 01:46:14 +00:00
|
|
|
#
|
|
|
|
srcdir="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
#
|
|
|
|
# All subsequent arguments are the files to scan.
|
|
|
|
#
|
2001-07-08 21:51:34 +00:00
|
|
|
rm -f ${outfile}-tmp
|
|
|
|
echo '/* Do not modify this file. */' >${outfile}-tmp
|
|
|
|
echo '/* It is created automatically by the Makefile. */'>>${outfile}-tmp
|
2001-07-11 05:41:38 +00:00
|
|
|
echo '#include "register.h"' >>${outfile}-tmp
|
2000-04-04 06:17:30 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Build code to call all the protocol registration routines.
|
|
|
|
#
|
2001-07-08 21:51:34 +00:00
|
|
|
echo 'void register_all_protocols(void) {' >>${outfile}-tmp
|
1999-10-27 01:46:14 +00:00
|
|
|
for f in "$@"
|
|
|
|
do
|
2000-08-10 19:43:07 +00:00
|
|
|
if [ -f $f ]
|
2000-08-09 21:24:27 +00:00
|
|
|
then
|
|
|
|
srcfile=$f
|
|
|
|
else
|
|
|
|
srcfile=$srcdir/$f
|
|
|
|
fi
|
2000-10-22 20:01:14 +00:00
|
|
|
grep '^proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
|
2001-07-08 21:51:34 +00:00
|
|
|
done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
|
1999-10-27 01:46:14 +00:00
|
|
|
for f in "$@"
|
|
|
|
do
|
2000-08-10 19:43:07 +00:00
|
|
|
if [ -f $f ]
|
2000-08-09 21:24:27 +00:00
|
|
|
then
|
|
|
|
srcfile=$f
|
|
|
|
else
|
|
|
|
srcfile=$srcdir/$f
|
|
|
|
fi
|
2000-10-22 20:01:14 +00:00
|
|
|
grep '^void proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
|
2001-07-08 21:51:34 +00:00
|
|
|
done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
|
|
|
|
echo '}' >>${outfile}-tmp
|
2000-04-04 06:17:30 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Build code to call all the protocol handoff registration routines.
|
|
|
|
#
|
2001-07-08 21:51:34 +00:00
|
|
|
echo 'void register_all_protocol_handoffs(void) {' >>${outfile}-tmp
|
2000-04-04 06:17:30 +00:00
|
|
|
for f in "$@"
|
|
|
|
do
|
2000-08-10 19:43:07 +00:00
|
|
|
if [ -f $f ]
|
2000-08-09 21:24:27 +00:00
|
|
|
then
|
|
|
|
srcfile=$f
|
|
|
|
else
|
|
|
|
srcfile=$srcdir/$f
|
|
|
|
fi
|
2000-10-22 20:01:14 +00:00
|
|
|
grep '^proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
|
2001-07-08 21:51:34 +00:00
|
|
|
done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
|
2000-04-04 06:17:30 +00:00
|
|
|
for f in "$@"
|
|
|
|
do
|
2000-08-10 19:43:07 +00:00
|
|
|
if [ -f $f ]
|
2000-08-09 21:24:27 +00:00
|
|
|
then
|
|
|
|
srcfile=$f
|
|
|
|
else
|
|
|
|
srcfile=$srcdir/$f
|
|
|
|
fi
|
2000-10-22 20:01:14 +00:00
|
|
|
grep '^void proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
|
2001-07-08 21:51:34 +00:00
|
|
|
done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/ {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
|
|
|
|
echo '}' >>${outfile}-tmp
|
|
|
|
mv ${outfile}-tmp ${outfile}
|