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


#$docdir  = "/afs/kloe.infn.it/www/pub/knote/";
$docdir  = "/afs/lnf.infn.it/project/www/kloe/pub/knote/";

$httpdir = "/kloe/pub/knote/";

#$docfil  = "/afs/kloe.infn.it/www/pub/knote/kn.list";
$docfil  = "/afs/lnf.infn.it/project/www/kloe/pub/knote/kn.list";

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

<HTML>
<HEAD>
<TITLE>List of KLOE Notes </TITLE>
</HEAD>
<BODY BGCOLOR=FFFFFF>
<P><CENTER><H1><FONT COLOR=0000AA>List of KLOE Notes </FONT></H1></CENTER>
[ <A  HREF = "/kloe/">KLOE Home</A>                 ]
[ <A  HREF = "#150">note n.150</A> ]
[ <A  HREF = "#175">note n.175</A> ]
[ <A  HREF = "#LAST">last note</A> ]


<P><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 = "kn" . $num ;
        $filepsgz=$docdir . $file . ".ps.gz" ;
        $fileps=$docdir . $file . ".ps" ;
        $filepdf=$docdir . $file . ".pdf" ;
        $filehtml=$docdir . $file . ".html" ;
        print "</PRE><B>";
        -e $filepsgz and print " <A HREF=$httpdir$file.ps.gz>$file.ps.gz</A>&nbsp;&nbsp;\n";
        -e $fileps and print " <A HREF=$httpdir$file.ps>$file.ps</A>&nbsp;&nbsp;\n";
        -e $filepdf and print " <A HREF=$httpdir$file.pdf>$file.pdf</A>&nbsp;&nbsp;\n";
        -e $filehtml and print " <A HREF=$httpdir$file.html>$file.html</A>&nbsp;&nbsp;\n";
        print "</B><PRE>";
	next LINE
	}

    print $line;
    }

close (FILE);


print <<EOF;
</PRE>
<ADDRESS> <A HREF=mailto:wwwkloe.lnf.infn.it>wwwkloe</A>  </ADDRESS>
</BODY>
</HTML>
EOF
