3 # Usage: xpostdef postconf.proto >postconf.proto.new
5 # Update parameter default values in postconf prototype file.
9 # Read all the default parameter values. This also provides us with
10 # a list of all the parameters that postconf knows about.
12 open(POSTCONF
, "$POSTCONF -d|") || die "cannot run $POSTCONF -d: !$\n";
15 if (($name, $defval) = split(/\s+=\s+/, $_, 2)) {
16 $defval =~ s/&/\&/g;
17 $defval =~ s/</\</g;
18 $defval =~ s/>/\>/g;
20 $defaults{$name} = $defval;
22 die "unexpected $POSTCONF output: $_\n";
25 close(POSTCONF
) || die "$POSTCONF failed: $!\n";
27 # Censor out default values that are system or version dependent, or
28 # that don't display well.
34 command_expansion_filter
39 execution_directory_expansion_filter
41 forward_expansion_filter
55 parent_domain_matches_subdomains
60 smtpd_expansion_filter
68 milter_unknown_command_macros
69 milter_end_of_data_macros
72 for $name (split(/\s+/, $censored)) {
73 $defaults{$name} = "see \"postconf -d\" output";
76 # Process the postconf prototype file, and update default values
77 # with output from the postconf command. Leave alone any defaults
78 # that postconf didn't know about. This can happen when conditional
79 # features have been compile time disabled.
81 $name = $defval = $text = $line = "";
86 # Print the updated parameter text. Keep the old default if
87 # postconf doesn't have a suitable one.
90 $defval = $defaults{$name} if (defined($defaults{$name}));
91 print "%PARAM $name $defval\n";
95 # Reset the parameter name, default, and accumulated text.
97 $name = $defval = $text = $line = "";
99 # Accumulate the parameter name and default value.
104 } while(($_ = <POSTCONF
>) && /^../);
105 ($junk, $class, $name, $defval) = split(/\s+/, $line, 4);
108 # Accumulate the text in the parameter definition.
116 # Fix the last parameter.
118 if ($name && $text) {
119 $defval = $defaults{$name} if (defined($defaults{$name}));
120 print "%PARAM $name $defval\n$text";