home *** CD-ROM | disk | FTP | other *** search
/ Collection of Hack-Phreak Scene Programs / cleanhpvac.zip / cleanhpvac / SATAN11.ZIP / PERL / STATUS.PL < prev    next >
Text File  |  1995-04-11  |  630b  |  33 lines

  1. #
  2. # Maintain time, date, satan status file and GUI feedback.
  3. #
  4.  
  5. require 'perllib/ctime.pl';
  6. require $SATAN_CF;
  7.  
  8. #
  9. # Convert to time of day.
  10. #
  11. sub hhmmss {
  12.     local($time) = @_;
  13.     local($sec, $min, $hour);
  14.     
  15.     ($sec, $min, $hour) = localtime($time);
  16.     return sprintf "%02d:%02d:%02d", "$hour", "$min", "$sec";
  17. }
  18.  
  19. sub update_status {
  20.     local($text) = @_;
  21.  
  22.     $now = &hhmmss(time());
  23.  
  24.     # GUI feedback.
  25.     print CLIENT "$now $text<br>\n" if $running_from_html;
  26.  
  27.     # Status file.
  28.     die "Can't open status file $status_file\n" 
  29.         unless open(STATUS, ">>$status_file");
  30.     print STATUS "$now $text\n";
  31.     close STATUS;
  32. }
  33.