connectionless cancel PDU's don't have a dg_server_accepting_cancels field
[obnox/wireshark/wip.git] / make-reg-dotc
1 #! /bin/sh
2
3 #
4 # $Id: make-reg-dotc,v 1.8 2004/05/03 18:53:16 guy Exp $
5 #
6
7 #
8 # The first argument is the output filename.
9 #
10
11 outfile="$1"
12 shift
13
14 #
15 # The second argument is the directory in which the source files live.
16 #
17 srcdir="$1"
18 shift
19
20 #
21 # All subsequent arguments are the files to scan.
22 #
23 rm -f ${outfile}-tmp
24 echo '/* Do not modify this file.  */' >${outfile}-tmp
25 echo '/* It is created automatically by the Makefile.  */'>>${outfile}-tmp
26 echo '#include "register.h"' >>${outfile}-tmp
27
28 #
29 # Build code to call all the protocol registration routines.
30 #
31 echo 'void register_all_protocols(void) {' >>${outfile}-tmp
32 for f in "$@"
33 do
34         if [ -f $f ]
35         then
36                 srcfile=$f
37         else
38                 srcfile=$srcdir/$f
39         fi
40         grep '^proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
41 done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/  {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
42 for f in "$@"
43 do
44         if [ -f $f ]
45         then
46                 srcfile=$f
47         else
48                 srcfile=$srcdir/$f
49         fi
50         grep '^void proto_register_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
51 done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/  {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
52 echo '}' >>${outfile}-tmp
53
54 #
55 # Build code to call all the protocol handoff registration routines.
56 #
57 echo 'void register_all_protocol_handoffs(void) {' >>${outfile}-tmp
58 for f in "$@"
59 do
60         if [ -f $f ]
61         then
62                 srcfile=$f
63         else
64                 srcfile=$srcdir/$f
65         fi
66         grep '^proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
67 done | sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/  {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
68 for f in "$@"
69 do
70         if [ -f $f ]
71         then
72                 srcfile=$f
73         else
74                 srcfile=$srcdir/$f
75         fi
76         grep '^void proto_reg_handoff_[a-z_0-9A-Z]* *(' $srcfile 2>/dev/null | grep -v ';'
77 done | sed -e 's/^.*://' -e 's/^void \([a-z_0-9A-Z]*\).*/  {extern void \1 (void); \1 ();}/' >>${outfile}-tmp
78 echo '}' >>${outfile}-tmp
79 mv ${outfile}-tmp ${outfile}