aboutsummaryrefslogtreecommitdiffstats
path: root/make-tapreg-dotc
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2002-10-31 22:16:01 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2002-10-31 22:16:01 +0000
commit8613ba388b2799303cbc582b1b0c6677e09539a8 (patch)
treee75e61ee1cff0099bba850493b73b51b9a4f0e4f /make-tapreg-dotc
parent4288c4ebd9cdf9bc4b754241c990fc12b7fd04af (diff)
From Ronnie Sahlberg: have a registration interface for tap listeners,
and generate the table of stuff to register from tap source files, so Tethereal doesn't need to know what tap listeners exist. Get rid of "tap-xxx.h" files, as they're now empty. Add "tethereal-tap-register.c" to the .cvsignore file, as it's a new generated file. Update "Makefile.nmake" to generate "tethereal-tap-register.c". Clean up "Makefile.am" and "Makefile.nmake" a bit. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6525 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'make-tapreg-dotc')
-rwxr-xr-xmake-tapreg-dotc42
1 files changed, 42 insertions, 0 deletions
diff --git a/make-tapreg-dotc b/make-tapreg-dotc
new file mode 100755
index 0000000000..d3c470529c
--- /dev/null
+++ b/make-tapreg-dotc
@@ -0,0 +1,42 @@
+#! /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
+
+#
+# Build code to call all the tap listener registration routines.
+#
+echo 'void register_all_tap_listeners(void) {' >>${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
+
+mv ${outfile}-tmp ${outfile}