home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.madoka.org
/
2014.12.ftp.madoka.org.tar
/
ftp.madoka.org
/
pub
/
plum
/
plum2_33_1.lzh
/
module
/
log
/
server.plm
< prev
Wrap
Text File
|
1999-03-24
|
3KB
|
132 lines
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"><!-- $_ if 0; # -*- perl -*-
# $Id: server.plm,v 2.9 1999/01/17 02:36:07 hasegawa Exp $
# copyright (c)1997-1999 Yoshinori Hasegawa <hasegawa@madoka.org>
package log_server;
$DIRECTORY = '.';
$FILE = 'logserver';
$HEADER = '%H:%M';
$_ = 'log_server';
sub server_read {
local($serverno, $line) = @_;
&writelog($'userno[$serverno], $line);
return ($line);
}
sub writelog {
local($userno, $line) = @_;
local($file, $dir, $name, $code, $header, $mode);
$file = &'property($userno, 'file') || $FILE;
($name, $code) = &filename($file);
if ($name !~ /^[\\\/]/) {
$dir = &'expand(&'property($userno, 'directory') || $DIRECTORY);
$name = "$dir/$name";
}
$name = &'date($name);
$header = &'property($userno, 'header');
$header = $HEADER unless defined($header);
$header = &'date($header);
$line = &jis_code($line, $code) if $code;
if (!-e $name) {
if (open(FILE, ">$name")) {
close(FILE);
$mode = &'property($userno, 'mode');
if (defined($mode)) {
chmod(oct($mode), $name);
}
}
}
if (open(FILE, ">>$name")) {
print FILE $header, ' ', $line, "\n";
close(FILE);
}
}
sub filename {
local($file) = @_;
local($idx, $name, $code);
return ('', '') unless $file;
if (($idx = rindex($file, ';')) != -1) {
$name = substr($file, 0, $idx);
$code = substr($file, $idx + 1);
} else {
$name = $file;
$code = '';
}
return (&'expand($name), $code);
}
sub jis_code {
local($line, $list) = @_;
local($code);
$code = (split(/\,/, "\L$list\E"))[0];
if ($code eq 'euc') {
$line = &'jis_euc($line);
} elsif ($code eq 'jis') {
$line = &'jis_jis($line);
} elsif ($code eq 'sjis') {
$line = &'jis_sjis($line);
}
return $line;
}
__END__
--><HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-2022-JP">
<LINK REV="made" HREF="mailto:hasegawa@madoka.org">
<TITLE>log/server.plm</TITLE></HEAD><BODY>
$B%*%s%i%$%s%I%-%e%a%s%H(B
<HR><H3>$BL>A0(B</H3>
log/server.plm - $B%5!<%P$+$i$NF~NO$r%m%0$H$7$FJ]B8$9$k(B
<HR><H3>$B@bL@(B</H3>
$B%5!<%P$+$i$NF~NO$r$9$Y$F%m%0$KJ]B8$7$^$9!#(B
<HR><H3>$B%W%m%Q%F%#(B</H3>
<DL>
<DT> log.server.directory $B%G%#%l%/%H%j(B
</DT>
<DD> $B%m%0$rJ]B8$9$k%G%#%l%/%H%j$r;XDj$7$^$9!#(B
$B%G%U%)%k%H$G$O%+%l%s%H%G%#%l%/%H%j$KJ]B8$7$^$9!#(B
</DD>
<DT> log.server.file $B%U%!%$%kL>(B
</DT>
<DD> $B%m%0$N%U%!%$%kL>$r;XDj$7$^$9!#(B
%$B$G$O$8$^$kJ8;z$,$"$k$H!"BP1~$9$kF|IU$KJQ49$5$l$^$9!#(B
$B%G%U%)%k%H$G$O!V(Blogserver$B!W$H$$$&%U%!%$%k$KJ]B8$7$^$9!#(B
</DD>
<DT> log.server.header $B$X%C%@(B
</DT>
<DD> $B%m%0$K=PNO$9$k;~9o$N%U%)!<%^%C%H$r;XDj$7$^$9!#(B
%$B$G$O$8$^$kJ8;z$,$"$k$H!"BP1~$9$k;~4V$KJQ49$5$l$^$9!#(B
</DD>
<DT> log.server.mode $B%U%!%$%k%b!<%I(B
</DT>
<DD> $B%m%0$N%U%!%$%k%b!<%I$r;XDj$7$^$9!#(B
</DD>
</DL>
<HR><H3>$B@_DjNc(B</H3>
<PRE>
+ log/server.plm
log.server.file: server%Y%m%d
</PRE>
$B%5!<%P$+$i$NF~NO$r!V(Bserver%m%d$B!W$KJ]B8$7$^$9!#(B
$B!V(B%Y$B!W!"!V(B%m$B!W!"!V(B%d$B!W$O$=$l$>$l8=:_$NG/!"7n!"F|$KJQ49$5$l$^$9!#(B
</BODY></HTML>