3 # Script to find the command line options in the Exim spec, and turn them
4 # into a man page, because people like that.
7 ##################################################
9 ##################################################
16 $x =~ s/\@\@/&&a/g; # @@
17 $x =~ s/\@\\/&&b/g; # @\
18 $x =~ s/\@</&&l/g; # @<
19 $x =~ s/\@>/&&g/g; # @>
20 $x =~ s/\@\{/&&c/g; # @{
21 $x =~ s/\@\}/&&d/g; # @}
22 $x =~ s/\@#/&&s/g; # @#
23 $x =~ s/\@(.)/$1/g; # all other @s
25 # Convert SGCAL markup
27 $x =~ s/#/ /g; # turn # into a space
28 $x =~ s/\$~//g; # turn $~ into nothing
29 $x =~ s/__/_/g; # turn __ into _
30 $x =~ s/\$sc\{([^\}]*?)\}/$1/g; # turn $sc{xxx} into xxx
31 $x =~ s/\$st\{([^\}]*?)\}/$1/g; # turn $st{xxx} into xxx
32 $x =~ s/\$si\{([^\}]*?)\}/$1/g; # turn $si{xxx} into xxx
33 $x =~ s/\$tt\{([^\}]*?)\}/$1/g; # turn $tt{xxx} into xxx
34 $x =~ s/\$it\{([^\}]*?)\}/$1/g; # turn $it{xxx} into xxx
35 $x =~ s/\$bf\{([^\}]*?)\}/$1/g; # turn $bf{xxx} into xxx
36 $x =~ s/\$rm\{([^\}]*?)\}/$1/g; # turn $rm{xxx} into xxx
37 $x =~ s/\$cb\{([^\}]*?)\}/$1/g; # turn $cb{xxx} into xxx
40 $x =~ s/\\\\([^\\]*?)\\\\/\U$1/g; # turn \\xxx\\ into XXX
41 $x =~ s/\\\(([^)]*?)\)\\/$1/g; # turn \(xxx)\ into xxx
42 $x =~ s/\\\"([^\"]*?)\"\\/$1/g; # turn \"xxx"\ into xxx
43 $x =~ s/\\\%([^\%]*?)\%\\/"$1"/g; # turn \%xxx%\ into "xxx"
45 $x =~ s/\\\?([^?]*?)\?\\/$1/g; # turn \?URL?\ into URL
46 $x =~ s/<<([^>]*?)>>/<$1>/g; # turn <<xxx>> into <xxx>
47 $x =~ s/\\\$([^\$]*?)\$\\/\$$1/g; # turn \$xxx$\ into $xxx
48 $x =~ s/\\\-([^\\]*?)\-\\/\-$1/g; # turn \-xxx-\ into -xxx
49 $x =~ s/\\\*\*([^*]*?)\*\*\\/$1/g; # turn \**xxx**\ into xxx
50 $x =~ s/\[\(([\w\/]*)\)\]//g; # remove inline HTML
52 $x =~ s/\\\*([^*]*?)\*\\/$1/g; # turn \*xxx*\ into xxx
53 $x =~ s/\\([^\\]*?)\\/"$1"/g; # turn \xxx\ into "xxx"
54 $x =~ s/\$\*\$/\*/g; # turn $*$ into *
55 $x =~ s/\$t\b//g; # turn $t into nothing
57 $x =~ s/::([^:]+)::/$1:/g; # turn ::xxx:: into xxx:
59 # Put back escaped SGCAL specials
61 $x =~ s/&&a/\@/g; # @@ => @
62 $x =~ s/&&b/\\/g; # @\ => \
63 $x =~ s/&&l/</g; # @< => <
64 $x =~ s/&&g/>/g; # @> => >
65 $x =~ s/&&c/\@{/g; # @{ => @{
68 $x =~ s/&&d/\@}/g; # @} => @}
71 # Remove any null flags ($$)
79 ##################################################
80 # De-reference a paragraph #
81 ##################################################
83 # Remove sentences or parenthetical comments that contain references.
88 $t =~ s/^(\n*)[^.()]+~~[^.]+\.\s*/$1/;
89 $t =~ s/\s?\.[^.()]+~~[^.]+\././g;
90 $t =~ s/\s?\([^~).]+~~[^)]+\)//g;
96 ##################################################
97 # Quote what needs quoting #
98 ##################################################
100 # This is for anything that must be quoted in the final output, independent
101 # of whether it is in "asis" text or not.
105 $t =~ s/(?<!\\)-/\\-/g;
112 ##################################################
114 ##################################################
116 open(IN, "spec.src") || die "Can't open spec.src\n";
117 open(OUT, ">exim.8" ) || die "Can't open exim.8\n";
122 exim \\- a Mail Transfer Agent
124 .B exim [options] arguments ...
126 .B mailq [options] arguments ...
128 .B rsmtp [options] arguments ...
130 .B rmail [options] arguments ...
132 .B runq [options] arguments ...
134 .B newaliases [options] arguments ...
137 Exim is a mail transfer agent (MTA) developed at the University of Cambridge.
138 It is a large program with very many facilities. For a full specification, see
139 the reference manual. This man page contains only a description of the command
140 line options. It has been automatically generated from the reference manual
141 source, which is why the formatting is poor in some places.
143 .SH SETTING OPTIONS BY PROGRAM NAME
146 Behave as if the option \\-bp were present before any other options. The \\-bp
147 option requests a listing of the contents of the mail queue on the standard
151 Behaves as if the option \\-bS were present before any other options, for
152 compatibility with Smail. The \\-bS option is used for reading in a number of
153 messages in batched SMTP format.
156 Behave as if the \\-i and \\-oee options were present before any other options,
157 for compatibility with Smail. The name \\fBrmail\\fR is used as an interface by
158 some UUCP systems. The \\-i option specifies that a dot on a line by itself
159 does not terminate a non\\-SMTP message; \\-oee requests that errors detected in
160 non\\-SMTP messages be reported by emailing the sender.
163 Behave as if the option \\-q were present before any other options, for
164 compatibility with Smail. The \\-q option causes a single queue runner process
165 to be started. It processes the queue once, then exits.
168 Behave as if the option \\-bi were present before any other options, for
169 compatibility with Sendmail. This option is used for rebuilding Sendmail's
170 alias file. Exim does not have the concept of a single alias file, but can be
171 configured to run a specified command if called with the \\-bi option.
178 while (<IN>) { last if /^\.startoptions/; }
179 die "Can't find start of options\n" if ! defined $_;
181 # Find the start of the first option
183 while (<IN>) { last if /^\.option/; }
184 die "Can't find start of first option\n" if ! defined $_;
186 # Loop for each individual option
188 while (/^\.option (.*)/)
193 printf OUT ("\\fB\\-%s\\fR\n", &mustquote(&process($1)));
195 # Process the data for the option
199 last if /^\.(?:option|endoptions)/;
202 next if /^\.nem\s*$/;
204 if (/^\.display(?:\s+flow)?(?:\s+rm)?\s*$/)
206 print OUT &mustquote(&deref($itemtext));
209 while (($_ = <IN>) !~ /^\.endd/)
211 print OUT " ", &mustquote(&deref(&process($_))) if ! /^\./;
216 elsif (/^\.display asis\s*$/)
218 print OUT &mustquote(&deref($itemtext));
221 while (($_ = <IN>) !~ /^\.endd/)
223 print OUT &mustquote(" $_");
230 print OUT &mustquote(&deref($itemtext));
237 while ($nlpending > 0)
242 $itemtext .= &process($_);
246 print OUT &mustquote(&deref($itemtext));