~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to srclib/apr/build/make_var_export.awk

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Based on apr's make_export.awk, which is
 
2
# based on Ryan Bloom's make_export.pl
 
3
 
 
4
/^#[ \t]*if(def)? (AP[RUI]?_|!?defined).*/ {
 
5
        if (old_filename != FILENAME) {
 
6
                if (old_filename != "") printf("%s", line)
 
7
                macro_no = 0
 
8
                found = 0
 
9
                count = 0
 
10
                old_filename = FILENAME
 
11
                line = ""
 
12
        }
 
13
        macro_stack[macro_no++] = macro
 
14
        macro = substr($0, length($1)+2)
 
15
        count++
 
16
        line = line "#ifdef " macro "\n"
 
17
        next
 
18
}
 
19
 
 
20
/^#[ \t]*endif/ {
 
21
        if (count > 0) {
 
22
                count--
 
23
                line = line "#endif /* " macro " */\n"
 
24
                macro = macro_stack[--macro_no]
 
25
        }
 
26
        if (count == 0) {
 
27
                if (found != 0) {
 
28
                        printf("%s", line)
 
29
                }
 
30
                line = ""
 
31
        }
 
32
        next
 
33
}
 
34
 
 
35
function add_symbol (sym_name) {
 
36
        if (count) {
 
37
                found++
 
38
        }
 
39
        for (i = 0; i < count; i++) {
 
40
                line = line "\t"
 
41
        }
 
42
        line = line sym_name "\n"
 
43
 
 
44
        if (count == 0) {
 
45
                printf("%s", line)
 
46
                line = ""
 
47
        }
 
48
}
 
49
 
 
50
/^[ \t]*(extern[ \t]+)?AP[RUI]?_DECLARE_DATA .*;$/ {
 
51
       varname = $NF;
 
52
       gsub( /[*;]/, "", varname);
 
53
       gsub( /\[.*\]/, "", varname);
 
54
       add_symbol(varname);
 
55
}
 
56
 
 
57
END {
 
58
        printf("%s", line)
 
59
}