#!/usr/local/bin/perl require "/afs/cern.ch/project/cndoc/wwwasd/cgi-bin/asd.pl"; print "Content-type: text/html\n\n"; print "\n"; $report = $ENV{'PATH_INFO'}; $report =~ tr/\///; if ($report eq '') { &list_faqs } else { &print_faq } print "


"; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print ""; print "
"; print ""; print "Release Notes"; print "Known bugs"; print "FAQs"; print "Contributions"; print "Tutorial"; print "Reference manual"; print "Down load"; print "Miscellaneous
"; print "
$pawwm \n"; print "\n"; 1; sub list_faqs { print <<"EOM"; PAW Frequently Asked Questions

PAW Frequently Asked Questions


\n EOM # # print the 6th line of all files which reside in given directory # opendir (DIR, $pawfaqpath); local(@filenames) = readdir(DIR); closedir(DIR); if (@filenames > 2) { print "\n"; print "\n"; print "
\n"; print "
\n"; print "Search for a keyword: \n"; print "\n"; print "
\n"; print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } $nb = 0; $logp = 100000; $total = 0; $icol = 1; for (@filenames) { next if $_ eq '.'; next if $_ eq '..'; next if $_ eq ''; next if $_ eq 'pics'; next if $_ eq 'log'; $cur_file = $_; $logentry = "0"; $nb++; open (FAQFILE, "$pawfaqpath/$nb") || print "Could not open $_\n"; if (!open (LOGFILE, "$pawfaqpath/log/$nb")) { print "cannot open log \n"; } else { # Read 10 bytes from the logentry (should be enough to cover usage # of a faq entry as an integer read (LOGFILE, $logentry, 10); } $logentry = 0 + $logentry; $first_time = 0; while () { last if $first_time eq 1; $first_time = 1; $text = substr ($_, rindex($_, "Question: ", 0)+10); if ($logentry <= $logp) { if ( $icol == 1) { print "\n"; } if ( $icol == 2) { print "\n"; } if ( $icol == 3) { print "\n"; } print "\n"; print "\n"; } else { if ( $icol == 1) { print "\n"; } if ( $icol == 2) { print "\n"; } if ( $icol == 3) { print "\n"; } print "\n"; print "\n"; } $icol = $icol + 1; if ( $icol == 4) { $icol = 1; } $logp = $logentry; print "\n"; print "\n"; $total = $total+$logentry; $atime = (stat("$pawfaqpath/log/$cur_file"))[8]; $year = (gmtime($atime))[5]+1900; $month = (gmtime($atime))[4]+1; $day = (gmtime($atime))[3]; $hour = (gmtime($atime))[2]+1; $minute = (gmtime($atime))[1]; $second = (gmtime($atime))[0]; $date = sprintf("%2.2d/%2.2d/%4.4d",$day,$month,$year); $time = sprintf("%2.2d:%2.2d:%2.2d",$hour,$minute,$second); $today = `date +%D`; $todayday = substr($today, 3, 2); $todaymon = substr($today, 0, 2); $d = sprintf("%2.2d",$day); $m = sprintf("%2.2d",$month); if ( $todayday == $d && $todaymon == $m ) { print "\n"; } close (FAQFILE); if ($logentry > 0) { close (LOGFILE); } } print "
FAQ # Description Number of accesses Last access
$nb
$nb $text $logentry \n"; } else { print "\n"; } print "$date $time
\n"; $av = int($total / $nb); print "

\n"; print "\n"; print ""; print ""; print ""; print "
Number of FAQs $nb
Total number of accesses $total
Average number of accesses per FAQ $av
\n"; }