Last change
on this file since 1592 was
1049,
checked in by julian.reschke@…, 12 years ago
|
fix argument handling
|
-
Property svn:executable set to
*
|
File size:
766 bytes
|
Rev | Line | |
---|
[679] | 1 | #!/bin/sh
|
---|
| 2 | # refresh file inclusions
|
---|
| 3 |
|
---|
| 4 | expand() {
|
---|
| 5 |
|
---|
| 6 | cat $1 | awk '
|
---|
| 7 | BEGIN {
|
---|
| 8 | includefile = "";
|
---|
| 9 | }
|
---|
| 10 |
|
---|
| 11 | # start include
|
---|
[680] | 12 | /^<\?BEGININC .* \?>$/ {
|
---|
[679] | 13 | print
|
---|
[680] | 14 | includefile = $2
|
---|
[679] | 15 | while (getline <includefile > 0) {
|
---|
| 16 | print
|
---|
| 17 | }
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | # end include
|
---|
[680] | 21 | /^<\?ENDINC .* \?>$/ {
|
---|
| 22 | if ($2 != includefile) {
|
---|
| 23 | printf ("unexpected ENDINC, got %s but expected %s\n", $2, includefile) >> /dev/stderr
|
---|
[679] | 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 |
|
---|
[743] | 42 | [ $# -ne 0 ] || ( echo "refresh-inclusions.sh file..." >&2 ; exit 2 )
|
---|
[742] | 43 |
|
---|
[1049] | 44 | for i in "$@"
|
---|
[679] | 45 | do
|
---|
[1049] | 46 | expand "$i"
|
---|
[679] | 47 | done
|
---|
| 48 |
|
---|
Note: See
TracBrowser
for help on using the repository browser.