]>
Commit | Line | Data |
---|---|---|
1c79356b A |
1 | #!/bin/sh |
2 | # | |
3 | # This used to be a shell script, but had to become more sophisticated | |
4 | # to allow for KNF function definitions. So rewrote in perl, but wrapped | |
5 | # as a shell script. | |
6 | # | |
7 | exec /usr/bin/perl << *EOF* | |
8 | open(PROTO, ">devfs_proto.h") || die "Cannot open devfs_proto.h\n"; | |
9 | ||
10 | print PROTO "/* THIS FILE HAS BEEN PRODUCED AUTOMATICALLY */\n"; | |
11 | ||
12 | while (\$file = <*.c>) { | |
13 | if(open(F, \$file) == 0) { | |
14 | warn "Cannot open \$file.\n"; | |
15 | next; | |
16 | } | |
17 | ||
18 | while(<F>) { | |
19 | chop; | |
20 | if (m|/\*proto\*/|) { | |
21 | \$collecting = 1; | |
22 | \$idx = 0; | |
23 | } elsif (\$collecting) { | |
24 | if (/^{/) { | |
25 | \$text[\$idx - 1] .= ';'; | |
26 | for (\$i = 0; \$i < \$idx; \$i++) { | |
27 | print PROTO "\$text[\$i]"; | |
28 | print PROTO \$i == 0? "\t": "\n"; | |
29 | } | |
30 | \$collecting = 0; | |
31 | next; | |
32 | } | |
33 | \$text[\$idx++] = \$_; | |
34 | } | |
35 | } | |
36 | close F; | |
37 | } | |
38 | ||
39 | print PROTO "/* THIS FILE PRODUCED AUTOMATICALLY */\n" . | |
40 | "/* DO NOT EDIT (see reproto.sh) */\n"; | |
41 | ||
42 | *EOF* |