#!/usr/bin/perl
#-----------------------------------------------------------------------------
#
#  POPular -- A POP3 server and proxy for large mail systems
#
#  $Id: log-raw2man,v 1.2 2002/09/15 12:27:14 sqrt Exp $
#
#  http://www.remote.org/jochen/mail/popular/
#
#-----------------------------------------------------------------------------
#
#  Copyright (C) 1999-2002  Jochen Topf <jochen@remote.org>
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
#
#-----------------------------------------------------------------------------

use strict;

my @all;
my $num;
my $text;

while (<>) {
  if (/^:([0-9a-f]{4}):(...):([a-z_]+):(.*):([0-9]+)$/) {
    if ($num) {
      chomp $text;
      push(@{$all[$num]}, $text);
    }
    $num = hex($1);
    $all[$num] = [ $1, $2, $3, $4, $5 ];
    $text = "";
  } else {
    $text .= $_;
  }
}


print <<'EOF';
.TH "popular-log" "7" "" "" ""
.SH "NAME"
popular-log \- log messages from POPular programs
.SH "DESCRIPTION"
This is a list of all the log messages printed by
.BR pcheckd (8),
.BR pproxy (8),
.BR pserv (8),
and
.BR pdeliver (8) .
.SH "LOG LEVEL"
.TS
l l.
DBG     debug messages
INF     informational messages
ERR     error messages
ADM     admin intervention required
SOS     critical event
BUG     software bug
.TE
.SH "MESSAGE LIST"
.TS
l lw60.
ID	Lvl   Name
\&	Description
_
EOF

foreach (0..@all) {
  if (defined $all[$_]) {
    print <<"EOF";
\\fB$all[$_]->[0]\t$all[$_]->[1]   $all[$_]->[2]
\\&\tT{
$all[$_]->[5]
T}
EOF
  }
}

print <<'EOF';
.TE
.SH "FILES"
.PP
.IP "/var/log/popular/pcheckd"
Log file of the
.BR pcheckd (8)
program
.IP "/var/log/popular/pproxy"
Log file of the
.BR pproxy (8)
program
.IP "/var/log/popular/pserv"
Log file of the
.BR pserv (8)
program
.IP "/var/log/popular/pdeliver"
Log file of the
.BR pdeliver (1)
program
.SH "SEE ALSO"
.PP
pcheckd(8), pdeliver(1), pproxy(8), pserv(8), The POPular Manual
.SH "AUTHOR"
.PP
Jochen Topf jochen@remote\&.org
.PP
\fB
http://www\&.remote\&.org/jochen/mail/popular/
\fR
<URL:http://www\&.remote\&.org/jochen/mail/popular/>
.SH "COPYRIGHT"
.PP
The POPular suite is copyright (C) 1999-2002 by Jochen Topf
jochen@remote\&.org\&.
.PP
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version\&.
.PP
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE\&. See the
GNU General Public License for more details\&.
.PP
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc\&., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
EOF


exit 0;

#-----------------------------------------------------------------------------

format =
      ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<~~
$all[$_]->[5]
.


#-- THE END ------------------------------------------------------------------


syntax highlighted by Code2HTML, v. 0.9.1