2 # $Cambridge: exim/doc/doc-scripts/g2man,v 1.1 2004/10/07 15:04:35 ph10 Exp $
4 # Script to find the command line options in the Exim spec, and turn them
5 # into a man page, because people like that.
8 ##################################################
10 ##################################################
17 $x =~ s/\@\@/&&a/g; # @@
18 $x =~ s/\@\\/&&b/g; # @\
19 $x =~ s/\@</&&l/g; # @<
20 $x =~ s/\@>/&&g/g; # @>
21 $x =~ s/\@\{/&&c/g; # @{
22 $x =~ s/\@\}/&&d/g; # @}
23 $x =~ s/\@#/&&s/g; # @#
24 $x =~ s/\@(.)/$1/g; # all other @s
26 # Convert SGCAL markup
28 $x =~ s/#/ /g; # turn # into a space
29 $x =~ s/\$~//g; # turn $~ into nothing
30 $x =~ s/__/_/g; # turn __ into _
31 $x =~ s/\$sc\{([^\}]*?)\}/$1/g; # turn $sc{xxx} into xxx
32 $x =~ s/\$st\{([^\}]*?)\}/$1/g; # turn $st{xxx} into xxx
33 $x =~ s/\$si\{([^\}]*?)\}/$1/g; # turn $si{xxx} into xxx
34 $x =~ s/\$tt\{([^\}]*?)\}/$1/g; # turn $tt{xxx} into xxx
35 $x =~ s/\$it\{([^\}]*?)\}/$1/g; # turn $it{xxx} into xxx
36 $x =~ s/\$bf\{([^\}]*?)\}/$1/g; # turn $bf{xxx} into xxx
37 $x =~ s/\$rm\{([^\}]*?)\}/$1/g; # turn $rm{xxx} into xxx
38 $x =~ s/\$cb\{([^\}]*?)\}/$1/g; # turn $cb{xxx} into xxx
41 $x =~ s/\\\\([^\\]*?)\\\\/\U$1/g; # turn \\xxx\\ into XXX
42 $x =~ s/\\\(([^)]*?)\)\\/$1/g; # turn \(xxx)\ into xxx
43 $x =~ s/\\\"([^\"]*?)\"\\/$1/g; # turn \"xxx"\ into xxx
44 $x =~ s/\\\%([^\%]*?)\%\\/"$1"/g; # turn \%xxx%\ into "xxx"
46 $x =~ s/\\\?([^?]*?)\?\\/$1/g; # turn \?URL?\ into URL
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/\\\*\*([^*]*?)\*\*\\/$1/g; # turn \**xxx**\ into xxx
51 $x =~ s/\[\(([\w\/]*)\)\]//g; # remove inline HTML
53 $x =~ s/\\\*([^*]*?)\*\\/$1/g; # turn \*xxx*\ into xxx
54 $x =~ s/\\([^\\]*?)\\/"$1"/g; # turn \xxx\ into "xxx"
55 $x =~ s/\$\*\$/\*/g; # turn $*$ into *
56 $x =~ s/\$t\b//g; # turn $t into nothing
58 $x =~ s/::([^:]+)::/$1:/g; # turn ::xxx:: into xxx:
60 # Put back escaped SGCAL specials
62 $x =~ s/&&a/\@/g; # @@ => @
63 $x =~ s/&&b/\\/g; # @\ => \
64 $x =~ s/&&l/</g; # @< => <
65 $x =~ s/&&g/>/g; # @> => >
66 $x =~ s/&&c/\@{/g; # @{ => @{
69 $x =~ s/&&d/\@}/g; # @} => @}
72 # Remove any null flags ($$)
80 ##################################################
81 # De-reference a paragraph #
82 ##################################################
84 # Remove sentences or parenthetical comments that contain references.
89 $t =~ s/^(\n*)[^.()]+~~[^.]+\.\s*/$1/;
90 $t =~ s/\s?\.[^.()]+~~[^.]+\././g;
91 $t =~ s/\s?\([^~).]+~~[^)]+\)//g;
97 ##################################################
98 # Quote what needs quoting #
99 ##################################################
101 # This is for anything that must be quoted in the final output, independent
102 # of whether it is in "asis" text or not.
106 $t =~ s/(?<!\\)-/\\-/g;
113 ##################################################
115 ##################################################
117 open(IN, "spec.src") || die "Can't open spec.src\n";
118 open(OUT, ">exim.8" ) || die "Can't open exim.8\n";
123 exim \\- a Mail Transfer Agent
125 .B exim [options] arguments ...
127 .B mailq [options] arguments ...
129 .B rsmtp [options] arguments ...
131 .B rmail [options] arguments ...
133 .B runq [options] arguments ...
135 .B newaliases [options] arguments ...
138 Exim is a mail transfer agent (MTA) developed at the University of Cambridge.
139 It is a large program with very many facilities. For a full specification, see
140 the reference manual. This man page contains only a description of the command
141 line options. It has been automatically generated from the reference manual
142 source, which is why the formatting is poor in some places.
144 .SH SETTING OPTIONS BY PROGRAM NAME
147 Behave as if the option \\-bp were present before any other options. The \\-bp
148 option requests a listing of the contents of the mail queue on the standard
152 Behaves as if the option \\-bS were present before any other options, for
153 compatibility with Smail. The \\-bS option is used for reading in a number of
154 messages in batched SMTP format.
157 Behave as if the \\-i and \\-oee options were present before any other options,
158 for compatibility with Smail. The name \\fBrmail\\fR is used as an interface by
159 some UUCP systems. The \\-i option specifies that a dot on a line by itself
160 does not terminate a non\\-SMTP message; \\-oee requests that errors detected in
161 non\\-SMTP messages be reported by emailing the sender.
164 Behave as if the option \\-q were present before any other options, for
165 compatibility with Smail. The \\-q option causes a single queue runner process
166 to be started. It processes the queue once, then exits.
169 Behave as if the option \\-bi were present before any other options, for
170 compatibility with Sendmail. This option is used for rebuilding Sendmail's
171 alias file. Exim does not have the concept of a single alias file, but can be
172 configured to run a specified command if called with the \\-bi option.
179 while (<IN>) { last if /^\.startoptions/; }
180 die "Can't find start of options\n" if ! defined $_;
182 # Find the start of the first option
184 while (<IN>) { last if /^\.option/; }
185 die "Can't find start of first option\n" if ! defined $_;
187 # Loop for each individual option
189 while (/^\.option (.*)/)
194 printf OUT ("\\fB\\-%s\\fR\n", &mustquote(&process($1)));
196 # Process the data for the option
200 last if /^\.(?:option|endoptions)/;
203 next if /^\.nem\s*$/;
205 if (/^\.display(?:\s+flow)?(?:\s+rm)?\s*$/)
207 print OUT &mustquote(&deref($itemtext));
210 while (($_ = <IN>) !~ /^\.endd/)
212 print OUT " ", &mustquote(&deref(&process($_))) if ! /^\./;
217 elsif (/^\.display asis\s*$/)
219 print OUT &mustquote(&deref($itemtext));
222 while (($_ = <IN>) !~ /^\.endd/)
224 print OUT &mustquote(" $_");
231 print OUT &mustquote(&deref($itemtext));
238 while ($nlpending > 0)
243 $itemtext .= &process($_);
247 print OUT &mustquote(&deref($itemtext));