#! /bin/ksh

name=$1
db=$name.db
rec=`cat $db`

shortdesc=`echo "$rec" | ssformat -t %shortdesc`
longdesc=`echo "$rec" | ssformat -t %longdesc`
example=`echo "$rec" | ssformat -t %example`
synopsis=`echo "$rec" | ssformat -t %synopsis`
options=`echo "$rec" | ssformat -t %options`
stdopt=`echo "$rec" | ssformat -t %stdopt`
limits=`echo "$rec" | ssformat -t %limits`
updated=`echo "$rec" | ssformat -t %updated`
seealso=`echo "$rec" | ssformat -t %seealso`

echo "
<html lang='en'>
<head>
<link rel='stylesheet' href='stat.css' type='text/css'>
<title>
     $name - $shortdesc
</title>
</head>
<body>
<table border=1 cellpadding=3 cellspacing=0>
<tr><th>PACKAGE</th><td class=package>
	<a href='http://acm.org/perlman/stat/'>|STAT</a> Data Manipulation and Analysis,
	by <a href='http://acm.org/perlman/'>Gary Perlman</a>
</td></tr>
<tr>
<th>NAME</th>
<td class=name>
     $name - $shortdesc
</td></tr>

<tr>
<th>SYNOPSIS</th>
<td class=synopsis>
     $synopsis
</td></tr>

<tr>
<th>DESCRIPTION</th>
<td>
     $longdesc
</td></tr>

<tr>
<th>OPTIONS</th>
<td>
$options
"

if test "$stdopt" = true
then
echo "<hr size=1>
	The following <i>standard help </i> options are supported.
	The program exits after displaying the help.
	<dl compact>
		 <dt>-L<dd>Display limits
		 <dt>-O<dd>Display options and values
		 <dt>-V<dd>Display version number and date
	</dl>"
fi

echo "</td></tr>

<tr>
<th>EXAMPLE</th>
<td>
$example
</td></tr>

<tr>
<th>LIMITS</th>
<td>
     $limits
</td></tr>

<tr>
<th>UPDATED</th>
<td>
$updated
</td></tr>

</table>
</body>
</html>
"
