Last change
on this file since 2206 was
2206,
checked in by julian.reschke@…, 10 years ago
|
Collected ABNF section: explain ABNF list expansion (see #436)
|
-
Property svn:executable set to
*
|
File size:
718 bytes
|
Line | |
---|
1 | #!/bin/sh |
---|
2 | # refresh file inclusions |
---|
3 | |
---|
4 | expand() { |
---|
5 | |
---|
6 | cat $1 | awk ' |
---|
7 | BEGIN { |
---|
8 | includefile = ""; |
---|
9 | } |
---|
10 | |
---|
11 | # start include |
---|
12 | /^<\?BEGININC .* \?>$/ { |
---|
13 | print |
---|
14 | includefile = $2 |
---|
15 | while (getline <includefile > 0) { |
---|
16 | print |
---|
17 | } |
---|
18 | } |
---|
19 | |
---|
20 | # end include |
---|
21 | /^<\?ENDINC .* \?>$/ { |
---|
22 | if ($2 != includefile) { |
---|
23 | printf ("unexpected ENDINC, got %s but expected %s\n", $2, includefile) >> /dev/stderr |
---|
24 | } |
---|
25 | includefile = ""; |
---|
26 | } |
---|
27 | |
---|
28 | #default |
---|
29 | { |
---|
30 | if (includefile == "") { |
---|
31 | print |
---|
32 | } |
---|
33 | }' > $$ |
---|
34 | |
---|
35 | # check for changes |
---|
36 | |
---|
37 | cmp -s $1 $$ || ( cp $$ $1 ; echo $1 updated ) |
---|
38 | |
---|
39 | rm -f $$ |
---|
40 | } |
---|
41 | |
---|
42 | [ $# -ne 0 ] || ( echo "refresh-inclusions.sh file..." >&2 ; exit 2 ) |
---|
43 | |
---|
44 | for i in "$@" |
---|
45 | do |
---|
46 | expand "$i" |
---|
47 | done |
---|
48 | |
---|
Note: See
TracBrowser
for help on using the repository browser.