#!/usr/local/bin/perl5
#
# Modifyed by F.Murtas 
# ======
#
# Date : 18-12-98
# ====


$docdir  = "/afs/kloe.infn.it/www/private/memos/";
$httpdir = "/kloe/private/memos/";
$docfil  = "/afs/kloe.infn.it/www/private/memos/km.list";

print <<EOF;
Content-type: text/html

<HTML>
<HEAD>
<TITLE>List of KLOE memos </TITLE>
</HEAD>
<BODY BGCOLOR=FFFFFF>
<P><CENTER><H1><FONT COLOR=0000AA>List of KLOE Memos </FONT></H1></CENTER>
<pre>
EOF


open(FILE,"<$docfil") or die "Can't open file $docfil \n";

LINE: while ($line=<FILE>){
    if($line =~ "!"){
	print "<HR>\n"; 
	next LINE
	}

    if($line =~ "No"){
#        ($F1,$F2,$num) = ($line =~ /^\s*(\S+)\s+(\S+)\s*(.*)/); 
        ($F1,$F2,$num) = ($line =~ /^\s*(\S+)\s+(\S+)\s*(\S+)/); 
        print "$line";
	next LINE
	}

    if($line =~ "Group  :"){
        print $line;
        $file ="km" . $num;
        $filepdf =$docdir . $file . ".pdf.gz" ;
        $fileps  =$docdir . $file . ".ps.gz" ;
        $filehtml=$docdir . $file . ".html" ;
        print "</PRE><B>";
        -e $filepdf  and print " <A HREF=$httpdir$file.pdf.gz>$file.pdf.gz</A>\n&nbsp;&nbsp;";
        -e $fileps   and print " <A HREF=$httpdir$file.ps.gz>$file.ps.gz</A>\n&nbsp;&nbsp;";
        -e $filehtml and print " <A HREF=$httpdir$file.html>$file.html</A>\n&nbsp;&nbsp;";
        print "</B><PRE>";
	next LINE
	}

    print $line;
    }

close (FILE);


print <<EOF;
</PRE><HR>
<ADDRESS> <A HREF=mailto:wwwkloe.lnf.infn.it>FM</A> 18-DEC-98 </ADDRESS>
</BODY>
</HTML>
EOF
