saransk 03.10.2011 02:47 tkabber

open(dd,"logs");

use constant{
tagname=>1,
paramname=>2,
parambody=>3,
cname=>4,
body=>5,
skiptag=>6,
skipbody=>7
};

$state=body;
$pos=0;
$name=0;

while(!eof(dd)){
$char=ord(getc(dd));

# print "".tell(dd).": ".chr($char)." = $state = $name = $pos\n";
if(tell(dd)>1200000){
die;
}

if($state==skiptag){
if($char==62){
$state=body;
$body="";
}
next;
}

if($state==skipbody){
if($char==60){
$state=tagname;
}
next;
}

if($state==body){

if($char==60){
if($tagname==4005250){
print "$nickname: $body\n";
}
$name=0;
$pos=0;
$state=tagname;
next;
} else {
$body.=chr($char);
}

}

if($state==tagname){
if($char<33){
$tagname=$name;
$state=paramname;
$name=0;
$pos=0;
next;
}

if($char==62){
$tagname=$name;
$state=body;
$body="";
next;
}

$name^=$char<<$pos;
$pos+=5;
if($pos>25){
$pos=0;
}

}

if($state==paramname){
#start CDATA here too<![CDATA[ ... ]]>
#if($name==cdata){ skip }
if($char<33){
next;
}
if($char==34||$char==39){
$state=parambody;
$endbody=$char;
next;
}

if($char==62){
$state=body;
next;
}

$name^=$char<<$pos;
$pos+=5;
if($pos>25){
$pos=0;
}

}

if($state==parambody){
if($char==92){
$isEsc=1;
next;
} else {
$isEsc=0;
}

if($char==$endbody){
if($isEsc==1){
$body.=chr($char);
} else {

if($name==65483302){
$nickname=$body;

}

$state=paramname;
$name=0;
$pos=0;
next;
}
}
$body.=chr($char);

}

}

Do you really want to delete ?