File: make-tapreg-dotc

package info (click to toggle)
wireshark 1.8.2-5wheezy18
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 196,124 kB
  • sloc: ansic: 2,186,574; xml: 55,064; python: 30,233; perl: 22,353; sh: 13,118; pascal: 5,964; lex: 4,963; cpp: 3,604; makefile: 3,471; yacc: 266; asm: 156; tcl: 35
file content (49 lines) | stat: -rwxr-xr-x 1,038 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#! /bin/sh

#
# $Id: make-tapreg-dotc 30297 2009-10-04 10:51:53Z krj $
#

#
# 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}