1 # Extract initialization tables from actual source code.
3 # XXX: Associated variable aliasing:
5 # Some parameters bind to different variables in different contexts,
6 # And other parameters map to associated variables in a many-to-1
7 # fashion. This is mostly the result of the SMTP+LMTP integration
8 # and the overloading of parameters that have identical semantics,
9 # for the corresponding context.
11 # The "++table[...]" below ignores the associated variable name
12 # when doing duplicate elimination. Differences in the default value
13 # or lower/upper bounds still result in "postconf -d" duplicates,
14 # which are a sign of an error somewhere...
16 # XXX Work around ancient AWK implementations with a 10 file limit
17 # and no working close() operator (e.g. Solaris). Some systems
18 # have a more modern implementation that is XPG4-compatible, but it
19 # is too much bother to find out where each system keeps these.
21 /^
(static
| )*(const
+)?CONFIG_INT_TABLE .
*\
{/,/\
};/ {
23 int_vars
["int " substr($
3,2,length($
3)-2) ";"] =
1
24 if (++itab
[$
1 $
2 $
4 $
5 $
6 $
7 $
8 $
9] ==
1) {
29 /^
(static
| )*(const
+)?CONFIG_STR_TABLE .
*\
{/,/\
};/ {
31 str_vars
["char *" substr($
3,2,length($
3)-2) ";"] =
1
32 if (++stab
[$
1 $
2 $
4 $
5 $
6 $
7 $
8 $
9] ==
1) {
37 /^
(static
| )*(const
+)?CONFIG_RAW_TABLE .
*\
{/,/\
};/ {
39 raw_vars
["char *" substr($
3,2,length($
3)-2) ";"] =
1
40 if (++rtab
[$
1 $
2 $
4 $
5 $
6 $
7 $
8 $
9] ==
1) {
45 /^
(static
| )*(const
+)?CONFIG_BOOL_TABLE .
*\
{/,/\
};/ {
47 bool_vars
["int " substr($
3,2,length($
3)-2) ";"] =
1
48 if (++btab
[$
1 $
2 $
4 $
5 $
6 $
7 $
8 $
9] ==
1) {
53 /^
(static
| )*(const
+)?CONFIG_TIME_TABLE .
*\
{/,/\
};/ {
55 time_vars
["int " substr($
3,2,length($
3)-2) ";"] =
1
56 if (++ttab
[$
1 $
2 $
4 $
5 $
6 $
7 $
8 $
9] ==
1) {
61 /^
(static
| )*(const
+)?CONFIG_NINT_TABLE .
*\
{/,/\
};/ {
63 nint_vars
["int " substr($
3,2,length($
3)-2) ";"] =
1
64 if (++itab
[$
1 $
2 $
4 $
5 $
6 $
7 $
8 $
9] ==
1) {
71 # Print parameter declarations without busting old AWK's file limit.
72 print "cat >int_vars.h <<'EOF'"
77 print "cat >str_vars.h <<'EOF'"
82 print "cat >raw_vars.h <<'EOF'"
87 print "cat >bool_vars.h <<'EOF'"
88 for (key in bool_vars
)
92 print "cat >time_vars.h <<'EOF'"
93 for (key in time_vars
)
97 print "cat >nint_vars.h <<'EOF'"
98 for (key in nint_vars
)
102 # Print parameter initializations without busting old AWK's file limit.
103 print "sed 's/[ ][ ]*/ /g' >int_table.h <<'EOF'"
104 for (key in int_table
)
108 print "sed 's/[ ][ ]*/ /g' >str_table.h <<'EOF'"
109 for (key in str_table
)
113 print "sed 's/[ ][ ]*/ /g' >raw_table.h <<'EOF'"
114 for (key in raw_table
)
118 print "sed 's/[ ][ ]*/ /g' >bool_table.h <<'EOF'"
119 for (key in bool_table
)
123 print "sed 's/[ ][ ]*/ /g' >time_table.h <<'EOF'"
124 for (key in time_table
)
128 print "sed 's/[ ][ ]*/ /g' >nint_table.h <<'EOF'"
129 for (key in nint_table
)
133 # Flush output nicely.