$inf = "";
$ibase = "";
@ipath = ();
+$encoding = undef;
while ($_ = shift) {
if (/^-D(.*)$/) {
/^\@setfilename\s+([^.]+)/ and $fn = $1, next;
/^\@settitle\s+([^.]+)/ and $tl = postprocess($1), next;
+ # Look for document encoding
+ /^\@documentencoding\s+([^.]+)/ and do {
+ $encoding = $1 unless defined $encoding;
+ next;
+ };
+
# Identify a man title but keep only the one we are interested in.
/^\@c\s+man\s+title\s+([A-Za-z0-9-]+)\s+(.+)/ and do {
if (exists $defs{$1}) {
die "No filename or title\n" unless defined $fn && defined $tl;
+print "=encoding $encoding\n\n" if defined $encoding;
+
$sects{NAME} = "$fn \- $tl\n";
$sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};