#! /usr/bin/perl
#
# Script to generate the mailq-m man-page from source material embedded in
# scheduler/mailq.inc file
#
#use strict; no strict "subs";
use integer;
use Fcntl;
use IO::Handle;
use POSIX;
use Carp;
$fn = $ARGV[0];
# PERL 5.6+ syntax...
open SRCFILE, "<",$fn || die "Can't open file: $fn; $!";
SRCFILE->autoflush(0);
my $oldinsep = $/;
$/ = undef; # Slurp everything into one long line
my $srcdata = SRCFILE->getline;
$/ = $oldinsep; # Restore the separator
close SRCFILE;
print '\'\" t
.\" THIS FILE IS GENERATED WITH mailq-m-generate.pl FROM mailq.inc
.ds ]W "ZMailer 2.99"
.nr X
';
printf ".TH MAILQ-M 5zm \"%s\"\n", strftime("%Y-%b-%d",localtime());
print '.SH NAME
"mailq \-M" \- output format description
.SH SYNOPSIS
Lots of odd variables and counters
.PP
These are generated from inline XMLishly tagged
descriptions in file
.I "scheduler/mailq.inc"
.SH DESCRIPTION
';
for (;;) {
if ($srcdata =~ m{.*?(.*?)(.*)$}s) {
my $thisvar = $1;
$srcdata = $2;
if ($thisvar =~ m{\s*