1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
|
# Extract initialization tables from actual source code.
# XXX: Associated variable aliasing:
#
# Some parameters bind to different variables in different contexts,
# And other parameters map to associated variables in a many-to-1
# fashion. This is mostly the result of the SMTP+LMTP integration
# and the overloading of parameters that have identical semantics,
# for the corresponding context.
#
# The "++table[...]" below ignores the associated variable name
# when doing duplicate elimination. Differences in the default value
# or lower/upper bounds still result in "postconf -d" duplicates,
# which are a sign of an error somewhere...
#
# XXX Work around ancient AWK implementations with a 10 file limit
# and no working close() operator (e.g. Solaris). Some systems
# have a more modern implementation that is XPG4-compatible, but it
# is too much bother to find out where each system keeps these.
{ owned_by_library = (FILENAME ~ /\/(global|tls)\//) }
/^(static| )*(const +)?CONFIG_INT_TABLE .*\{/,/\};/ {
if ($1 ~ /VAR/) {
if (!owned_by_library)
int_vars["int " substr($3,2,length($3)-2) ";"] = 1
if (++itab[$1 $2 $4 $5 $6 $7 $8 $9] == 1) {
int_table[$0] = 1
}
}
}
/^(static| )*(const +)?CONFIG_STR_TABLE .*\{/,/\};/ {
if ($1 ~ /^VAR/) {
if (!owned_by_library)
str_vars["char *" substr($3,2,length($3)-2) ";"] = 1
if (++stab[$1 $2 $4 $5 $6 $7 $8 $9] == 1) {
str_table[$0] = 1
}
}
}
/^(static| )*(const +)?CONFIG_STR_FN_TABLE .*\{/,/\};/ {
if ($1 ~ /^VAR/) {
if (!owned_by_library)
str_fn_vars["char *" substr($3,2,length($3)-2) ";"] = 1
$2 = "pcf_" $2
if (++stab[$1 $2 $4 $5 $6 $7 $8 $9] == 1) {
str_fn_table[$0] = 1
}
}
}
/^(static| )*(const +)?CONFIG_RAW_TABLE .*\{/,/\};/ {
if ($1 ~ /^VAR/) {
if (!owned_by_library)
raw_vars["char *" substr($3,2,length($3)-2) ";"] = 1
if (++rtab[$1 $2 $4 $5 $6 $7 $8 $9] == 1) {
raw_table[$0] = 1
}
}
}
/^(static| )*(const +)?CONFIG_BOOL_TABLE .*\{/,/\};/ {
if ($1 ~ /^VAR/) {
if (!owned_by_library)
bool_vars["int " substr($3,2,length($3)-2) ";"] = 1
if (++btab[$1 $2 $4 $5 $6 $7 $8 $9] == 1) {
bool_table[$0] = 1
}
}
}
/^(static| )*(const +)?CONFIG_TIME_TABLE .*\{/,/\};/ {
if ($1 ~ /^VAR/) {
if (!owned_by_library)
time_vars["int " substr($3,2,length($3)-2) ";"] = 1
if (++ttab[$1 $2 $4 $5 $6 $7 $8 $9] == 1) {
time_table[$0] = 1
}
}
}
/^(static| )*(const +)?CONFIG_NINT_TABLE .*\{/,/\};/ {
if ($1 ~ /VAR/) {
if (!owned_by_library)
nint_vars["int " substr($3,2,length($3)-2) ";"] = 1
if (++itab[$1 $2 $4 $5 $6 $7 $8 $9] == 1) {
nint_table[$0] = 1
}
}
}
/^(static| )*(const +)?CONFIG_NBOOL_TABLE .*\{/,/\};/ {
if ($1 ~ /^VAR/) {
if (!owned_by_library)
nbool_vars["int " substr($3,2,length($3)-2) ";"] = 1
if (++btab[$1 $2 $4 $5 $6 $7 $8 $9] == 1) {
nbool_table[$0] = 1
}
}
}
/^(static| )*(const +)?CONFIG_LONG_TABLE .*\{/,/\};/ {
if ($1 ~ /VAR/) {
if (!owned_by_library)
long_vars["long " substr($3,2,length($3)-2) ";"] = 1
if (++itab[$1 $2 $4 $5 $6 $7 $8 $9] == 1) {
long_table[$0] = 1
}
}
}
END {
# Print parameter declarations without busting old AWK's file limit.
print "cat >int_vars.h <<'EOF'"
for (key in int_vars)
print key
print "EOF"
print "cat >str_vars.h <<'EOF'"
for (key in str_vars)
print key
print "EOF"
print "cat >str_fn_vars.h <<'EOF'"
for (key in str_fn_vars)
print key
print "EOF"
print "cat >raw_vars.h <<'EOF'"
for (key in raw_vars)
print key
print "EOF"
print "cat >bool_vars.h <<'EOF'"
for (key in bool_vars)
print key
print "EOF"
print "cat >time_vars.h <<'EOF'"
for (key in time_vars)
print key
print "EOF"
print "cat >nint_vars.h <<'EOF'"
for (key in nint_vars)
print key
print "EOF"
print "cat >nbool_vars.h <<'EOF'"
for (key in nbool_vars)
print key
print "EOF"
print "cat >long_vars.h <<'EOF'"
for (key in long_vars)
print key
print "EOF"
# Print parameter initializations without busting old AWK's file limit.
print "sed 's/[ ][ ]*/ /g' >int_table.h <<'EOF'"
for (key in int_table)
print key
print "EOF"
print "sed 's/[ ][ ]*/ /g' >str_table.h <<'EOF'"
for (key in str_table)
print key
print "EOF"
print "sed 's/[ ][ ]*/ /g' >str_fn_table.h <<'EOF'"
for (key in str_fn_table)
print key
print "EOF"
print "sed 's/[ ][ ]*/ /g' >raw_table.h <<'EOF'"
for (key in raw_table)
print key
print "EOF"
print "sed 's/[ ][ ]*/ /g' >bool_table.h <<'EOF'"
for (key in bool_table)
print key
print "EOF"
print "sed 's/[ ][ ]*/ /g' >time_table.h <<'EOF'"
for (key in time_table)
print key
print "EOF"
print "sed 's/[ ][ ]*/ /g' >nint_table.h <<'EOF'"
for (key in nint_table)
print key
print "EOF"
print "sed 's/[ ][ ]*/ /g' >nbool_table.h <<'EOF'"
for (key in nbool_table)
print key
print "EOF"
print "sed 's/[ ][ ]*/ /g' >long_table.h <<'EOF'"
for (key in long_table)
print key
print "EOF"
# Flush output nicely.
exit(0);
}
|