#! /usr/bin/perl -w # Script to find the command line options in the DocBook source of the Exim # spec, and turn them into a man page, because people like that. open(IN, "spec.xml") || die "Can't open spec.xml\n"; open(OUT, ">exim.8" ) || die "Can't open exim.8\n"; print OUT <<End; .TH EXIM 8 .SH NAME exim \\- a Mail Transfer Agent .SH SYNOPSIS .nf .B exim [options] arguments ... .B mailq [options] arguments ... .B rsmtp [options] arguments ... .B rmail [options] arguments ... .B runq [options] arguments ... .B newaliases [options] arguments ... .fi . .SH DESCRIPTION .rs .sp Exim is a mail transfer agent (MTA) developed at the University of Cambridge. It is a large program with very many facilities. For a full specification, see the reference manual. This man page contains only a description of the command line options. It has been automatically generated from the reference manual source, hopefully without too much mangling. .P Like other MTAs, Exim replaces Sendmail, and is normally called by user agents (MUAs) using the path \\fI/usr/sbin/sendmail\\fP when they submit messages for delivery (some operating systems use \\fI/usr/lib/sendmail\\fP). This path is normally set up as a symbolic link to the Exim binary. It may also be used by boot scripts to start the Exim daemon. Many of Exim's command line options are compatible with Sendmail so that it can act as a drop-in replacement. . .SH "DEFAULT ACTION" .rs .sp If no options are present that require a specific action (such as starting the daemon or a queue runner, testing an address, receiving a message in a specific format, or listing the queue), and there are no arguments on the command line, Exim outputs a brief message about itself and exits. .sp However, if there is at least one command line argument, \\fB-bm\\fR (accept a local message on the standard input, with the arguments specifying the recipients) is assumed. Thus, for example, if Exim is installed in \\fI/usr/sbin\\fP, you can send a message from the command line like this: .sp /usr/sbin/exim -i <recipient-address(es)> <message content, including all the header lines> CTRL-D .sp The \\fB-i\\fP option prevents a line containing just a dot from terminating the message. Only an end-of-file (generated by typing CTRL-D if the input is from a terminal) does so. . .SH "SETTING OPTIONS BY PROGRAM NAME" .rs .sp If an Exim binary is called using one of the names listed in this section (typically via a symbolic link), certain options are assumed. .TP \\fBmailq\\fR Behave as if the option \\fB\\-bp\\fP were present before any other options. The \\fB\\-bp\\fP option requests a listing of the contents of the mail queue on the standard output. .TP \\fBrsmtp\\fR Behaves as if the option \\fB\\-bS\\fP were present before any other options, for compatibility with Smail. The \\fB\\-bS\\fP option is used for reading in a number of messages in batched SMTP format. .TP \\fBrmail\\fR Behave as if the \\fB\\-i\\fP and \\fB\\-oee\\fP options were present before any other options, for compatibility with Smail. The name \\fBrmail\\fR is used as an interface by some UUCP systems. The \\fB\\-i\\fP option specifies that a dot on a line by itself does not terminate a non\\-SMTP message; \\fB\\-oee\\fP requests that errors detected in non\\-SMTP messages be reported by emailing the sender. .TP \\fBrunq\\fR Behave as if the option \\fB\\-q\\fP were present before any other options, for compatibility with Smail. The \\fB\\-q\\fP option causes a single queue runner process to be started. It processes the queue once, then exits. .TP \\fBnewaliases\\fR Behave as if the option \\fB\\-bi\\fP were present before any other options, for compatibility with Sendmail. This option is used for rebuilding Sendmail's alias file. Exim does not have the concept of a single alias file, but can be configured to run a specified command if called with the \\fB\\-bi\\fP option. . .SH "OPTIONS" .rs End while (<IN>) { last if /^<!-- === Start of command line options === -->\s*$/; } die "Can't find start of options\n" if ! defined $_; $optstart = 0; $indent = ""; # Loop for each individual option $next = <IN>; while ($next) { $_ = $next; $next = <IN>; last if /^<!-- === End of command line options === -->\s*$/; # Start of new option if (/^<term>(?=<option>-)(.*?)<\/term>$/) { print OUT ".TP 10\n"; $_ = "$1\n"; $optstart = 1; } # If a line contains text that is not in <>, read subsequent lines of the # same form, so that we get whole sentences for matching on references. if (/^ (?> (<[^>]+>)* ) \s*\S/x) { while ($next =~ /^ (?> (<[^>]+>)* ) \s*\S/x) { $_ .= $next; $next = <IN>; } } # Remove sentences or parenthetical comments that refer to chapters or # sections. The order of these changes is very important: # # (1) Remove any parenthetical comments first. # (2) Then remove any sentences that start after a full stop. # (3) Then remove any sentences that start at the beginning or a newline. s/\s?\( [^()]+ <xref \s linkend="[^"]+" \/ > \)//xg; s/\s?\. [^.]+ <xref \s linkend="[^"]+" \/ > [^.]*? \././xg; s/(^|\n) [^.]+ <xref \s linkend="[^"]+" \/ > [^.]*? \./$1/xg; # Handle paragraph starts; skip the first one encountered for an option if ($optstart && /<(sim)?para>/) { s/<(sim)?para>//; $optstart = 0; } # Literal layout needs to be wrapped with .sp, and indented. if (/<literallayout/) { s/<literallayout[^>]*>/.sp/; $indent = " "; } $indent = "" if (/<\/literallayout>/); # Others get marked s/<para>/.sp/; s/<simpara>/.sp/; # Skip index entries s/<primary>.*?<\/primary>//g; s/<secondary>.*?<\/secondary>//g; # Convert all occurrences of backslash into \e s/\\/\\e/g; # Handle bold and italic s/<emphasis>/\\fI/g; s/<emphasis role="bold">/\\fB/g; s/<\/emphasis>/\\fP/g; s/<option>/\\fB/g; s/<\/option>/\\fP/g; s/<varname>/\\fI/g; s/<\/varname>/\\fP/g; # Handle quotes s/<\/?quote>/"/g; # Remove any remaining XML markup s/<[^>]*>//g; # If nothing left in the line, ignore. next if /^\s*$/; # We are going to output some data; sort out special characters s/</</g; s/>/>/g; s/ / /g; s/–/-/g; s/’/'/g; # Escape hyphens to prevent unwanted hyphenation s/-/\\-/g; # Put in the indent unless the line starts .sp, and then write the line s/^/$indent/mg unless /^\.sp/; print OUT; } print OUT <<End; . .SH "SEE ALSO" .rs .sp The full Exim specification, the Exim book, and the Exim wiki. End # End of x2man