From 5e61585d76ae77fd5e9e96ebabb57afa4d74880d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 14:06:34 +0200 Subject: Adding upstream version 3.5.24. Signed-off-by: Daniel Baumann --- mantools/xpostdef | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100755 mantools/xpostdef (limited to 'mantools/xpostdef') diff --git a/mantools/xpostdef b/mantools/xpostdef new file mode 100755 index 0000000..6c8873f --- /dev/null +++ b/mantools/xpostdef @@ -0,0 +1,121 @@ +#!/usr/bin/perl + +# Usage: xpostdef postconf.proto >postconf.proto.new + +# Update parameter default values in postconf prototype file. + +$POSTCONF="postconf"; + +# Read all the default parameter values. This also provides us with +# a list of all the parameters that postconf knows about. + +open(POSTCONF, "$POSTCONF -d|") || die "cannot run $POSTCONF -d: !$\n"; +while() { + chop; + if (($name, $defval) = split(/\s+=\s+/, $_, 2)) { + $defval =~ s/&/\&/g; + $defval =~ s//\>/g; + $defval =~ s/\s+$//; + $defaults{$name} = $defval; + } else { + die "unexpected $POSTCONF output: $_\n"; + } +} +close(POSTCONF) || die "$POSTCONF failed: $!\n"; + +# Censor out default values that are system or version dependent, or +# that don't display well. + +$censored = <) { + if (/^%PARAM/) { + + # Print the updated parameter text. Keep the old default if + # postconf doesn't have a suitable one. + + if ($name) { + $defval = $defaults{$name} if (defined($defaults{$name})); + print "%PARAM $name $defval\n"; + } + print $text; + + # Reset the parameter name, default, and accumulated text. + + $name = $defval = $text = $line = ""; + + # Accumulate the parameter name and default value. + + do { + $_ =~ s/\s+$//; + $line .= " " . $_; + } while(($_ = ) && /^../); + ($junk, $class, $name, $defval) = split(/\s+/, $line, 4); + } else { + + # Accumulate the text in the parameter definition. + + $_ =~ s/\s+$/\n/; + $text .= $_; + + } +} + +# Fix the last parameter. + +if ($name && $text) { + $defval = $defaults{$name} if (defined($defaults{$name})); + print "%PARAM $name $defval\n$text"; +} -- cgit v1.2.3