wireshark/tools/make-tapreg-dotc
Jeff Morriss 82e2865739 Remove $Id$ and other Subversion leftovers from the tools.
There are a few things in here which could still use attention.

Don't regenerate anything now.

Change-Id: I283c224d3523212144707fca3d6265916cb11792
Reviewed-on: https://code.wireshark.org/review/205
Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com>
2014-02-14 01:35:57 +00:00

46 lines
976 B
Bash
Executable file

#! /bin/sh
#
# The first argument is the output filename.
#
outfile="$1"
shift
#
# The second argument is the directory in which the source files live.
#
srcdir="$1"
shift
#
# All subsequent arguments are the files to scan.
#
rm -f ${outfile}-tmp
echo '/* Do not modify this file. */' >${outfile}-tmp
echo '/* It is created automatically by the Makefile. */' >>${outfile}-tmp
echo '#include "register.h"' >>${outfile}-tmp
#
# Build code to call all the tap listener registration routines.
#
echo 'void register_all_tap_listeners(void){' >>${outfile}-tmp
echo '' >>${outfile}-tmp
for f in "$@"
do
if [ -f $f ]
then
srcfile=$f
else
srcfile=$srcdir/$f
fi
grep '^register_tap_listener_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';' | sed -e 's/(.*//'
done | while read func; do
echo " { extern void $func(void);" >>${outfile}-tmp
echo " $func();}" >>${outfile}-tmp
done
echo '}' >>${outfile}-tmp
echo '' >>${outfile}-tmp
mv ${outfile}-tmp ${outfile}