560 lines
50 KiB
HTML
Executable File
560 lines
50 KiB
HTML
Executable File
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="generator" content="TempleOS V5.03">
|
|
<meta name="viewport" content="width=device-width">
|
|
<link rel="stylesheet" href="/style/templeos.css">
|
|
<script src="/script/templeos.js"></script>
|
|
<style type="text/css">
|
|
.cF0{color:#000000;background-color:#ffffff;}
|
|
.cF1{color:#0000aa;background-color:#ffffff;}
|
|
.cF2{color:#00aa00;background-color:#ffffff;}
|
|
.cF3{color:#00aaaa;background-color:#ffffff;}
|
|
.cF4{color:#aa0000;background-color:#ffffff;}
|
|
.cF5{color:#aa00aa;background-color:#ffffff;}
|
|
.cF6{color:#aa5500;background-color:#ffffff;}
|
|
.cF7{color:#aaaaaa;background-color:#ffffff;}
|
|
.cF8{color:#555555;background-color:#ffffff;}
|
|
.cF9{color:#5555ff;background-color:#ffffff;}
|
|
.cFA{color:#55ff55;background-color:#ffffff;}
|
|
.cFB{color:#55ffff;background-color:#ffffff;}
|
|
.cFC{color:#ff5555;background-color:#ffffff;}
|
|
.cFD{color:#ff55ff;background-color:#ffffff;}
|
|
.cFE{color:#ffff55;background-color:#ffffff;}
|
|
.cFF{color:#ffffff;background-color:#ffffff;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre id="content">
|
|
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> DOWNLOAD_FILE1 </span><span class=cF6>"TOS_Distro.ISO"</span><span class=cF0>
|
|
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> DOWNLOAD_FILE1_SIZE 16000000
|
|
<a name="l3"></a>
|
|
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> HOURS_MAX (24*3)
|
|
<a name="l5"></a>
|
|
<a name="l6"></a></span><span class=cF1>class</span><span class=cF0> LogStruct
|
|
<a name="l7"></a>{
|
|
<a name="l8"></a> LogStruct *next,*last;
|
|
<a name="l9"></a> LogStruct *ip_num_left,*ip_num_right;
|
|
<a name="l10"></a> </span><span class=cF9>U32</span><span class=cF0> ip_num,code;
|
|
<a name="l11"></a> </span><span class=cF9>I64</span><span class=cF0> size;
|
|
<a name="l12"></a> </span><span class=cF1>U8</span><span class=cF0> *file,*link;
|
|
<a name="l13"></a> </span><span class=cF9>CDate</span><span class=cF0> datetime;
|
|
<a name="l14"></a>};
|
|
<a name="l15"></a>
|
|
<a name="l16"></a></span><span class=cF1>class</span><span class=cF0> LinkStruct
|
|
<a name="l17"></a>{
|
|
<a name="l18"></a> LinkStruct *left,*right;
|
|
<a name="l19"></a> </span><span class=cF1>U8</span><span class=cF0> *link,*file;
|
|
<a name="l20"></a> </span><span class=cF9>I64</span><span class=cF0> cnt;
|
|
<a name="l21"></a>};
|
|
<a name="l22"></a>
|
|
<a name="l23"></a></span><span class=cF1>class</span><span class=cF0> BlockedStruct
|
|
<a name="l24"></a>{
|
|
<a name="l25"></a> BlockedStruct *next,*last;
|
|
<a name="l26"></a> </span><span class=cF9>U32</span><span class=cF0> ip_num;
|
|
<a name="l27"></a>};
|
|
<a name="l28"></a>
|
|
<a name="l29"></a></span><span class=cF1>U0</span><span class=cF0> LogStructDel(LogStruct *tmplg)
|
|
<a name="l30"></a>{
|
|
<a name="l31"></a> </span><span class=cF5>Free</span><span class=cF0>(tmplg->file);
|
|
<a name="l32"></a> </span><span class=cF5>Free</span><span class=cF0>(tmplg->link);
|
|
<a name="l33"></a> </span><span class=cF5>Free</span><span class=cF0>(tmplg);
|
|
<a name="l34"></a>}
|
|
<a name="l35"></a>
|
|
<a name="l36"></a></span><span class=cF1>U0</span><span class=cF0> PrsSingleLogFile(LogStruct *head,</span><span class=cF1>U8</span><span class=cF0> *name,</span><span class=cF9>CDate</span><span class=cF0> *_dstart,</span><span class=cF9>CDate</span><span class=cF0> *_dend)
|
|
<a name="l37"></a>{
|
|
<a name="l38"></a> </span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF5>DocRead</span><span class=cF0>(name,
|
|
<a name="l39"></a> </span><span class=cF3>DOCF_PLAIN_TEXT_TABS</span><span class=cF0>|</span><span class=cF3>DOCF_DBL_DOLLARS</span><span class=cF0>|</span><span class=cF3>DOCF_NO_CURSOR</span><span class=cF0>);
|
|
<a name="l40"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e=doc->head.next;
|
|
<a name="l41"></a> </span><span class=cF1>U8</span><span class=cF0> *src,*src2,*mon_lst=</span><span class=cF5>Define</span><span class=cF0>(</span><span class=cF6>"ST_MONTHS"</span><span class=cF0>);
|
|
<a name="l42"></a> LogStruct *tmplg;
|
|
<a name="l43"></a> </span><span class=cF9>CDateStruct</span><span class=cF0> ds;
|
|
<a name="l44"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l45"></a> </span><span class=cF6>"%$Q\n"</span><span class=cF0>,name;
|
|
<a name="l46"></a> </span><span class=cF1>while</span><span class=cF0> (doc_e!=doc) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e->type_u8==</span><span class=cF3>DOCT_TEXT</span><span class=cF0>) {
|
|
<a name="l48"></a> tmplg=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>LogStruct</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l49"></a> </span><span class=cF1>try</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l50"></a> src=doc_e->tag;
|
|
<a name="l51"></a> tmplg->ip_num.u8[3]=</span><span class=cF5>Str2I64</span><span class=cF0>(src,10,&src);
|
|
<a name="l52"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF6>'.'</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l53"></a> tmplg->ip_num.u8[2]=</span><span class=cF5>Str2I64</span><span class=cF0>(src,10,&src);
|
|
<a name="l54"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF6>'.'</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l55"></a> tmplg->ip_num.u8[1]=</span><span class=cF5>Str2I64</span><span class=cF0>(src,10,&src);
|
|
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF6>'.'</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l57"></a> tmplg->ip_num.u8[0]=</span><span class=cF5>Str2I64</span><span class=cF0>(src,10,&src);
|
|
<a name="l58"></a>
|
|
<a name="l59"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!*src) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l60"></a> </span><span class=cF1>while</span><span class=cF0> (*src++!=</span><span class=cF6>'['</span><span class=cF0>);
|
|
<a name="l61"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&ds,0,</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDateStruct</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l62"></a> ds.day_of_mon=</span><span class=cF5>Str2I64</span><span class=cF0>(src,10,&src);
|
|
<a name="l63"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF6>'/'</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l64"></a> src2=src;
|
|
<a name="l65"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!*src2) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l66"></a> </span><span class=cF1>while</span><span class=cF0> (*src2++!=</span><span class=cF6>'/'</span><span class=cF0>);
|
|
<a name="l67"></a> * --src2=0;
|
|
<a name="l68"></a> ds.mon=1+</span><span class=cF5>LstMatch</span><span class=cF0>(src,mon_lst,</span><span class=cF3>LMF_IGNORE_CASE</span><span class=cF0>);
|
|
<a name="l69"></a> src=++src2;
|
|
<a name="l70"></a> ds.year=</span><span class=cF5>Str2I64</span><span class=cF0>(src,10,&src);
|
|
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF6>':'</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l72"></a> ds.hour=</span><span class=cF5>Str2I64</span><span class=cF0>(src,10,&src);
|
|
<a name="l73"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF6>':'</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l74"></a> ds.min=</span><span class=cF5>Str2I64</span><span class=cF0>(src,10,&src);
|
|
<a name="l75"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF6>':'</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l76"></a> ds.sec=</span><span class=cF5>Str2I64</span><span class=cF0>(src,10,&src);
|
|
<a name="l77"></a> tmplg->datetime=</span><span class=cF5>Struct2Date</span><span class=cF0>(&ds);
|
|
<a name="l78"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF3>CH_SPACE</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l79"></a> i=</span><span class=cF5>Str2I64</span><span class=cF0>(src,10,&src);
|
|
<a name="l80"></a> tmplg->datetime-=(i/100+i%100/60.0)*</span><span class=cF3>CDATE_FREQ</span><span class=cF0>*60*60;
|
|
<a name="l81"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF5>Str2Date</span><span class=cF0>(</span><span class=cF6>"1/1/2017"</span><span class=cF0>)<=tmplg->datetime<</span><span class=cF5>Str2Date</span><span class=cF0>(</span><span class=cF6>"1/1/2050"</span><span class=cF0>)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l82"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l83"></a> </span><span class=cF1>if</span><span class=cF0> (tmplg->datetime<*_dstart) *_dstart=tmplg->datetime;
|
|
<a name="l84"></a> </span><span class=cF1>if</span><span class=cF0> (tmplg->datetime>*_dend) *_dend =tmplg->datetime;
|
|
<a name="l85"></a>
|
|
<a name="l86"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!*src) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l87"></a> </span><span class=cF1>while</span><span class=cF0> (*src++!=</span><span class=cF6>']'</span><span class=cF0>);
|
|
<a name="l88"></a>
|
|
<a name="l89"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF3>CH_SPACE</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l90"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF6>'\"'</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l91"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrNCmp</span><span class=cF7>(</span><span class=cF0>src,</span><span class=cF6>"GET "</span><span class=cF0>,4</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l92"></a> src2=src+=4;
|
|
<a name="l93"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!*src2) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l94"></a> </span><span class=cF1>while</span><span class=cF0> (*src2++!=</span><span class=cF3>CH_SPACE</span><span class=cF0>);
|
|
<a name="l95"></a> * --src2=0;
|
|
<a name="l96"></a> tmplg->file=</span><span class=cF5>StrNew</span><span class=cF0>(src);
|
|
<a name="l97"></a> src=++src2;
|
|
<a name="l98"></a>
|
|
<a name="l99"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!*src) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l100"></a> </span><span class=cF1>while</span><span class=cF0> (*src++!=</span><span class=cF6>'\"'</span><span class=cF0>);
|
|
<a name="l101"></a>
|
|
<a name="l102"></a> tmplg->code=</span><span class=cF5>Str2I64</span><span class=cF0>(src,10,&src);
|
|
<a name="l103"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF3>CH_SPACE</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l104"></a> tmplg->size=</span><span class=cF5>Str2I64</span><span class=cF0>(src,10,&src);
|
|
<a name="l105"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF3>CH_SPACE</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l106"></a>
|
|
<a name="l107"></a> </span><span class=cF1>if</span><span class=cF0> (*src++!=</span><span class=cF6>'\"'</span><span class=cF0>) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l108"></a> src2=src;
|
|
<a name="l109"></a> </span><span class=cF1>do</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!*src2) </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l110"></a> </span><span class=cF1>while</span><span class=cF0> (*src2++!=</span><span class=cF6>'\"'</span><span class=cF0>);
|
|
<a name="l111"></a> * --src2=0;
|
|
<a name="l112"></a> tmplg->link=</span><span class=cF5>StrNew</span><span class=cF0>(src);
|
|
<a name="l113"></a> src=++src2;
|
|
<a name="l114"></a>
|
|
<a name="l115"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmplg,head->last);
|
|
<a name="l116"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrNCmp</span><span class=cF7>(</span><span class=cF0>src,</span><span class=cF6>"HEAD "</span><span class=cF0>,5</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l117"></a> LogStructDel(tmplg);
|
|
<a name="l118"></a> } </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l119"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l120"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>catch</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l121"></a> </span><span class=cF5>Fs</span><span class=cF0>->catch_except=</span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l122"></a> </span><span class=cF6>"%$Q\n"</span><span class=cF0>,doc_e->tag;
|
|
<a name="l123"></a> LogStructDel(tmplg);
|
|
<a name="l124"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l125"></a> }
|
|
<a name="l126"></a> doc_e=doc_e->next;
|
|
<a name="l127"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l128"></a> </span><span class=cF5>DocDel</span><span class=cF0>(doc);
|
|
<a name="l129"></a>}
|
|
<a name="l130"></a>
|
|
<a name="l131"></a>LogStruct *PrsLogFiles(</span><span class=cF1>U8</span><span class=cF0> *files_find_mask,</span><span class=cF9>CDate</span><span class=cF0> *_dstart,</span><span class=cF9>CDate</span><span class=cF0> *_dend)
|
|
<a name="l132"></a>{
|
|
<a name="l133"></a> LogStruct *head=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>LogStruct</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l134"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde=</span><span class=cF5>FilesFind</span><span class=cF0>(files_find_mask),*tmpde1=tmpde;
|
|
<a name="l135"></a> </span><span class=cF5>QueInit</span><span class=cF0>(head);
|
|
<a name="l136"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l137"></a> PrsSingleLogFile(head,tmpde->full_name,_dstart,_dend);
|
|
<a name="l138"></a> tmpde=tmpde->next;
|
|
<a name="l139"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l140"></a> </span><span class=cF5>DirTreeDel</span><span class=cF0>(tmpde1);
|
|
<a name="l141"></a> </span><span class=cF1>return</span><span class=cF0> head;
|
|
<a name="l142"></a>}
|
|
<a name="l143"></a>
|
|
<a name="l144"></a></span><span class=cF1>U0</span><span class=cF0> LogLstDel(LogStruct *head)
|
|
<a name="l145"></a>{
|
|
<a name="l146"></a> LogStruct *tmplg=head->next,*tmplg1;
|
|
<a name="l147"></a> </span><span class=cF1>while</span><span class=cF0> (tmplg!=head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l148"></a> tmplg1=tmplg->next;
|
|
<a name="l149"></a> LogStructDel(tmplg);
|
|
<a name="l150"></a> tmplg=tmplg1;
|
|
<a name="l151"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l152"></a>}
|
|
<a name="l153"></a>
|
|
<a name="l154"></a></span><span class=cF1>U0</span><span class=cF0> BlockedStructAdd(BlockedStruct *head,</span><span class=cF9>U32</span><span class=cF0> ip_num)
|
|
<a name="l155"></a>{
|
|
<a name="l156"></a> BlockedStruct *tmpb=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>BlockedStruct</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l157"></a> tmpb->ip_num=ip_num;
|
|
<a name="l158"></a> </span><span class=cF5>QueIns</span><span class=cF0>(tmpb,head->last);
|
|
<a name="l159"></a>}
|
|
<a name="l160"></a>
|
|
<a name="l161"></a></span><span class=cF1>Bool</span><span class=cF0> IsBlocked(BlockedStruct *head,</span><span class=cF9>U32</span><span class=cF0> ip_num)
|
|
<a name="l162"></a>{
|
|
<a name="l163"></a> BlockedStruct *tmpb=head->next;
|
|
<a name="l164"></a> </span><span class=cF1>while</span><span class=cF0> (tmpb!=head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l165"></a> </span><span class=cF1>if</span><span class=cF0> (tmpb->ip_num==ip_num)
|
|
<a name="l166"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l167"></a> tmpb=tmpb->next;
|
|
<a name="l168"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l169"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l170"></a>}
|
|
<a name="l171"></a>
|
|
<a name="l172"></a></span><span class=cF1>U0</span><span class=cF0> BlockIPNuip(LogStruct *head)
|
|
<a name="l173"></a>{
|
|
<a name="l174"></a> BlockedStruct blocked_head;
|
|
<a name="l175"></a> LogStruct *tmplg=head->next,*tmplg1;
|
|
<a name="l176"></a>
|
|
<a name="l177"></a> </span><span class=cF5>QueInit</span><span class=cF0>(&blocked_head);
|
|
<a name="l178"></a>
|
|
<a name="l179"></a> BlockedStructAdd(&blocked_head,68<<24+227<<16+61<<8+6);
|
|
<a name="l180"></a>
|
|
<a name="l181"></a> </span><span class=cF2>//pass 1: collect robot lst</span><span class=cF0>
|
|
<a name="l182"></a> </span><span class=cF1>while</span><span class=cF0> (tmplg!=head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l183"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrIMatch</span><span class=cF7>(</span><span class=cF6>"ROBOT"</span><span class=cF0>,tmplg->file</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l184"></a> !IsBlocked</span><span class=cF7>(</span><span class=cF0>&blocked_head,tmplg->ip_num</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l185"></a> BlockedStructAdd(&blocked_head,tmplg->ip_num);
|
|
<a name="l186"></a> tmplg=tmplg->next;
|
|
<a name="l187"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l188"></a>
|
|
<a name="l189"></a> </span><span class=cF2>//pass 2: removed blocked ip_nuip</span><span class=cF0>
|
|
<a name="l190"></a> tmplg=head->next;
|
|
<a name="l191"></a> </span><span class=cF1>while</span><span class=cF0> (tmplg!=head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l192"></a> tmplg1=tmplg->next;
|
|
<a name="l193"></a> </span><span class=cF1>if</span><span class=cF0> (IsBlocked</span><span class=cF7>(</span><span class=cF0>&blocked_head,tmplg->ip_num</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l194"></a> </span><span class=cF5>QueRem</span><span class=cF0>(tmplg);
|
|
<a name="l195"></a> LogStructDel(tmplg);
|
|
<a name="l196"></a> }
|
|
<a name="l197"></a> tmplg=tmplg1;
|
|
<a name="l198"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l199"></a>
|
|
<a name="l200"></a> </span><span class=cF5>QueDel</span><span class=cF0>(&blocked_head);
|
|
<a name="l201"></a>}
|
|
<a name="l202"></a>
|
|
<a name="l203"></a></span><span class=cF1>Bool</span><span class=cF0> IsDownLoad(LogStruct *tmplg)
|
|
<a name="l204"></a>{
|
|
<a name="l205"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrMatch</span><span class=cF7>(</span><span class=cF0>DOWNLOAD_FILE1,tmplg->file</span><span class=cF7>)</span><span class=cF0>&&tmplg->size>=
|
|
<a name="l206"></a> DOWNLOAD_FILE1_SIZE)
|
|
<a name="l207"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l208"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l209"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l210"></a>}
|
|
<a name="l211"></a>
|
|
<a name="l212"></a></span><span class=cF1>Bool</span><span class=cF0> IsIndex(LogStruct *tmplg)
|
|
<a name="l213"></a>{
|
|
<a name="l214"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>tmplg->file,</span><span class=cF6>"/index.html"</span><span class=cF7>)</span><span class=cF0> || !</span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>tmplg->file,</span><span class=cF6>"/"</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l215"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l216"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l217"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l218"></a>}
|
|
<a name="l219"></a>
|
|
<a name="l220"></a></span><span class=cF1>Bool</span><span class=cF0> IsKeeper(LogStruct *tmplg,</span><span class=cF9>CDate</span><span class=cF0> dstart,</span><span class=cF9>CDate</span><span class=cF0> dend)
|
|
<a name="l221"></a>{
|
|
<a name="l222"></a> </span><span class=cF1>if</span><span class=cF0> (dstart<=tmplg->datetime<=dend && !</span><span class=cF5>StrOcc</span><span class=cF7>(</span><span class=cF0>tmplg->file,</span><span class=cF6>'?'</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l223"></a> </span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>tmplg->file</span><span class=cF7>)</span><span class=cF0>>2 && </span><span class=cF6>'A'</span><span class=cF0><=tmplg->file[1]<=</span><span class=cF6>'Z'</span><span class=cF0> &&
|
|
<a name="l224"></a> tmplg->size && tmplg->file[</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>tmplg->file</span><span class=cF7>)</span><span class=cF0>-1]!=</span><span class=cF6>'/'</span><span class=cF0> &&
|
|
<a name="l225"></a> </span><span class=cF7>(</span><span class=cF5>StrLen</span><span class=cF0>(tmplg->file)<3 || </span><span class=cF5>MemCmp</span><span class=cF0>(&tmplg->file[1],</span><span class=cF6>"Wb"</span><span class=cF0>,2)</span><span class=cF7>)</span><span class=cF0> &&
|
|
<a name="l226"></a> </span><span class=cF7>(</span><span class=cF5>StrLen</span><span class=cF0>(tmplg->file)<7 || </span><span class=cF5>MemCmp</span><span class=cF0>(&tmplg->file[1],</span><span class=cF6>"Family"</span><span class=cF0>,6)</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l227"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l228"></a>
|
|
<a name="l229"></a></span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l230"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l231"></a>}
|
|
<a name="l232"></a>
|
|
<a name="l233"></a></span><span class=cF1>Bool</span><span class=cF0> IPNumTreeAdd(LogStruct **_head,LogStruct *tmplg)
|
|
<a name="l234"></a>{
|
|
<a name="l235"></a> LogStruct *head;
|
|
<a name="l236"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>UnusedStk</span><span class=cF0><0x200) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l237"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Stk Overflow"</span><span class=cF0>);
|
|
<a name="l238"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l239"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l240"></a> </span><span class=cF1>if</span><span class=cF0> (head=*_head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l241"></a> </span><span class=cF1>if</span><span class=cF0> (tmplg->ip_num==head->ip_num)
|
|
<a name="l242"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l243"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (tmplg->ip_num<head->ip_num)
|
|
<a name="l244"></a> </span><span class=cF1>return</span><span class=cF0> IPNumTreeAdd(&head->ip_num_left,tmplg);
|
|
<a name="l245"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l246"></a> </span><span class=cF1>return</span><span class=cF0> IPNumTreeAdd(&head->ip_num_right,tmplg);
|
|
<a name="l247"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l248"></a> tmplg->ip_num_left=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l249"></a> tmplg->ip_num_right=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l250"></a> *_head=tmplg;
|
|
<a name="l251"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l252"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l253"></a>}
|
|
<a name="l254"></a>
|
|
<a name="l255"></a></span><span class=cF1>U0</span><span class=cF0> LinkTreeAdd(LinkStruct **_root,LogStruct *tmplg)
|
|
<a name="l256"></a>{
|
|
<a name="l257"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l258"></a> LinkStruct *root,*tmplk;
|
|
<a name="l259"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>UnusedStk</span><span class=cF0><0x200) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l260"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Stk Overflow"</span><span class=cF0>);
|
|
<a name="l261"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l262"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l263"></a> </span><span class=cF1>if</span><span class=cF0> (root=*_root) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l264"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>i=</span><span class=cF5>StrCmp</span><span class=cF0>(tmplg->link,root->link)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l265"></a> root->cnt++;
|
|
<a name="l266"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i<0)
|
|
<a name="l267"></a> LinkTreeAdd(&root->left,tmplg);
|
|
<a name="l268"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l269"></a> LinkTreeAdd(&root->right,tmplg);
|
|
<a name="l270"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l271"></a> tmplk=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>LinkStruct</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l272"></a> tmplk->link=tmplg->link;
|
|
<a name="l273"></a> tmplk->cnt=1;
|
|
<a name="l274"></a> *_root=tmplk;
|
|
<a name="l275"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l276"></a>}
|
|
<a name="l277"></a>
|
|
<a name="l278"></a></span><span class=cF1>U0</span><span class=cF0> FileTreeAdd(LinkStruct **_root,LogStruct *tmplg)
|
|
<a name="l279"></a>{
|
|
<a name="l280"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
|
<a name="l281"></a> LinkStruct *root,*tmplk;
|
|
<a name="l282"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>UnusedStk</span><span class=cF0><0x200) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l283"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Stk Overflow"</span><span class=cF0>);
|
|
<a name="l284"></a> </span><span class=cF5>throw</span><span class=cF0>;
|
|
<a name="l285"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l286"></a> </span><span class=cF1>if</span><span class=cF0> (root=*_root) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l287"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>i=</span><span class=cF5>StrCmp</span><span class=cF0>(tmplg->file,root->file)</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l288"></a> root->cnt++;
|
|
<a name="l289"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (i<0)
|
|
<a name="l290"></a> FileTreeAdd(&root->left,tmplg);
|
|
<a name="l291"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l292"></a> FileTreeAdd(&root->right,tmplg);
|
|
<a name="l293"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l294"></a> tmplk=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>LinkStruct</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l295"></a> tmplk->file=tmplg->file;
|
|
<a name="l296"></a> tmplk->cnt=1;
|
|
<a name="l297"></a> *_root=tmplk;
|
|
<a name="l298"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l299"></a>}
|
|
<a name="l300"></a>
|
|
<a name="l301"></a></span><span class=cF1>U0</span><span class=cF0> LinkTreeDel(LinkStruct *root)
|
|
<a name="l302"></a>{
|
|
<a name="l303"></a> </span><span class=cF1>if</span><span class=cF0> (root) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l304"></a> LinkTreeDel(root->left);
|
|
<a name="l305"></a> LinkTreeDel(root->right);
|
|
<a name="l306"></a> </span><span class=cF5>Free</span><span class=cF0>(root);
|
|
<a name="l307"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l308"></a>}
|
|
<a name="l309"></a>
|
|
<a name="l310"></a></span><span class=cF1>U0</span><span class=cF0> LinkTreeTraverse(LinkStruct *root)
|
|
<a name="l311"></a>{
|
|
<a name="l312"></a> </span><span class=cF1>if</span><span class=cF0> (root) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l313"></a> LinkTreeTraverse(root->left);
|
|
<a name="l314"></a> </span><span class=cF6>"%3d:%$Q\n"</span><span class=cF0>,root->cnt,root->link;
|
|
<a name="l315"></a> LinkTreeTraverse(root->right);
|
|
<a name="l316"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l317"></a>}
|
|
<a name="l318"></a>
|
|
<a name="l319"></a></span><span class=cF1>U0</span><span class=cF0> FileTreeDel(LinkStruct *root)
|
|
<a name="l320"></a>{
|
|
<a name="l321"></a> </span><span class=cF1>if</span><span class=cF0> (root) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l322"></a> FileTreeDel(root->left);
|
|
<a name="l323"></a> FileTreeDel(root->right);
|
|
<a name="l324"></a> </span><span class=cF5>Free</span><span class=cF0>(root);
|
|
<a name="l325"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l326"></a>}
|
|
<a name="l327"></a>
|
|
<a name="l328"></a></span><span class=cF1>U0</span><span class=cF0> FileTreeTraverse(LinkStruct *root)
|
|
<a name="l329"></a>{
|
|
<a name="l330"></a> </span><span class=cF1>if</span><span class=cF0> (root) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l331"></a> FileTreeTraverse(root->left);
|
|
<a name="l332"></a> </span><span class=cF6>"%3d:%$Q\n"</span><span class=cF0>,root->cnt,root->file;
|
|
<a name="l333"></a> FileTreeTraverse(root->right);
|
|
<a name="l334"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l335"></a>}
|
|
<a name="l336"></a>
|
|
<a name="l337"></a></span><span class=cF1>U0</span><span class=cF0> DownLoadRep(LogStruct *head,</span><span class=cF9>CDate</span><span class=cF0> dstart,</span><span class=cF9>CDate</span><span class=cF0> dend)
|
|
<a name="l338"></a>{
|
|
<a name="l339"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,cnt,dups,
|
|
<a name="l340"></a> hours_start,hours_end,*hour_cnts,*dup_cnts,
|
|
<a name="l341"></a> days_start,days_end,*day_cnts,*day_dup_cnts;
|
|
<a name="l342"></a> LogStruct *tmplg=head->next,*dup_head=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l343"></a> LinkStruct *link_root=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l344"></a> </span><span class=cF9>CDateStruct</span><span class=cF0> ds;
|
|
<a name="l345"></a>
|
|
<a name="l346"></a> i=dstart*24;hours_start=i.u32[1];
|
|
<a name="l347"></a> i=dend *24;hours_end =i.u32[1];
|
|
<a name="l348"></a>
|
|
<a name="l349"></a> days_start=(dstart+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32;
|
|
<a name="l350"></a> days_end =(dend+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32;
|
|
<a name="l351"></a>
|
|
<a name="l352"></a> hour_cnts=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>hours_end-hours_start+1</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l353"></a> dup_cnts =</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>hours_end-hours_start+1</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l354"></a> day_cnts =</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>days_end-days_start+1</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l355"></a> day_dup_cnts=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>days_end-days_start+1</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l356"></a> dups=cnt=0;
|
|
<a name="l357"></a> </span><span class=cF1>while</span><span class=cF0> (tmplg!=head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l358"></a> </span><span class=cF1>if</span><span class=cF0> (IsKeeper</span><span class=cF7>(</span><span class=cF0>tmplg,dstart,dend</span><span class=cF7>)</span><span class=cF0> && IsDownLoad</span><span class=cF7>(</span><span class=cF0>tmplg</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l359"></a> i=tmplg->datetime*24;
|
|
<a name="l360"></a> hour_cnts[i.u32[1]-hours_start]++;
|
|
<a name="l361"></a> day_cnts[(tmplg->datetime+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32-days_start]++;
|
|
<a name="l362"></a> cnt++;
|
|
<a name="l363"></a> </span><span class=cF1>if</span><span class=cF0> (IPNumTreeAdd</span><span class=cF7>(</span><span class=cF0>&dup_head,tmplg</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l364"></a> day_dup_cnts[(tmplg->datetime+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32-days_start]++;
|
|
<a name="l365"></a> dup_cnts[i.u32[1]-hours_start]++;
|
|
<a name="l366"></a> dups++;
|
|
<a name="l367"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l368"></a> LinkTreeAdd(&link_root,tmplg);
|
|
<a name="l369"></a> }
|
|
<a name="l370"></a> tmplg=tmplg->next;
|
|
<a name="l371"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l372"></a>
|
|
<a name="l373"></a> </span><span class=cF6>"\n\nDownloads of /TOS_Distro.ISO\n"</span><span class=cF0>;
|
|
<a name="l374"></a> </span><span class=cF1>for</span><span class=cF0> (i=dstart;i<=dend;i+=1<<32)
|
|
<a name="l375"></a> </span><span class=cF6>"%D Dups:%5d Total:%5d Uniques:%5d\n"</span><span class=cF0>,i,
|
|
<a name="l376"></a> day_dup_cnts[(i+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32-days_start],
|
|
<a name="l377"></a> day_cnts[(i+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32-days_start],
|
|
<a name="l378"></a> day_cnts[(i+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32-days_start]-
|
|
<a name="l379"></a> day_dup_cnts[(i+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32-days_start];
|
|
<a name="l380"></a>
|
|
<a name="l381"></a> </span><span class=cF6>"\n\nDownloads of /TOS_Distro.ISO\n"</span><span class=cF0>
|
|
<a name="l382"></a> </span><span class=cF6>"'-' is a dup. '+' is not a dup.\n"</span><span class=cF0>;
|
|
<a name="l383"></a> </span><span class=cF1>if</span><span class=cF0> (hours_end-hours_start>=HOURS_MAX)
|
|
<a name="l384"></a> i=hours_end-HOURS_MAX+1;
|
|
<a name="l385"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l386"></a> i=hours_start;
|
|
<a name="l387"></a> </span><span class=cF1>for</span><span class=cF0> (;i<=hours_end;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l388"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(&ds,i<<32/24+</span><span class=cFB>local_time_offset</span><span class=cF0>);
|
|
<a name="l389"></a> </span><span class=cF6>"%D %02d: "</span><span class=cF0>,i<<32/24,ds.hour;
|
|
<a name="l390"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j<dup_cnts[i-hours_start];j++)
|
|
<a name="l391"></a> </span><span class=cF6>'-'</span><span class=cF0>;
|
|
<a name="l392"></a> </span><span class=cF1>for</span><span class=cF0> (;j<hour_cnts[i-hours_start];j++)
|
|
<a name="l393"></a> </span><span class=cF6>'+'</span><span class=cF0>;
|
|
<a name="l394"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l395"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l396"></a> </span><span class=cF6>"Total:%d Dups:%d Uniques:%d\n"</span><span class=cF0>,cnt,dups,cnt-dups;
|
|
<a name="l397"></a>
|
|
<a name="l398"></a> </span><span class=cF6>"\n\nDownloads of /TOS_Distro.ISO\n"</span><span class=cF0>;
|
|
<a name="l399"></a> LinkTreeTraverse(link_root);
|
|
<a name="l400"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l401"></a>
|
|
<a name="l402"></a> LinkTreeDel(link_root);
|
|
<a name="l403"></a> </span><span class=cF5>Free</span><span class=cF0>(hour_cnts);
|
|
<a name="l404"></a> </span><span class=cF5>Free</span><span class=cF0>(dup_cnts);
|
|
<a name="l405"></a> </span><span class=cF5>Free</span><span class=cF0>(day_cnts);
|
|
<a name="l406"></a> </span><span class=cF5>Free</span><span class=cF0>(day_dup_cnts);
|
|
<a name="l407"></a>}
|
|
<a name="l408"></a>
|
|
<a name="l409"></a></span><span class=cF1>U0</span><span class=cF0> FileRep(LogStruct *head,</span><span class=cF9>CDate</span><span class=cF0> dstart,</span><span class=cF9>CDate</span><span class=cF0> dend)
|
|
<a name="l410"></a>{
|
|
<a name="l411"></a> LogStruct *tmplg=head->next;
|
|
<a name="l412"></a> LinkStruct *file_root=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l413"></a> </span><span class=cF1>while</span><span class=cF0> (tmplg!=head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l414"></a> </span><span class=cF1>if</span><span class=cF0> (IsKeeper</span><span class=cF7>(</span><span class=cF0>tmplg,dstart,dend</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l415"></a> FileTreeAdd(&file_root,tmplg);
|
|
<a name="l416"></a> tmplg=tmplg->next;
|
|
<a name="l417"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l418"></a> </span><span class=cF6>"\n\nFile Hits\n"</span><span class=cF0>;
|
|
<a name="l419"></a> FileTreeTraverse(file_root);
|
|
<a name="l420"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l421"></a> FileTreeDel(file_root);
|
|
<a name="l422"></a>}
|
|
<a name="l423"></a>
|
|
<a name="l424"></a></span><span class=cF1>U0</span><span class=cF0> IndexRep(LogStruct *head,</span><span class=cF9>CDate</span><span class=cF0> dstart,</span><span class=cF9>CDate</span><span class=cF0> dend)
|
|
<a name="l425"></a>{
|
|
<a name="l426"></a> </span><span class=cF9>I64</span><span class=cF0> i,j,cnt,dups,
|
|
<a name="l427"></a> hours_start,hours_end,*hour_cnts,*dup_cnts,
|
|
<a name="l428"></a> days_start,days_end,*day_cnts,*day_dup_cnts;
|
|
<a name="l429"></a> LogStruct *tmplg=head->next,*dup_head=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l430"></a> LinkStruct *link_root=</span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l431"></a> </span><span class=cF9>CDateStruct</span><span class=cF0> ds;
|
|
<a name="l432"></a>
|
|
<a name="l433"></a> i=dstart*24;hours_start=i.u32[1];
|
|
<a name="l434"></a> i=dend *24;hours_end =i.u32[1];
|
|
<a name="l435"></a>
|
|
<a name="l436"></a> days_start=(dstart+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32;
|
|
<a name="l437"></a> days_end =(dend+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32;
|
|
<a name="l438"></a>
|
|
<a name="l439"></a> hour_cnts=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>hours_end-hours_start+1</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l440"></a> dup_cnts =</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>hours_end-hours_start+1</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l441"></a> day_cnts =</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>days_end-days_start+1</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l442"></a> day_dup_cnts=</span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF7>(</span><span class=cF0>days_end-days_start+1</span><span class=cF7>)</span><span class=cF0>*</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>I64</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l443"></a> dups=cnt=0;
|
|
<a name="l444"></a> </span><span class=cF1>while</span><span class=cF0> (tmplg!=head) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l445"></a> </span><span class=cF1>if</span><span class=cF0> (IsKeeper</span><span class=cF7>(</span><span class=cF0>tmplg,dstart,dend</span><span class=cF7>)</span><span class=cF0> && IsIndex</span><span class=cF7>(</span><span class=cF0>tmplg</span><span class=cF7>)</span><span class=cF0>) {
|
|
<a name="l446"></a> i=tmplg->datetime*24;
|
|
<a name="l447"></a> hour_cnts[i.u32[1]-hours_start]++;
|
|
<a name="l448"></a> day_cnts[(tmplg->datetime+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32-days_start]++;
|
|
<a name="l449"></a> cnt++;
|
|
<a name="l450"></a> </span><span class=cF1>if</span><span class=cF0> (IPNumTreeAdd</span><span class=cF7>(</span><span class=cF0>&dup_head,tmplg</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l451"></a> day_dup_cnts[(tmplg->datetime+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32-days_start]++;
|
|
<a name="l452"></a> dup_cnts[i.u32[1]-hours_start]++;
|
|
<a name="l453"></a> dups++;
|
|
<a name="l454"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l455"></a> LinkTreeAdd(&link_root,tmplg);
|
|
<a name="l456"></a> }
|
|
<a name="l457"></a> tmplg=tmplg->next;
|
|
<a name="l458"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l459"></a>
|
|
<a name="l460"></a> </span><span class=cF6>"\n\nHits on /index.html\n"</span><span class=cF0>
|
|
<a name="l461"></a> </span><span class=cF6>"'-' is a dup. '+' is not a dup.\n"</span><span class=cF0>;
|
|
<a name="l462"></a> </span><span class=cF1>for</span><span class=cF0> (i=dstart;i<=dend;i+=1<<32)
|
|
<a name="l463"></a> </span><span class=cF6>"%D Dups:%5d Total:%5d Uniques:%5d\n"</span><span class=cF0>,i,
|
|
<a name="l464"></a> day_dup_cnts[(i+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32-days_start],
|
|
<a name="l465"></a> day_cnts[(i+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32-days_start],
|
|
<a name="l466"></a> day_cnts[(i+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32-days_start]-
|
|
<a name="l467"></a> day_dup_cnts[(i+</span><span class=cFB>local_time_offset</span><span class=cF0>)>>32-days_start];
|
|
<a name="l468"></a>
|
|
<a name="l469"></a> </span><span class=cF6>"\n\nHits on /index.html\n"</span><span class=cF0>;
|
|
<a name="l470"></a> </span><span class=cF1>if</span><span class=cF0> (hours_end-hours_start>=HOURS_MAX)
|
|
<a name="l471"></a> i=hours_end-HOURS_MAX+1;
|
|
<a name="l472"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l473"></a> i=hours_start;
|
|
<a name="l474"></a> </span><span class=cF1>for</span><span class=cF0> (;i<=hours_end;i++) </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l475"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(&ds,i<<32/24+</span><span class=cFB>local_time_offset</span><span class=cF0>);
|
|
<a name="l476"></a> </span><span class=cF6>"%D %02d: "</span><span class=cF0>,i<<32/24,ds.hour;
|
|
<a name="l477"></a> </span><span class=cF1>for</span><span class=cF0> (j=0;j<dup_cnts[i-hours_start];j++)
|
|
<a name="l478"></a> </span><span class=cF6>'-'</span><span class=cF0>;
|
|
<a name="l479"></a> </span><span class=cF1>for</span><span class=cF0> (;j<hour_cnts[i-hours_start];j++)
|
|
<a name="l480"></a> </span><span class=cF6>'+'</span><span class=cF0>;
|
|
<a name="l481"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l482"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l483"></a> </span><span class=cF6>"Total:%d Dups:%d Uniques:%d\n"</span><span class=cF0>,cnt,dups,cnt-dups;
|
|
<a name="l484"></a>
|
|
<a name="l485"></a> </span><span class=cF6>"\n\nHits on /index.html\n"</span><span class=cF0>;
|
|
<a name="l486"></a> LinkTreeTraverse(link_root);
|
|
<a name="l487"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l488"></a>
|
|
<a name="l489"></a> LinkTreeDel(link_root);
|
|
<a name="l490"></a> </span><span class=cF5>Free</span><span class=cF0>(hour_cnts);
|
|
<a name="l491"></a> </span><span class=cF5>Free</span><span class=cF0>(dup_cnts);
|
|
<a name="l492"></a> </span><span class=cF5>Free</span><span class=cF0>(day_cnts);
|
|
<a name="l493"></a> </span><span class=cF5>Free</span><span class=cF0>(day_dup_cnts);
|
|
<a name="l494"></a>}
|
|
<a name="l495"></a>
|
|
<a name="l496"></a></span><span class=cF1>U0</span><span class=cF0> WebLogRep(</span><span class=cF1>U8</span><span class=cF0> *mask,</span><span class=cF1>U8</span><span class=cF0> *output_filename)
|
|
<a name="l497"></a>{
|
|
<a name="l498"></a> LogStruct *head;
|
|
<a name="l499"></a> </span><span class=cF9>CDate</span><span class=cF0> dstart=</span><span class=cF3>I64_MAX</span><span class=cF0>,dend=</span><span class=cF3>I64_MIN</span><span class=cF0>;
|
|
<a name="l500"></a>
|
|
<a name="l501"></a> </span><span class=cF5>DocMax</span><span class=cF0>;
|
|
<a name="l502"></a>
|
|
<a name="l503"></a> head=PrsLogFiles(mask,&dstart,&dend);
|
|
<a name="l504"></a> </span><span class=cF1>if</span><span class=cF0> (dstart>dend)
|
|
<a name="l505"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"No Data.\n"</span><span class=cF0>);
|
|
<a name="l506"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l507"></a> dstart=</span><span class=cF5>GetDate</span><span class=cF0>(</span><span class=cF6>"Start(%D):"</span><span class=cF0>,dstart);
|
|
<a name="l508"></a> dend =</span><span class=cF5>GetDate</span><span class=cF0>(</span><span class=cF6>"End (%D):"</span><span class=cF0>,dend);
|
|
<a name="l509"></a> BlockIPNuip(head);
|
|
<a name="l510"></a>
|
|
<a name="l511"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
|
|
<a name="l512"></a> </span><span class=cF6>"$WW,0$"</span><span class=cF0>;
|
|
<a name="l513"></a> IndexRep(head,dstart,dend);
|
|
<a name="l514"></a> FileRep(head,dstart,dend);
|
|
<a name="l515"></a> DownLoadRep(head,dstart,dend);
|
|
<a name="l516"></a>
|
|
<a name="l517"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(</span><span class=cF5>DocPut</span><span class=cF0>->filename.name,output_filename);
|
|
<a name="l518"></a> </span><span class=cF5>DocWrite</span><span class=cF0>(</span><span class=cF5>DocPut</span><span class=cF0>,</span><span class=cF3>TRUE</span><span class=cF0>);
|
|
<a name="l519"></a>
|
|
<a name="l520"></a> </span><span class=cF6>"$WW,1$"</span><span class=cF0>;
|
|
<a name="l521"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l522"></a> LogLstDel(head);
|
|
<a name="l523"></a>}
|
|
<a name="l524"></a>
|
|
<a name="l525"></a>#</span><span class=cF1>if</span><span class=cF0> </span><span class=cF3>__CMD_LINE__</span><span class=cF0>
|
|
<a name="l526"></a></span><span class=cF5>Cd</span><span class=cF0>(</span><span class=cF3>__DIR__</span><span class=cF0>);;
|
|
<a name="l527"></a>WebLogRep(</span><span class=cF6>"*.log*"</span><span class=cF0>,</span><span class=cF6>"~/DemoWebLog.DD.Z"</span><span class=cF0>);
|
|
<a name="l528"></a>#</span><span class=cF1>endif</span><span class=cF0>
|
|
</span></pre></body>
|
|
</html>
|