#!/usr/bin/perl
use CGI qw(param);

$word = param("word");

print "Content-type: text/html\n\n";
###############contents insert#########
system("cat ../elements/header");
@LIST=`/usr/local/e-cron/bin/job_errorstat | grep -v \"ERROR LIST\" | grep -v "No error" | grep -v "Notice:"| egrep \"$word\"| grep -v \"^If you want\"`;

unless(@LIST){

 unless($word){
    print "<h4>No jobnet error</h4>";
    print "</div>";
    system("cat ../elements/footer");
  exit 0
  }else{
    print "<h4>No search result</h4>";
    print "<a href=\"./errorstat.cgi\">back to jobnet error log</a><h6>";
    print "</div>";
    system("cat ../elements/footer");
    exit 0
  }
}

system("cat ../elements/search_errorstat");
print "<h6>Jobnet Error Log</h6>";
print "<pre>";
print @LIST;
print "</pre>";
print "</div>";
system("cat ../elements/footer");
