source: draft-ietf-httpbis/16/refresh-inclusions.sh @ 1650

Last change on this file since 1650 was 1049, checked in by julian.reschke@…, 12 years ago

fix argument handling

  • Property svn:executable set to *
File size: 766 bytes
Line 
1#!/bin/sh
2# refresh file inclusions
3
4expand() {
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
44for i in "$@"
45do
46  expand "$i"
47done
48
Note: See TracBrowser for help on using the repository browser.