summaryrefslogtreecommitdiffstats
path: root/mantools/makepostconf
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xmantools/makepostconf61
-rwxr-xr-xmantools/makepostconflinks29
2 files changed, 90 insertions, 0 deletions
diff --git a/mantools/makepostconf b/mantools/makepostconf
new file mode 100755
index 0000000..7aa741a
--- /dev/null
+++ b/mantools/makepostconf
@@ -0,0 +1,61 @@
+#!/usr/bin/perl
+
+# Extract parameter definitions from the sample-mumble.cf files in
+# order to build the postconf raw data file from which everything
+# will be regenerated.
+
+$POSTCONF="postconf";
+
+# Suck in the parameter definition text. Skip non-parameter blocks.
+# Strip all but the body text (i.e. strip off the non-comment line
+# that shows the default, since we will use postconf output to supply
+# the actual values).
+
+while(<>) {
+ if (/^[^#]/) {
+ if ($param_name && $saved_text) {
+ $saved_text =~ s/^(\n|#|\s)+//;
+ $saved_text =~ s/(\n|#|\s)+$//;
+ $saved_text =~ s/^# ?/\n/;
+ $saved_text =~ s/\n# ?/\n/g;
+ $definition{$param_name} = $saved_text;
+ $param_name = $saved_text = "";
+ }
+ next;
+ }
+ if (/^#/ && $param_name) {
+ $saved_text .= $_;
+ next;
+ }
+ if (/^# The (\S+) (configuration )?parameter/) {
+ $param_name = $1;
+ $saved_text = $_;
+ }
+}
+
+# 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: !$\n";
+while(<POSTCONF>) {
+ chop;
+ if (($name, $value) = split(/\s+=\s+/, $_, 2)) {
+ $defaults{$name} = $value;
+ } else {
+ warn "unexpected $POSTCONF output: $_\n";
+ }
+}
+close(POSTCONF) || die "$POSTCONF failed: $!\n";
+
+# Print all parameter definition text that we found, and warn about
+# missing definition text.
+
+for $param_name (sort keys %defaults) {
+ if (defined($definition{$param_name})) {
+ print "#DEFINE $param_name\n\n";
+ print $definition{$param_name};
+ print "\n\n";
+ } else {
+ warn "No definition found for $param_name\n";
+ }
+}
diff --git a/mantools/makepostconflinks b/mantools/makepostconflinks
new file mode 100755
index 0000000..ef61d1c
--- /dev/null
+++ b/mantools/makepostconflinks
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+postconf -d | awk '
+
+BEGIN {
+ # Skip lines with <hN>..</hN>.
+ print "\t/<\\/*[Hh][0-9]+>/{\n\t\tp\n\t\td\n\t\t}"
+
+ # Skip lines with <a name="...">.
+ print "\t/<[Aa] [Nm][Aa][Mm][Ee]=/{\n\t\tp\n\t\td\n\t\t}"
+
+ # Skip lines with <DT> or <DT>.
+ print "\t/<[Dd][Tt]>/{\n\t\tp\n\t\td\n\t\t}"
+
+ # Skip lines with <a href="...">.
+ print "\t/<[Aa] [Hh][Rr][Ee][Ff]=/{\n\t\tp\n\t\td\n\t\t}"
+
+ # XXX debugger_command is not listed in postconf output.
+ print "\ts;[[:<:]]debugger_command[[:>:]];<a href=\"postconf.5.html#debugger_command\">debugger_command</a>;g"
+
+ }
+
+ {
+ # Do not hyperlink word(digit).
+
+ printf "\ts;[[:<:]]%s[[:>:]];<a href=\"postconf.5.html#%s\">%s</a>;g\n",
+ $1, $1, $1
+ }
+'