File: debug.mpi

package info (click to toggle)
madoka 4.2.3-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 960 kB
  • ctags: 45
  • sloc: perl: 1,006; makefile: 45; sh: 4
file content (42 lines) | stat: -rw-r--r-- 993 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# madoka 4.2 debug
#
# debug.mpi
#    Copyright(c)1998- cookie / The madoka project
#

&list_add($plugin_list, 'debug');

$log_name{'D'} = ['debug%M%D'];
$log_handle{'D'} = ['L2'];
$log_code{'D'} = [''];
$log_file{'D'} = [''];
$log_mode{'D'} = [0600];
$debug = 1;

sub cl_debug {
  (my $n, local $cl_no) = @_;
  if ($n eq '1' && $debug == 0) {
    $debug = 1;
    $log_handle{'D'} = ['L2'];
    $log_name{'D'} = ['debug%M%D'];
    $log_code{'D'} = [''];
    $log_mode{'D'} = [0600];
    &current_time;
    &log_open('D', 0);
    chmod(${log_mode{'D'}}[0], ${$log_file{'D'}}[0]);
    printf L2 "%04d/%02d/%02d %02d:%02d:%02d\n", $year, $mon, $mday, $hour, $min, $sec;
    close(L2);
  } elsif ($n eq '0' && $debug == 1) {
    $debug = 0;
    delete $log_handle{'D'};
    delete $log_name{'D'};
    delete $log_mode{'D'};
  }
  &send('cl', "NOTICE $us_nick :debug: $debug\n");
}
sub cl_print {
  my($com, $cl_no) = @_;
  my $pr = eval($com);
  &send('cl', "NOTICE $us_nick : $pr\n", $cl_no);
}