mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-26 15:26:43 +00:00
Update documentation.
This commit is contained in:
parent
d767f8f6e7
commit
28ab32e893
22 changed files with 8126 additions and 7929 deletions
File diff suppressed because it is too large
Load diff
|
@ -36,7 +36,7 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l9"></a> </span><span class=cF5>WinToTop</span><span class=cF0>;
|
||||
<a name="l10"></a> </span><span class=cF5>WinZBufUpdate</span><span class=cF0>;
|
||||
<a name="l11"></a> </span><span class=cF5>Dir</span><span class=cF0>;
|
||||
<a name="l12"></a> </span><span class=cF6>"\n95,265 LOC, "</span><span class=cF0>;
|
||||
<a name="l12"></a> </span><span class=cF6>"\n95,270 LOC, "</span><span class=cF0>;
|
||||
<a name="l13"></a> </span><span class=cF6>"%d MB RAM, "</span><span class=cF0>, </span><span class=cF5>MemBIOSTotal</span><span class=cF0> / </span><span class=cFE>1024</span><span class=cF0> / </span><span class=cFE>1024</span><span class=cF0>;
|
||||
<a name="l14"></a> </span><span class=cF5>CPURep</span><span class=cF0>;
|
||||
<a name="l15"></a> </span><span class=cF6>"\n"</span><span class=cF0>;
|
||||
|
|
|
@ -103,206 +103,243 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l76"></a>
|
||||
<a name="l77"></a>
|
||||
<a name="l78"></a>
|
||||
<a name="l79"></a>
|
||||
<a name="l80"></a></span><span class=cF9>CDocEntry</span><span class=cF0> *GrDirSprite(</span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *elems, </span><span class=cF1>U8</span><span class=cF0> *filename=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> align=-</span><span class=cFE>1</span><span class=cF0>)
|
||||
<a name="l81"></a>{ </span><span class=cF2>// Draw a GrDir sprite into DolDoc: align arg is 0,1,2 for left,center,right.</span><span class=cF0>
|
||||
<a name="l82"></a> </span><span class=cF2>// make into either Link and PopUp, or Left-Macro,</span><span class=cF0>
|
||||
<a name="l83"></a> </span><span class=cF2>// so it can be left/right clicked just like the text links.</span><span class=cF0>
|
||||
<a name="l84"></a> </span><span class=cF2>// See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrSpritePlot.ZC.html#l501"><span class=cF4>DocSprite</span></a><span class=cF2>.</span><span class=cF0>
|
||||
<a name="l85"></a>
|
||||
<a name="l86"></a> </span><span class=cF9>I64</span><span class=cF0> size;
|
||||
<a name="l87"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
|
||||
<a name="l88"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
||||
<a name="l89"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
|
||||
<a name="l90"></a> </span><span class=cF9>CDocBin</span><span class=cF0> *tmpb;
|
||||
<a name="l91"></a>
|
||||
<a name="l92"></a> </span><span class=cF1>if</span><span class=cF0> (!doc && !</span><span class=cF7>(</span><span class=cF0>doc = </span><span class=cF5>DocPut</span><span class=cF7>)</span><span class=cF0> || !elems)
|
||||
<a name="l93"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
||||
<a name="l94"></a>
|
||||
<a name="l95"></a> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
||||
<a name="l96"></a> size = </span><span class=cF5>SpriteSize</span><span class=cF0>(elems);
|
||||
<a name="l97"></a> tmpb = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocBin</span><span class=cF7>)</span><span class=cF0>, doc->mem_task);
|
||||
<a name="l98"></a> tmpb->size = size;
|
||||
<a name="l99"></a> tmpb->data = </span><span class=cF5>MAlloc</span><span class=cF0>(size, doc->mem_task);
|
||||
<a name="l100"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(tmpb->data, elems, size);
|
||||
<a name="l101"></a> tmpb->num = doc->cur_bin_num;
|
||||
<a name="l102"></a> tmpb->use_count = </span><span class=cFE>1</span><span class=cF0>;
|
||||
<a name="l103"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpb, doc->bin_head.last);
|
||||
<a name="l104"></a>
|
||||
<a name="l105"></a>
|
||||
<a name="l106"></a> </span><span class=cF1>switch</span><span class=cF0> (align)
|
||||
<a name="l107"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l108"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
||||
<a name="l109"></a> </span><span class=cF6>"\n$CM+LX-RE,LE=6$"</span><span class=cF0>;
|
||||
<a name="l110"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l111"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>:
|
||||
<a name="l112"></a> </span><span class=cF6>"$CM+CX-RE,LE=2$"</span><span class=cF0>;
|
||||
<a name="l113"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l114"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>:
|
||||
<a name="l115"></a> </span><span class=cF6>"$CM+RX-RE,LE=-1$"</span><span class=cF0>;
|
||||
<a name="l116"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l117"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l118"></a>
|
||||
<a name="l119"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsDir</span><span class=cF7>(</span><span class=cF0>filename</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l120"></a> st = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>"$SP+L+PU,\"\",A=\"%s\",BI=%d$"</span><span class=cF0>, filename, doc->cur_bin_num++);
|
||||
<a name="l121"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l122"></a> st = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>"$SP+X,\"\",LM=\"Cd(\\\"%s\\\");GrDir;\n\",BI=%d$"</span><span class=cF0>, filename, doc->cur_bin_num++);
|
||||
<a name="l79"></a> </span><span class=cFA><10>/* Graphics Not Rendered in HTML */</span><span class=cF0>
|
||||
<a name="l80"></a>
|
||||
<a name="l81"></a>
|
||||
<a name="l82"></a>
|
||||
<a name="l83"></a>
|
||||
<a name="l84"></a>
|
||||
<a name="l85"></a></span><span class=cF9>CDocEntry</span><span class=cF0> *GrDirSprite(</span><span class=cF9>CDoc</span><span class=cF0> *doc=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *elems, </span><span class=cF1>U8</span><span class=cF0> *filename=</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF9>I64</span><span class=cF0> align=-</span><span class=cFE>1</span><span class=cF0>)
|
||||
<a name="l86"></a>{ </span><span class=cF2>// Draw a GrDir sprite into DolDoc: align arg is 0,1,2 for left,center,right.</span><span class=cF0>
|
||||
<a name="l87"></a> </span><span class=cF2>// make into either Link and PopUp, or Left-Macro,</span><span class=cF0>
|
||||
<a name="l88"></a> </span><span class=cF2>// so it can be left/right clicked just like the text links.</span><span class=cF0>
|
||||
<a name="l89"></a> </span><span class=cF2>// See </span><a href="https://zeal-operating-system.github.io/ZealOS/System/Gr/GrSpritePlot.ZC.html#l501"><span class=cF4>DocSprite</span></a><span class=cF2>.</span><span class=cF0>
|
||||
<a name="l90"></a>
|
||||
<a name="l91"></a> </span><span class=cF9>I64</span><span class=cF0> size;
|
||||
<a name="l92"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
|
||||
<a name="l93"></a> </span><span class=cF1>Bool</span><span class=cF0> unlock;
|
||||
<a name="l94"></a> </span><span class=cF9>CDocEntry</span><span class=cF0> *doc_e;
|
||||
<a name="l95"></a> </span><span class=cF9>CDocBin</span><span class=cF0> *tmpb;
|
||||
<a name="l96"></a>
|
||||
<a name="l97"></a> </span><span class=cF1>if</span><span class=cF0> (!doc && !</span><span class=cF7>(</span><span class=cF0>doc = </span><span class=cF5>DocPut</span><span class=cF7>)</span><span class=cF0> || !elems)
|
||||
<a name="l98"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>NULL</span><span class=cF0>;
|
||||
<a name="l99"></a>
|
||||
<a name="l100"></a> unlock = </span><span class=cF5>DocLock</span><span class=cF0>(doc);
|
||||
<a name="l101"></a> size = </span><span class=cF5>SpriteSize</span><span class=cF0>(elems);
|
||||
<a name="l102"></a> tmpb = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDocBin</span><span class=cF7>)</span><span class=cF0>, doc->mem_task);
|
||||
<a name="l103"></a> tmpb->size = size;
|
||||
<a name="l104"></a> tmpb->data = </span><span class=cF5>MAlloc</span><span class=cF0>(size, doc->mem_task);
|
||||
<a name="l105"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(tmpb->data, elems, size);
|
||||
<a name="l106"></a> tmpb->num = doc->cur_bin_num;
|
||||
<a name="l107"></a> tmpb->use_count = </span><span class=cFE>1</span><span class=cF0>;
|
||||
<a name="l108"></a> </span><span class=cF5>QueueInsert</span><span class=cF0>(tmpb, doc->bin_head.last);
|
||||
<a name="l109"></a>
|
||||
<a name="l110"></a>
|
||||
<a name="l111"></a> </span><span class=cF1>switch</span><span class=cF0> (align)
|
||||
<a name="l112"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l113"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
||||
<a name="l114"></a> </span><span class=cF6>"\n$CM+LX-RE,LE=6$"</span><span class=cF0>;
|
||||
<a name="l115"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l116"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>:
|
||||
<a name="l117"></a> </span><span class=cF6>"$CM+CX-RE,LE=2$"</span><span class=cF0>;
|
||||
<a name="l118"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l119"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>:
|
||||
<a name="l120"></a> </span><span class=cF6>"$CM+RX-RE,LE=-1$"</span><span class=cF0>;
|
||||
<a name="l121"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l122"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l123"></a>
|
||||
<a name="l124"></a> doc_e = </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"%s"</span><span class=cF0>, st);
|
||||
<a name="l125"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
||||
<a name="l126"></a> doc_e->bin_data = tmpb;
|
||||
<a name="l127"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e && doc_e->de_flags & </span><span class=cF3>DOCEF_TAG</span><span class=cF0> && doc_e->tag && *doc_e->tag)
|
||||
<a name="l128"></a> tmpb->tag = </span><span class=cF5>StrNew</span><span class=cF0>(doc_e->tag, doc->mem_task);
|
||||
<a name="l129"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
||||
<a name="l130"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
||||
<a name="l131"></a>
|
||||
<a name="l132"></a> </span><span class=cF1>return</span><span class=cF0> doc_e;
|
||||
<a name="l133"></a>}
|
||||
<a name="l134"></a>
|
||||
<a name="l135"></a></span><span class=cF9>I64</span><span class=cF0> GrDir(</span><span class=cF1>U8</span><span class=cF0> *files_find_mask=</span><span class=cF3>NULL</span><span class=cF0>)
|
||||
<a name="l136"></a>{
|
||||
<a name="l137"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde1</span><span class=cF2>/* = NULL*/</span><span class=cF0>, *tmpde2;
|
||||
<a name="l138"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l139"></a> </span><span class=cF1>U8</span><span class=cF0> *tag, *st,
|
||||
<a name="l140"></a> *tmpb, *tmpb0, *tmpb1, *tmpb2, </span><span class=cF2>// sprite pointers</span><span class=cF0>
|
||||
<a name="l141"></a> *tmpf0, *tmpf1, *tmpf2; </span><span class=cF2>// filenames (for sprite links)</span><span class=cF0>
|
||||
<a name="l142"></a>
|
||||
<a name="l143"></a> tmpb = tmpb0 = tmpb1 = tmpb2 = tmpf0 = tmpf1 = tmpf2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
||||
<a name="l144"></a>
|
||||
<a name="l145"></a> tmpde1 = </span><span class=cF5>FilesFind</span><span class=cF0>(files_find_mask);
|
||||
<a name="l146"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1)
|
||||
<a name="l147"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l124"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>IsDir</span><span class=cF7>(</span><span class=cF0>filename</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l125"></a> st = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>"$SP+L+PU,\"\",A=\"%s\",BI=%d$"</span><span class=cF0>, filename, doc->cur_bin_num++);
|
||||
<a name="l126"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l127"></a> st = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>"$SP+X,\"\",LM=\"Cd(\\\"%s\\\");GrDir;\n\",BI=%d$"</span><span class=cF0>, filename, doc->cur_bin_num++);
|
||||
<a name="l128"></a>
|
||||
<a name="l129"></a> doc_e = </span><span class=cF5>DocPrint</span><span class=cF0>(doc, </span><span class=cF6>"%s"</span><span class=cF0>, st);
|
||||
<a name="l130"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
||||
<a name="l131"></a> doc_e->bin_data = tmpb;
|
||||
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (doc_e && doc_e->de_flags & </span><span class=cF3>DOCEF_TAG</span><span class=cF0> && doc_e->tag && *doc_e->tag)
|
||||
<a name="l133"></a> tmpb->tag = </span><span class=cF5>StrNew</span><span class=cF0>(doc_e->tag, doc->mem_task);
|
||||
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (unlock)
|
||||
<a name="l135"></a> </span><span class=cF5>DocUnlock</span><span class=cF0>(doc);
|
||||
<a name="l136"></a>
|
||||
<a name="l137"></a> </span><span class=cF1>return</span><span class=cF0> doc_e;
|
||||
<a name="l138"></a>}
|
||||
<a name="l139"></a>
|
||||
<a name="l140"></a></span><span class=cF9>I64</span><span class=cF0> GrDir(</span><span class=cF1>U8</span><span class=cF0> *files_find_mask=</span><span class=cF3>NULL</span><span class=cF0>)
|
||||
<a name="l141"></a>{
|
||||
<a name="l142"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde1, *tmpde2;
|
||||
<a name="l143"></a> </span><span class=cF9>I64</span><span class=cF0> res = </span><span class=cFE>0</span><span class=cF0>, i;
|
||||
<a name="l144"></a> </span><span class=cF1>U8</span><span class=cF0> *tag, *st,
|
||||
<a name="l145"></a> *tmpb, *tmpb0, *tmpb1, *tmpb2, </span><span class=cF2>// sprite pointers</span><span class=cF0>
|
||||
<a name="l146"></a> *tmpf0, *tmpf1, *tmpf2; </span><span class=cF2>// filenames (for sprite links)</span><span class=cF0>
|
||||
<a name="l147"></a> </span><span class=cF9>CDrive</span><span class=cF0> *drive;
|
||||
<a name="l148"></a>
|
||||
<a name="l149"></a> </span><span class=cF1>if</span><span class=cF0> (GRDIR_CLEAR)
|
||||
<a name="l150"></a> </span><span class=cF6>"$CL$"</span><span class=cF0>;
|
||||
<a name="l151"></a>
|
||||
<a name="l152"></a> st = </span><span class=cF5>MAllocIdent</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l153"></a> </span><span class=cF5>StrLastRemove</span><span class=cF0>(st, </span><span class=cF6>"/"</span><span class=cF0>);
|
||||
<a name="l154"></a> </span><span class=cF1>if</span><span class=cF0> (!st[</span><span class=cFE>2</span><span class=cF0>])
|
||||
<a name="l155"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(st + </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF6>"/"</span><span class=cF0>);
|
||||
<a name="l156"></a>
|
||||
<a name="l157"></a> </span><span class=cF6>"%s>$GREEN$GrDir(\"%s\");$FG$\n"</span><span class=cF0>, st, st;
|
||||
<a name="l158"></a>
|
||||
<a name="l159"></a> </span><span class=cF6>"\n$MA,\"Drive C\",LM=\"Drive('C');GrDir;\n\"$ $MA,\"Drive D\",LM=\"Drive('D');GrDir;\n\"$ $MA,\"Disk Change T\",LM=\"DiskChange('T');GrDir;\n\"$\n"</span><span class=cF0>;
|
||||
<a name="l160"></a>
|
||||
<a name="l161"></a> </span><span class=cF6>"\n$MA,T=\"Directory\",LM=\"PopUpCd;GrDir;\n\"$ of %s\n\n"</span><span class=cF0>, st;
|
||||
<a name="l149"></a> tmpb = tmpb0 = tmpb1 = tmpb2 = tmpf0 = tmpf1 = tmpf2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
||||
<a name="l150"></a>
|
||||
<a name="l151"></a> tmpde1 = </span><span class=cF5>FilesFind</span><span class=cF0>(files_find_mask);
|
||||
<a name="l152"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1)
|
||||
<a name="l153"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l154"></a>
|
||||
<a name="l155"></a> </span><span class=cF1>if</span><span class=cF0> (GRDIR_CLEAR)
|
||||
<a name="l156"></a> </span><span class=cF6>"$CL$"</span><span class=cF0>;
|
||||
<a name="l157"></a>
|
||||
<a name="l158"></a> st = </span><span class=cF5>MAllocIdent</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l159"></a> </span><span class=cF5>StrLastRemove</span><span class=cF0>(st, </span><span class=cF6>"/"</span><span class=cF0>);
|
||||
<a name="l160"></a> </span><span class=cF1>if</span><span class=cF0> (!st[</span><span class=cFE>2</span><span class=cF0>])
|
||||
<a name="l161"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(st + </span><span class=cFE>2</span><span class=cF0>, </span><span class=cF6>"/"</span><span class=cF0>);
|
||||
<a name="l162"></a>
|
||||
<a name="l163"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde1)
|
||||
<a name="l164"></a> {
|
||||
<a name="l165"></a> tmpde2 = tmpde1->next;
|
||||
<a name="l166"></a>
|
||||
<a name="l167"></a> </span><span class=cF1>switch</span><span class=cF0> (res % </span><span class=cFE>3</span><span class=cF0>)
|
||||
<a name="l163"></a> </span><span class=cF6>"%s>$GREEN$GrDir(\"%s\");$FG$\n\n"</span><span class=cF0>, st, st;
|
||||
<a name="l164"></a>
|
||||
<a name="l165"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>, drive = </span><span class=cFB>blkdev</span><span class=cF0>.drvs; i < </span><span class=cF3>DRIVES_NUM</span><span class=cF0>; i++, drive++)
|
||||
<a name="l166"></a> {
|
||||
<a name="l167"></a> </span><span class=cF1>if</span><span class=cF0> (drive->drive_signature == </span><span class=cF3>DRIVE_SIGNATURE_VAL</span><span class=cF0>)
|
||||
<a name="l168"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l169"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
||||
<a name="l170"></a> tag = </span><span class=cF6>"LX"</span><span class=cF0>;
|
||||
<a name="l171"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l172"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>:
|
||||
<a name="l173"></a> tag = </span><span class=cF6>"CX"</span><span class=cF0>;
|
||||
<a name="l174"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l175"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>:
|
||||
<a name="l176"></a> tag = </span><span class=cF6>"RX"</span><span class=cF0>;
|
||||
<a name="l177"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l178"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l179"></a>
|
||||
<a name="l180"></a> </span><span class=cF1>if</span><span class=cF0> (res % </span><span class=cFE>3</span><span class=cF0> == </span><span class=cFE>0</span><span class=cF0> && res != </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l181"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l182"></a> GrDirSprite(, tmpb0, tmpf0, </span><span class=cFE>0</span><span class=cF0>);
|
||||
<a name="l183"></a> GrDirSprite(, tmpb1, tmpf1, </span><span class=cFE>1</span><span class=cF0>);
|
||||
<a name="l184"></a> GrDirSprite(, tmpb2, tmpf2, </span><span class=cFE>2</span><span class=cF0>);
|
||||
<a name="l185"></a>
|
||||
<a name="l186"></a> </span><span class=cF6>"\n\n\n\n\n\n\n"</span><span class=cF0>;
|
||||
<a name="l187"></a> tmpb = tmpb0 = tmpb1 = tmpb2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
||||
<a name="l188"></a>
|
||||
<a name="l189"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpf0);
|
||||
<a name="l190"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpf1);
|
||||
<a name="l191"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpf2);
|
||||
<a name="l192"></a> tmpf0 = tmpf1 = tmpf2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
||||
<a name="l193"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l194"></a>
|
||||
<a name="l195"></a> </span><span class=cF1>if</span><span class=cF0> (res % </span><span class=cFE>3</span><span class=cF0> == </span><span class=cFE>2</span><span class=cF0>)
|
||||
<a name="l196"></a> </span><span class=cF6>"$CM-LE-RE$"</span><span class=cF0>;
|
||||
<a name="l197"></a>
|
||||
<a name="l198"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1->attr & </span><span class=cF3>RS_ATTR_DIR</span><span class=cF0>)
|
||||
<a name="l199"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l200"></a>
|
||||
<a name="l201"></a> </span><span class=cF6>"$MA+%s,T=\"%s\",LM=\"Cd(\\\"%s\\\");GrDir;\n\"$"</span><span class=cF0>, tag, tmpde1->name, tmpde1->full_name;
|
||||
<a name="l202"></a> </span><span class=cF1>switch</span><span class=cF0> (res % </span><span class=cFE>3</span><span class=cF0>)
|
||||
<a name="l203"></a> {
|
||||
<a name="l204"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
||||
<a name="l205"></a> tmpb0 = </span><span class=cFA><3></span><span class=cF0>;
|
||||
<a name="l206"></a> tmpf0 = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l207"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l208"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>:
|
||||
<a name="l209"></a> tmpb1 = </span><span class=cFA><3></span><span class=cF0>;
|
||||
<a name="l210"></a> tmpf1 = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l169"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF6>'A'</span><span class=cF0> <= </span><span class=cF5>Drive2Letter</span><span class=cF7>(</span><span class=cF0>drive</span><span class=cF7>)</span><span class=cF0> <= </span><span class=cF6>'S'</span><span class=cF0>)
|
||||
<a name="l170"></a> </span><span class=cF6>"$MA,\"Drive %C\",LM=\"Drive('%C');GrDir;\n\"$ "</span><span class=cF0>, </span><span class=cF5>Drive2Letter</span><span class=cF0>(drive), </span><span class=cF5>Drive2Letter</span><span class=cF0>(drive);
|
||||
<a name="l171"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF2>// ATAPI</span><span class=cF0>
|
||||
<a name="l172"></a> </span><span class=cF6>"$MA,\"Drive %C\",LM=\"DiskChange('%C');Drive('%C');GrDir;\n\"$ "</span><span class=cF0>, </span><span class=cF5>Drive2Letter</span><span class=cF0>(drive), </span><span class=cF5>Drive2Letter</span><span class=cF0>(drive), </span><span class=cF5>Drive2Letter</span><span class=cF0>(drive);
|
||||
<a name="l173"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l174"></a> }
|
||||
<a name="l175"></a>
|
||||
<a name="l176"></a> </span><span class=cF6>"\n\n$MA,T=\"Directory\",LM=\"PopUpCd;GrDir;\n\"$ of %s\n\n"</span><span class=cF0>, st;
|
||||
<a name="l177"></a>
|
||||
<a name="l178"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1)
|
||||
<a name="l179"></a> {
|
||||
<a name="l180"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>tmpde1->name, </span><span class=cF6>"."</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l181"></a> tmpde1 = tmpde1->next;
|
||||
<a name="l182"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1)
|
||||
<a name="l183"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l184"></a> tmpf0 = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>"%C:/"</span><span class=cF0>, tmpde1->full_name[</span><span class=cFE>0</span><span class=cF0>]);
|
||||
<a name="l185"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>tmpde1->name, </span><span class=cF6>".."</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l186"></a> {
|
||||
<a name="l187"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>tmpf0, st</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l188"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l189"></a> GrDirSprite(, </span><span class=cFA><10></span><span class=cF0>, tmpde1->name, </span><span class=cFE>0</span><span class=cF0>);
|
||||
<a name="l190"></a> tmpde1 = tmpde1->next;
|
||||
<a name="l191"></a> </span><span class=cF6>"\n\n\n\n\n\n"</span><span class=cF0>;
|
||||
<a name="l192"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l193"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l194"></a> tmpde1 = tmpde1->next;
|
||||
<a name="l195"></a> }
|
||||
<a name="l196"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpf0);
|
||||
<a name="l197"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l198"></a> }
|
||||
<a name="l199"></a>
|
||||
<a name="l200"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde1)
|
||||
<a name="l201"></a> {
|
||||
<a name="l202"></a> tmpde2 = tmpde1->next;
|
||||
<a name="l203"></a>
|
||||
<a name="l204"></a> </span><span class=cF1>switch</span><span class=cF0> (res % </span><span class=cFE>3</span><span class=cF0>)
|
||||
<a name="l205"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l206"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
||||
<a name="l207"></a> tag = </span><span class=cF6>"LX"</span><span class=cF0>;
|
||||
<a name="l208"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l209"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>:
|
||||
<a name="l210"></a> tag = </span><span class=cF6>"CX"</span><span class=cF0>;
|
||||
<a name="l211"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l212"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>:
|
||||
<a name="l213"></a> tmpb2 = </span><span class=cFA><3></span><span class=cF0>;
|
||||
<a name="l214"></a> tmpf2 = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l215"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l216"></a> }
|
||||
<a name="l217"></a>
|
||||
<a name="l218"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l219"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l220"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l221"></a> </span><span class=cF6>"$LK+%s+PU,\"%s\",A=\"FI:%s\"$"</span><span class=cF0>, tag, tmpde1->name, tmpde1->full_name;
|
||||
<a name="l222"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".ZC"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l223"></a> tmpb = </span><span class=cFA><1></span><span class=cF0>;
|
||||
<a name="l224"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".DD"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l225"></a> tmpb = </span><span class=cFA><5></span><span class=cF0>;
|
||||
<a name="l226"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".ISO.C"</span><span class=cF7>)</span><span class=cF0> ||
|
||||
<a name="l227"></a> !</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".ISO"</span><span class=cF7>)</span><span class=cF0> ||
|
||||
<a name="l228"></a> !</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".iso"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l229"></a> tmpb = </span><span class=cFA><4></span><span class=cF0>;
|
||||
<a name="l230"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".HH"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l231"></a> tmpb = </span><span class=cFA><2></span><span class=cF0>;
|
||||
<a name="l232"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".BIN.C"</span><span class=cF7>)</span><span class=cF0> ||
|
||||
<a name="l233"></a> !</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".BIN"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l234"></a> tmpb = </span><span class=cFA><6></span><span class=cF0>;
|
||||
<a name="l235"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".IN"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l236"></a> tmpb = </span><span class=cFA><7></span><span class=cF0>;
|
||||
<a name="l237"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".TXT"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l238"></a> tmpb = </span><span class=cFA><8></span><span class=cF0>;
|
||||
<a name="l239"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l240"></a> </span><span class=cF2>// sprite for unknown filetype</span><span class=cF0>
|
||||
<a name="l241"></a> tmpb = </span><span class=cFA><9></span><span class=cF0>;
|
||||
<a name="l242"></a>
|
||||
<a name="l243"></a> </span><span class=cF1>switch</span><span class=cF0> (res % </span><span class=cFE>3</span><span class=cF0>)
|
||||
<a name="l244"></a> {
|
||||
<a name="l245"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
||||
<a name="l246"></a> tmpb0 = tmpb;
|
||||
<a name="l247"></a> tmpf0 = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l213"></a> tag = </span><span class=cF6>"RX"</span><span class=cF0>;
|
||||
<a name="l214"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l215"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l216"></a>
|
||||
<a name="l217"></a> </span><span class=cF1>if</span><span class=cF0> (res % </span><span class=cFE>3</span><span class=cF0> == </span><span class=cFE>0</span><span class=cF0> && res != </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l218"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l219"></a> GrDirSprite(, tmpb0, tmpf0, </span><span class=cFE>0</span><span class=cF0>);
|
||||
<a name="l220"></a> GrDirSprite(, tmpb1, tmpf1, </span><span class=cFE>1</span><span class=cF0>);
|
||||
<a name="l221"></a> GrDirSprite(, tmpb2, tmpf2, </span><span class=cFE>2</span><span class=cF0>);
|
||||
<a name="l222"></a>
|
||||
<a name="l223"></a> </span><span class=cF6>"\n\n\n\n\n\n\n"</span><span class=cF0>;
|
||||
<a name="l224"></a> tmpb = tmpb0 = tmpb1 = tmpb2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
||||
<a name="l225"></a>
|
||||
<a name="l226"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpf0);
|
||||
<a name="l227"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpf1);
|
||||
<a name="l228"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpf2);
|
||||
<a name="l229"></a> tmpf0 = tmpf1 = tmpf2 = </span><span class=cF3>NULL</span><span class=cF0>;
|
||||
<a name="l230"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l231"></a>
|
||||
<a name="l232"></a> </span><span class=cF1>if</span><span class=cF0> (res % </span><span class=cFE>3</span><span class=cF0> == </span><span class=cFE>2</span><span class=cF0>)
|
||||
<a name="l233"></a> </span><span class=cF6>"$CM-LE-RE$"</span><span class=cF0>;
|
||||
<a name="l234"></a>
|
||||
<a name="l235"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1->attr & </span><span class=cF3>RS_ATTR_DIR</span><span class=cF0>)
|
||||
<a name="l236"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l237"></a>
|
||||
<a name="l238"></a> </span><span class=cF6>"$MA+%s,T=\"%s\",LM=\"Cd(\\\"%s\\\");GrDir;\n\"$"</span><span class=cF0>, tag, tmpde1->name, tmpde1->full_name;
|
||||
<a name="l239"></a> </span><span class=cF1>switch</span><span class=cF0> (res % </span><span class=cFE>3</span><span class=cF0>)
|
||||
<a name="l240"></a> {
|
||||
<a name="l241"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
||||
<a name="l242"></a> tmpb0 = </span><span class=cFA><3></span><span class=cF0>;
|
||||
<a name="l243"></a> tmpf0 = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l244"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l245"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>:
|
||||
<a name="l246"></a> tmpb1 = </span><span class=cFA><3></span><span class=cF0>;
|
||||
<a name="l247"></a> tmpf1 = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l248"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l249"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>:
|
||||
<a name="l250"></a> tmpb1 = tmpb;
|
||||
<a name="l251"></a> tmpf1 = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l249"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>:
|
||||
<a name="l250"></a> tmpb2 = </span><span class=cFA><3></span><span class=cF0>;
|
||||
<a name="l251"></a> tmpf2 = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l252"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l253"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>:
|
||||
<a name="l254"></a> tmpb2 = tmpb;
|
||||
<a name="l255"></a> tmpf2 = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l256"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l257"></a> }
|
||||
<a name="l258"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l259"></a>
|
||||
<a name="l260"></a> res++;
|
||||
<a name="l261"></a> </span><span class=cF5>DirEntryDel</span><span class=cF0>(tmpde1);
|
||||
<a name="l262"></a> tmpde1 = tmpde2;
|
||||
<a name="l263"></a> }
|
||||
<a name="l264"></a>
|
||||
<a name="l265"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
||||
<a name="l266"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l267"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l268"></a> </span><span class=cF6>"\nNo matching entries!!\n"</span><span class=cF0>;
|
||||
<a name="l269"></a>
|
||||
<a name="l270"></a> GrDirSprite(, tmpb0, tmpf0, </span><span class=cFE>0</span><span class=cF0>);
|
||||
<a name="l271"></a> GrDirSprite(, tmpb1, tmpf1, </span><span class=cFE>1</span><span class=cF0>);
|
||||
<a name="l272"></a> GrDirSprite(, tmpb2, tmpf2, </span><span class=cFE>2</span><span class=cF0>);
|
||||
<a name="l273"></a> </span><span class=cF6>"\n\n\n\n\n\n\n"</span><span class=cF0>;
|
||||
<a name="l274"></a>
|
||||
<a name="l275"></a>
|
||||
<a name="l276"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||||
<a name="l277"></a>}
|
||||
<a name="l278"></a>
|
||||
<a name="l279"></a></span><span class=cF5>Cd</span><span class=cF0>;
|
||||
<a name="l280"></a>GrDir;</span></pre></body>
|
||||
<a name="l253"></a> }
|
||||
<a name="l254"></a>
|
||||
<a name="l255"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l256"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l257"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l258"></a> </span><span class=cF6>"$LK+%s+PU,\"%s\",A=\"FI:%s\"$"</span><span class=cF0>, tag, tmpde1->name, tmpde1->full_name;
|
||||
<a name="l259"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".ZC"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l260"></a> tmpb = </span><span class=cFA><1></span><span class=cF0>;
|
||||
<a name="l261"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".DD"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l262"></a> tmpb = </span><span class=cFA><5></span><span class=cF0>;
|
||||
<a name="l263"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".ISO.C"</span><span class=cF7>)</span><span class=cF0> ||
|
||||
<a name="l264"></a> !</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".ISO"</span><span class=cF7>)</span><span class=cF0> ||
|
||||
<a name="l265"></a> !</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".iso"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l266"></a> tmpb = </span><span class=cFA><4></span><span class=cF0>;
|
||||
<a name="l267"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".HH"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l268"></a> tmpb = </span><span class=cFA><2></span><span class=cF0>;
|
||||
<a name="l269"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".BIN.C"</span><span class=cF7>)</span><span class=cF0> ||
|
||||
<a name="l270"></a> !</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".BIN"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l271"></a> tmpb = </span><span class=cFA><6></span><span class=cF0>;
|
||||
<a name="l272"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".IN"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l273"></a> tmpb = </span><span class=cFA><7></span><span class=cF0>;
|
||||
<a name="l274"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF5>FileExtDot</span><span class=cF0>(tmpde1->name), </span><span class=cF6>".TXT"</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l275"></a> tmpb = </span><span class=cFA><8></span><span class=cF0>;
|
||||
<a name="l276"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l277"></a> </span><span class=cF2>// sprite for unknown filetype</span><span class=cF0>
|
||||
<a name="l278"></a> tmpb = </span><span class=cFA><9></span><span class=cF0>;
|
||||
<a name="l279"></a>
|
||||
<a name="l280"></a> </span><span class=cF1>switch</span><span class=cF0> (res % </span><span class=cFE>3</span><span class=cF0>)
|
||||
<a name="l281"></a> {
|
||||
<a name="l282"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>:
|
||||
<a name="l283"></a> tmpb0 = tmpb;
|
||||
<a name="l284"></a> tmpf0 = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l285"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l286"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>1</span><span class=cF0>:
|
||||
<a name="l287"></a> tmpb1 = tmpb;
|
||||
<a name="l288"></a> tmpf1 = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l289"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l290"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cFE>2</span><span class=cF0>:
|
||||
<a name="l291"></a> tmpb2 = tmpb;
|
||||
<a name="l292"></a> tmpf2 = </span><span class=cF5>StrNew</span><span class=cF0>(tmpde1->full_name);
|
||||
<a name="l293"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l294"></a> }
|
||||
<a name="l295"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l296"></a>
|
||||
<a name="l297"></a> res++;
|
||||
<a name="l298"></a> </span><span class=cF5>DirEntryDel</span><span class=cF0>(tmpde1);
|
||||
<a name="l299"></a> tmpde1 = tmpde2;
|
||||
<a name="l300"></a> }
|
||||
<a name="l301"></a>
|
||||
<a name="l302"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
||||
<a name="l303"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l304"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l305"></a> </span><span class=cF6>"\nNo matching entries!!\n"</span><span class=cF0>;
|
||||
<a name="l306"></a>
|
||||
<a name="l307"></a> GrDirSprite(, tmpb0, tmpf0, </span><span class=cFE>0</span><span class=cF0>);
|
||||
<a name="l308"></a> GrDirSprite(, tmpb1, tmpf1, </span><span class=cFE>1</span><span class=cF0>);
|
||||
<a name="l309"></a> GrDirSprite(, tmpb2, tmpf2, </span><span class=cFE>2</span><span class=cF0>);
|
||||
<a name="l310"></a> </span><span class=cF6>"\n\n\n\n\n\n\n"</span><span class=cF0>;
|
||||
<a name="l311"></a>
|
||||
<a name="l312"></a>
|
||||
<a name="l313"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
||||
<a name="l314"></a>}
|
||||
<a name="l315"></a>
|
||||
<a name="l316"></a></span><span class=cF5>Cd</span><span class=cF0>;
|
||||
<a name="l317"></a>GrDir;</span></pre></body>
|
||||
</html>
|
||||
|
|
|
@ -163,7 +163,7 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l136"></a>
|
||||
<a name="l137"></a></span><span class=cF9>I64</span><span class=cF0> Parse(</span><span class=cF1>U8</span><span class=cF0> **_src, </span><span class=cF1>U8</span><span class=cF0> **_dst)
|
||||
<a name="l138"></a>{</span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Compiler/ParseExp.ZC.html#l302"><span class=cF4>ParseExpression</span></a><span class=cF2>().</span><span class=cF0>
|
||||
<a name="l139"></a></span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Compiler/OpCodes.DD.html#l1024"><span class=cF4>Opcode Formats</span></a><span class=cF2> for details on asm insts.</span><span class=cF0>
|
||||
<a name="l139"></a></span><span class=cF2>//See </span><a href="https://zeal-operating-system.github.io/ZealOS/Compiler/OpCodes.DD.html#l1028"><span class=cF4>Opcode Formats</span></a><span class=cF2> for details on asm insts.</span><span class=cF0>
|
||||
<a name="l140"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
||||
<a name="l141"></a> </span><span class=cF1>U8</span><span class=cF0> *dst = *_dst;
|
||||
<a name="l142"></a>
|
||||
|
|
|
@ -38,7 +38,7 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l11"></a>* Low line count and code complexity is the highest good, so it is easy to learn the whole thing. Users should see the light
|
||||
<a name="l12"></a>at the end of the tunnel. One file system, for example, is better than many file systems.
|
||||
<a name="l13"></a>
|
||||
<a name="l14"></a>* There is a limit of 100,000 lines of code for all time, not including applications and demos. Currently, there are 95,265
|
||||
<a name="l14"></a>* There is a limit of 100,000 lines of code for all time, not including applications and demos. Currently, there are 95,270
|
||||
<a name="l15"></a>lines of code. </span><span class=cF4>3rd party libraries are banned</span><span class=cF0> because they circumvent the intent of this limit. The vision is a Commodore 64
|
||||
<a name="l16"></a>ROM -- a fixed core API that is the only dependency of applications. Dependency on components and libraries creates a hell
|
||||
<a name="l17"></a>that is no longer blissful.
|
||||
|
|
|
@ -37,7 +37,7 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l10"></a>
|
||||
<a name="l11"></a>Simplicity is a goal to </span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/Strategy.DD.html#l1"><span class=cF4>keep the line count down</span></a><span class=cF0>, so it's easy to tinker with. As it turns-out, simplicity makes it faster in
|
||||
<a name="l12"></a>some ways, too. It never switches privilege levels, never changes address maps, tends to load whole contiguous files and
|
||||
<a name="l13"></a>other, similar things which boost speed. It's only 95,265 lines of code including the kernel, the 64-bit compiler, the
|
||||
<a name="l13"></a>other, similar things which boost speed. It's only 95,270 lines of code including the kernel, the 64-bit compiler, the
|
||||
<a name="l14"></a>graphics library and all the tools. More importantly, it's designed to keep the user's line count down -- you can do a </span><span class=cF4>
|
||||
<a name="l15"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Doc/HelloWorld.DD.html#l1"><span class=cF4>Hello World</span></a><span class=cF0> application in one line of code and can put graphics on the screen with a three line program!
|
||||
<a name="l16"></a>
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
||||
<meta name="generator" content="ZealOS V1.07">
|
||||
<style type="text/css">
|
||||
body {background-color:#1f1f1f;}
|
||||
.cE4{color:#b34f4b;background-color:#d4b475;}
|
||||
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
|
||||
.cF1{color:#4f84a6;background-color:#1f1f1f;}
|
||||
.cF2{color:#73a255;background-color:#1f1f1f;}
|
||||
.cF3{color:#297582;background-color:#1f1f1f;}
|
||||
.cF4{color:#b34f4b;background-color:#1f1f1f;}
|
||||
.cF5{color:#8a52c3;background-color:#1f1f1f;}
|
||||
.cF6{color:#b7822f;background-color:#1f1f1f;}
|
||||
.cF7{color:#444444;background-color:#1f1f1f;}
|
||||
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
|
||||
.cF9{color:#94bfde;background-color:#1f1f1f;}
|
||||
.cFA{color:#a1ce97;background-color:#1f1f1f;}
|
||||
.cFB{color:#6db4be;background-color:#1f1f1f;}
|
||||
.cFC{color:#e88e88;background-color:#1f1f1f;}
|
||||
.cFD{color:#ca94e8;background-color:#1f1f1f;}
|
||||
.cFE{color:#d4b475;background-color:#1f1f1f;}
|
||||
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre style="font-family:monospace;font-size:12pt">
|
||||
<a name="l1"></a><span class=cF0>Directory of C:/Downloads
|
||||
<a name="l2"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Downloads/index.html#l1"><span class=cE4>./</span></a><span class=cF0>
|
||||
<a name="l3"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/index.html#l1"><span class=cE4>../</span></a><span class=cF0>
|
||||
<a name="l4"></a>
|
||||
<a name="l5"></a>
|
||||
</span></pre></body>
|
||||
</html>
|
|
@ -33,10 +33,9 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l5"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/HTML/Boot/index.html#l1"><span class=cE4>Boot/</span></a><span class=cF0>
|
||||
<a name="l6"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/HTML/Compiler/index.html#l1"><span class=cE4>Compiler/</span></a><span class=cF0>
|
||||
<a name="l7"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/HTML/Demo/index.html#l1"><span class=cE4>Demo/</span></a><span class=cF0>
|
||||
<a name="l8"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/HTML/Doc/index.html#l1"><span class=cE4>Doc/</span></a><span class=cF0>
|
||||
<a name="l9"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/HTML/Downloads/index.html#l1"><span class=cE4>Downloads/</span></a><span class=cF4>
|
||||
<a name="l10"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/HTML/index.html#l1"><span class=cF4>index.html</span></a><span class=cF0>
|
||||
<a name="l8"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/HTML/Doc/index.html#l1"><span class=cE4>Doc/</span></a><span class=cF4>
|
||||
<a name="l9"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/HTML/index.html#l1"><span class=cF4>index.html</span></a><span class=cF0>
|
||||
<a name="l10"></a>
|
||||
<a name="l11"></a>
|
||||
<a name="l12"></a>
|
||||
</span></pre></body>
|
||||
</html>
|
||||
|
|
|
@ -45,10 +45,11 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l18"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Utilities/BST"</span><span class=cF0>
|
||||
<a name="l19"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Protocols/UDP/MakeUDP"</span><span class=cF0>
|
||||
<a name="l20"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Protocols/DNS"</span><span class=cF0>
|
||||
<a name="l21"></a>
|
||||
<a name="l22"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Protocols/TCP/MakeTCP"</span><span class=cF0>
|
||||
<a name="l23"></a>
|
||||
<a name="l24"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Protocols/DHCP"</span><span class=cF0>
|
||||
<a name="l25"></a>
|
||||
<a name="l26"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Utilities/NetHandler"</span><span class=cF0> </span><span class=cF2>// needs IPV4, UDP, ICMP</span></pre></body>
|
||||
<a name="l21"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Utilities/Ping"</span><span class=cF0>
|
||||
<a name="l22"></a>
|
||||
<a name="l23"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Protocols/TCP/MakeTCP"</span><span class=cF0>
|
||||
<a name="l24"></a>
|
||||
<a name="l25"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Protocols/DHCP"</span><span class=cF0>
|
||||
<a name="l26"></a>
|
||||
<a name="l27"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Utilities/NetHandler"</span><span class=cF0> </span><span class=cF2>// needs IPV4, UDP, ICMP</span></pre></body>
|
||||
</html>
|
||||
|
|
|
@ -181,188 +181,187 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l154"></a> result = </span><span class=cF5>StrReplace</span><span class=cF0>(result, </span><span class=cF6>">"</span><span class=cF0>, </span><span class=cF6>""</span><span class=cF0>,, </span><span class=cF3>TRUE</span><span class=cF0>);
|
||||
<a name="l155"></a> result = </span><span class=cF5>StrReplace</span><span class=cF0>(result, </span><span class=cF6>" "</span><span class=cF0>, </span><span class=cF6>""</span><span class=cF0>,, </span><span class=cF3>TRUE</span><span class=cF0>);
|
||||
<a name="l156"></a>
|
||||
<a name="l157"></a> </span><span class=cF5>SysLog</span><span class=cF0>(</span><span class=cF6>"%s\n"</span><span class=cF0>, result);
|
||||
<a name="l158"></a>
|
||||
<a name="l159"></a> </span><span class=cF1>return</span><span class=cF0> result;
|
||||
<a name="l160"></a>}
|
||||
<a name="l157"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>result</span><span class=cF7>)</span><span class=cF0> > </span><span class=cFE>22</span><span class=cF0>)
|
||||
<a name="l158"></a> result[</span><span class=cFE>21</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>// truncate filename len</span><span class=cF0>
|
||||
<a name="l159"></a>
|
||||
<a name="l160"></a> </span><span class=cF5>SysLog</span><span class=cF0>(</span><span class=cF6>"%s\n"</span><span class=cF0>, result);
|
||||
<a name="l161"></a>
|
||||
<a name="l162"></a></span><span class=cF1>U0</span><span class=cF0> GopherTextView(</span><span class=cF1>U8</span><span class=cF0> *host, </span><span class=cF9>U16</span><span class=cF0> port, </span><span class=cF1>U8</span><span class=cF0> *selector)
|
||||
<a name="l163"></a>{
|
||||
<a name="l164"></a> </span><span class=cF1>U8</span><span class=cF0> *basename;
|
||||
<a name="l165"></a> </span><span class=cF1>U8</span><span class=cF0> *tmpname;
|
||||
<a name="l166"></a>
|
||||
<a name="l167"></a> </span><span class=cF5>DirMake</span><span class=cF0>(</span><span class=cF6>"::/Tmp/Gopher"</span><span class=cF0>);
|
||||
<a name="l168"></a>
|
||||
<a name="l169"></a> tmpname = </span><span class=cF5>StrNew</span><span class=cF0>(selector);
|
||||
<a name="l170"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>tmpname</span><span class=cF7>)</span><span class=cF0> > </span><span class=cFE>22</span><span class=cF0>)
|
||||
<a name="l171"></a> tmpname[</span><span class=cFE>21</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>// too long, terminate it early</span><span class=cF0>
|
||||
<a name="l172"></a> basename = </span><span class=cF5>ExtChange</span><span class=cF0>(GopherBasename</span><span class=cF7>(</span><span class=cF0>tmpname</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF6>"TXT"</span><span class=cF0>);
|
||||
<a name="l173"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpname);
|
||||
<a name="l174"></a> tmpname = </span><span class=cF5>StrPrint</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF6>"::/Tmp/Gopher/%s"</span><span class=cF0>, basename);
|
||||
<a name="l175"></a> </span><span class=cF5>Free</span><span class=cF0>(basename);
|
||||
<a name="l176"></a>
|
||||
<a name="l177"></a> </span><span class=cF1>if</span><span class=cF0> (GopherDl</span><span class=cF7>(</span><span class=cF0>host, port, selector,, tmpname</span><span class=cF7>)</span><span class=cF0> == </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l178"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l179"></a> </span><span class=cF5>SysLog</span><span class=cF0>(</span><span class=cF6>"%s\n"</span><span class=cF0>, tmpname);
|
||||
<a name="l180"></a> </span><span class=cF5>Plain</span><span class=cF0>(tmpname);
|
||||
<a name="l181"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l182"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l183"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l184"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Failed to download %s from %s:%d\n"</span><span class=cF0>,
|
||||
<a name="l185"></a> selector, host, port);
|
||||
<a name="l186"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l187"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpname);
|
||||
<a name="l188"></a>}
|
||||
<a name="l189"></a>
|
||||
<a name="l190"></a></span><span class=cF1>U0</span><span class=cF0> GopherLine(</span><span class=cF1>U8</span><span class=cF0> *line)
|
||||
<a name="l191"></a>{
|
||||
<a name="l192"></a> </span><span class=cF9>U64</span><span class=cF0> type;
|
||||
<a name="l193"></a> </span><span class=cF1>U8</span><span class=cF0> *display;
|
||||
<a name="l194"></a> </span><span class=cF1>U8</span><span class=cF0> *selector;
|
||||
<a name="l195"></a> </span><span class=cF1>U8</span><span class=cF0> *host = </span><span class=cF3>NULL</span><span class=cF0>;
|
||||
<a name="l196"></a> </span><span class=cF9>U16</span><span class=cF0> port = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l197"></a>
|
||||
<a name="l198"></a> </span><span class=cF1>if</span><span class=cF0> (*line == </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l199"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l200"></a> </span><span class=cF6>"\n"</span><span class=cF0>;
|
||||
<a name="l201"></a> </span><span class=cF1>return</span><span class=cF0>;
|
||||
<a name="l202"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l203"></a> type = *line++;
|
||||
<a name="l204"></a> display = line;
|
||||
<a name="l205"></a>
|
||||
<a name="l206"></a> line = </span><span class=cF5>StrFind</span><span class=cF0>(</span><span class=cF6>"\t"</span><span class=cF0>, line);
|
||||
<a name="l207"></a> </span><span class=cF1>if</span><span class=cF0> (line)
|
||||
<a name="l208"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l209"></a> *line = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l210"></a> line++;
|
||||
<a name="l211"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l212"></a> selector = line;
|
||||
<a name="l213"></a>
|
||||
<a name="l214"></a> </span><span class=cF1>if</span><span class=cF0> (line)
|
||||
<a name="l215"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l216"></a> line = </span><span class=cF5>StrFind</span><span class=cF0>(</span><span class=cF6>"\t"</span><span class=cF0>, line);
|
||||
<a name="l217"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l218"></a> </span><span class=cF1>if</span><span class=cF0> (line)
|
||||
<a name="l219"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l220"></a> *line = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l221"></a> line++;
|
||||
<a name="l222"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l223"></a> host = line;
|
||||
<a name="l224"></a>
|
||||
<a name="l225"></a> </span><span class=cF1>if</span><span class=cF0> (line)
|
||||
<a name="l226"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l227"></a> line = </span><span class=cF5>StrFind</span><span class=cF0>(</span><span class=cF6>"\t"</span><span class=cF0>, line);
|
||||
<a name="l228"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l229"></a> </span><span class=cF1>if</span><span class=cF0> (line)
|
||||
<a name="l230"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l231"></a> *line = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l232"></a> line++;
|
||||
<a name="l233"></a> port = </span><span class=cF5>Str2I64</span><span class=cF0>(line);
|
||||
<a name="l234"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l235"></a>
|
||||
<a name="l236"></a> </span><span class=cF1>if</span><span class=cF0> (!*host)
|
||||
<a name="l237"></a> </span><span class=cF1>return</span><span class=cF0>;
|
||||
<a name="l238"></a>
|
||||
<a name="l239"></a> </span><span class=cF1>switch</span><span class=cF0> (type)
|
||||
<a name="l240"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l241"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'3'</span><span class=cF0>:
|
||||
<a name="l242"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>""</span><span class=cF0>);
|
||||
<a name="l243"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'i'</span><span class=cF0>:
|
||||
<a name="l244"></a> PrintEscaped(display);
|
||||
<a name="l245"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l246"></a> </span><span class=cF1>default</span><span class=cF0>:
|
||||
<a name="l247"></a> </span><span class=cF6>"$MA,\""</span><span class=cF0>;
|
||||
<a name="l248"></a> PrintEscaped(display, </span><span class=cF6>"\\"</span><span class=cF0>);
|
||||
<a name="l249"></a> </span><span class=cF6>"\",LM=\"%s(\\\""</span><span class=cF0>, gopher_associations[type];
|
||||
<a name="l250"></a> PrintEscaped(host, </span><span class=cF6>"\\\\\\"</span><span class=cF0>);
|
||||
<a name="l251"></a> </span><span class=cF6>"\\\",%d,\\\""</span><span class=cF0>, port;
|
||||
<a name="l252"></a> PrintEscaped(selector, </span><span class=cF6>"\\\\\\"</span><span class=cF0>);
|
||||
<a name="l253"></a> </span><span class=cF6>"\\\");\\n\"$"</span><span class=cF0>;
|
||||
<a name="l254"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l255"></a> </span><span class=cF6>"\n"</span><span class=cF0>;
|
||||
<a name="l256"></a>}
|
||||
<a name="l257"></a>
|
||||
<a name="l258"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> GopherMenu(</span><span class=cF1>U8</span><span class=cF0> *host, </span><span class=cF9>U16</span><span class=cF0> port = </span><span class=cFE>70</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *selector = </span><span class=cF6>"/"</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *query = </span><span class=cF3>NULL</span><span class=cF0>)
|
||||
<a name="l259"></a>{
|
||||
<a name="l260"></a> </span><span class=cF9>I64</span><span class=cF0> sock, n;
|
||||
<a name="l261"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cFE>256</span><span class=cF0>];
|
||||
<a name="l262"></a>
|
||||
<a name="l263"></a> sock = GopherOpen(host, port, selector, query);
|
||||
<a name="l264"></a> </span><span class=cF1>if</span><span class=cF0> (sock <= </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l265"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l266"></a> </span><span class=cF1>return</span><span class=cF0> sock;
|
||||
<a name="l267"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l268"></a>
|
||||
<a name="l269"></a> </span><span class=cF1>do</span><span class=cF0>
|
||||
<a name="l270"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l271"></a></span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>n = recvLine(sock, buf, sizeof(buf), 0);</span><span class=cF0>
|
||||
<a name="l272"></a> n = TCPSocketReceiveLine(sock, buf, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>buf</span><span class=cF7>)</span><span class=cF0>);
|
||||
<a name="l273"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>buf, </span><span class=cF6>"."</span><span class=cF7>)</span><span class=cF0> == </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l274"></a> {
|
||||
<a name="l275"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l276"></a> }
|
||||
<a name="l277"></a> GopherLine(buf);
|
||||
<a name="l278"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l279"></a> </span><span class=cF1>while</span><span class=cF0> (n > </span><span class=cFE>0</span><span class=cF0>);
|
||||
<a name="l280"></a>
|
||||
<a name="l281"></a></span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>close(sock);</span><span class=cF0>
|
||||
<a name="l282"></a> TCPSocketClose(sock);
|
||||
<a name="l283"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l284"></a>}
|
||||
<a name="l285"></a>
|
||||
<a name="l286"></a></span><span class=cF1>class</span><span class=cF0> CQueryForm
|
||||
<a name="l287"></a>{
|
||||
<a name="l288"></a> </span><span class=cF1>U8</span><span class=cF0> query[</span><span class=cFE>65</span><span class=cF0>] format </span><span class=cF6>"$DA-P,A=\"Query:%s\"$"</span><span class=cF0>;
|
||||
<a name="l289"></a>};
|
||||
<a name="l290"></a></span><span class=cF1>U0</span><span class=cF0> GopherQueryPrompt(</span><span class=cF1>U8</span><span class=cF0> *host, </span><span class=cF9>U16</span><span class=cF0> port, </span><span class=cF1>U8</span><span class=cF0> *selector)
|
||||
<a name="l291"></a>{
|
||||
<a name="l292"></a> CQueryForm form;
|
||||
<a name="l293"></a>
|
||||
<a name="l294"></a> form.query[</span><span class=cFE>0</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l295"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PopUpForm</span><span class=cF7>(</span><span class=cF0>&form</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l296"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l297"></a> GopherMenu(host, port, selector, form.query);
|
||||
<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>class</span><span class=cF0> CDlForm
|
||||
<a name="l302"></a>{
|
||||
<a name="l303"></a> </span><span class=cF1>U8</span><span class=cF0> name[</span><span class=cFE>256</span><span class=cF0>] format </span><span class=cF6>"$DA-P,LEN=255,A=\"FileName:%s\"$"</span><span class=cF0>;
|
||||
<a name="l304"></a>};
|
||||
<a name="l305"></a></span><span class=cF1>U0</span><span class=cF0> GopherDlPrompt(</span><span class=cF1>U8</span><span class=cF0> *host, </span><span class=cF9>U16</span><span class=cF0> port, </span><span class=cF1>U8</span><span class=cF0> *selector)
|
||||
<a name="l306"></a>{
|
||||
<a name="l307"></a> CDlForm form;
|
||||
<a name="l308"></a> </span><span class=cF1>U8</span><span class=cF0> *basename;
|
||||
<a name="l309"></a>
|
||||
<a name="l310"></a> basename = GopherBasename(selector);
|
||||
<a name="l311"></a> </span><span class=cF5>MemSet</span><span class=cF0>(form.name, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>256</span><span class=cF0>);
|
||||
<a name="l312"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(form.name, basename,
|
||||
<a name="l313"></a> </span><span class=cF5>MinI64</span><span class=cF7>(</span><span class=cF5>StrLen</span><span class=cF0>(basename), </span><span class=cF1>sizeof</span><span class=cF0>(form.name) - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>);
|
||||
<a name="l314"></a> form.name[</span><span class=cFE>255</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l315"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PopUpForm</span><span class=cF7>(</span><span class=cF0>&form</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l316"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l317"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>form.name</span><span class=cF7>)</span><span class=cF0> >= </span><span class=cFE>26</span><span class=cF0>)
|
||||
<a name="l318"></a> form.name[</span><span class=cFE>25</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l319"></a> GopherDl(host, port, selector,, form.name);
|
||||
<a name="l320"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l321"></a>}
|
||||
<a name="l322"></a>
|
||||
<a name="l323"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> Gopher(</span><span class=cF1>U8</span><span class=cF0> *hostname)
|
||||
<a name="l324"></a>{
|
||||
<a name="l325"></a> </span><span class=cF1>return</span><span class=cF0> GopherMenu(hostname);
|
||||
<a name="l326"></a>}
|
||||
<a name="l327"></a>
|
||||
<a name="l328"></a></span><span class=cF5>MemSetI64</span><span class=cF0>(gopher_associations, </span><span class=cF6>"GopherDlPrompt"</span><span class=cF0>, </span><span class=cFE>256</span><span class=cF0>);
|
||||
<a name="l329"></a>gopher_associations[</span><span class=cF6>'0'</span><span class=cF0>] = </span><span class=cF6>"GopherTextView"</span><span class=cF0>;
|
||||
<a name="l330"></a>gopher_associations[</span><span class=cF6>'1'</span><span class=cF0>] = </span><span class=cF6>"GopherMenu"</span><span class=cF0>;
|
||||
<a name="l331"></a>gopher_associations[</span><span class=cF6>'7'</span><span class=cF0>] = </span><span class=cF6>"GopherQueryPrompt"</span><span class=cF0>;
|
||||
<a name="l332"></a></span><span class=cF2>/* Include this file from your Net/Load.ZC, then add more associations */</span><span class=cF0>
|
||||
<a name="l162"></a> </span><span class=cF1>return</span><span class=cF0> result;
|
||||
<a name="l163"></a>}
|
||||
<a name="l164"></a>
|
||||
<a name="l165"></a></span><span class=cF1>U0</span><span class=cF0> GopherTextView(</span><span class=cF1>U8</span><span class=cF0> *host, </span><span class=cF9>U16</span><span class=cF0> port, </span><span class=cF1>U8</span><span class=cF0> *selector)
|
||||
<a name="l166"></a>{
|
||||
<a name="l167"></a> </span><span class=cF1>U8</span><span class=cF0> *basename;
|
||||
<a name="l168"></a> </span><span class=cF1>U8</span><span class=cF0> *tmpname;
|
||||
<a name="l169"></a>
|
||||
<a name="l170"></a> </span><span class=cF5>DirMake</span><span class=cF0>(</span><span class=cF6>"::/Tmp/Gopher"</span><span class=cF0>);
|
||||
<a name="l171"></a>
|
||||
<a name="l172"></a> basename = </span><span class=cF5>ExtChange</span><span class=cF0>(GopherBasename</span><span class=cF7>(</span><span class=cF0>selector</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF6>"TXT"</span><span class=cF0>);
|
||||
<a name="l173"></a> tmpname = </span><span class=cF5>StrPrint</span><span class=cF0>(</span><span class=cF3>NULL</span><span class=cF0>, </span><span class=cF6>"::/Tmp/Gopher/%s"</span><span class=cF0>, basename);
|
||||
<a name="l174"></a> </span><span class=cF5>Free</span><span class=cF0>(basename);
|
||||
<a name="l175"></a>
|
||||
<a name="l176"></a> </span><span class=cF1>if</span><span class=cF0> (GopherDl</span><span class=cF7>(</span><span class=cF0>host, port, selector,, tmpname</span><span class=cF7>)</span><span class=cF0> == </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l177"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l178"></a> </span><span class=cF5>SysLog</span><span class=cF0>(</span><span class=cF6>"%s\n"</span><span class=cF0>, tmpname);
|
||||
<a name="l179"></a> </span><span class=cF5>Plain</span><span class=cF0>(tmpname);
|
||||
<a name="l180"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l181"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l182"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l183"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Failed to download %s from %s:%d\n"</span><span class=cF0>,
|
||||
<a name="l184"></a> selector, host, port);
|
||||
<a name="l185"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l186"></a> </span><span class=cF5>Free</span><span class=cF0>(tmpname);
|
||||
<a name="l187"></a>}
|
||||
<a name="l188"></a>
|
||||
<a name="l189"></a></span><span class=cF1>U0</span><span class=cF0> GopherLine(</span><span class=cF1>U8</span><span class=cF0> *line)
|
||||
<a name="l190"></a>{
|
||||
<a name="l191"></a> </span><span class=cF9>U64</span><span class=cF0> type;
|
||||
<a name="l192"></a> </span><span class=cF1>U8</span><span class=cF0> *display;
|
||||
<a name="l193"></a> </span><span class=cF1>U8</span><span class=cF0> *selector;
|
||||
<a name="l194"></a> </span><span class=cF1>U8</span><span class=cF0> *host = </span><span class=cF3>NULL</span><span class=cF0>;
|
||||
<a name="l195"></a> </span><span class=cF9>U16</span><span class=cF0> port = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l196"></a>
|
||||
<a name="l197"></a> </span><span class=cF1>if</span><span class=cF0> (*line == </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l198"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l199"></a> </span><span class=cF6>"\n"</span><span class=cF0>;
|
||||
<a name="l200"></a> </span><span class=cF1>return</span><span class=cF0>;
|
||||
<a name="l201"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l202"></a> type = *line++;
|
||||
<a name="l203"></a> display = line;
|
||||
<a name="l204"></a>
|
||||
<a name="l205"></a> line = </span><span class=cF5>StrFind</span><span class=cF0>(</span><span class=cF6>"\t"</span><span class=cF0>, line);
|
||||
<a name="l206"></a> </span><span class=cF1>if</span><span class=cF0> (line)
|
||||
<a name="l207"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l208"></a> *line = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l209"></a> line++;
|
||||
<a name="l210"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l211"></a> selector = line;
|
||||
<a name="l212"></a>
|
||||
<a name="l213"></a> </span><span class=cF1>if</span><span class=cF0> (line)
|
||||
<a name="l214"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l215"></a> line = </span><span class=cF5>StrFind</span><span class=cF0>(</span><span class=cF6>"\t"</span><span class=cF0>, line);
|
||||
<a name="l216"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l217"></a> </span><span class=cF1>if</span><span class=cF0> (line)
|
||||
<a name="l218"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l219"></a> *line = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l220"></a> line++;
|
||||
<a name="l221"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l222"></a> host = line;
|
||||
<a name="l223"></a>
|
||||
<a name="l224"></a> </span><span class=cF1>if</span><span class=cF0> (line)
|
||||
<a name="l225"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l226"></a> line = </span><span class=cF5>StrFind</span><span class=cF0>(</span><span class=cF6>"\t"</span><span class=cF0>, line);
|
||||
<a name="l227"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l228"></a> </span><span class=cF1>if</span><span class=cF0> (line)
|
||||
<a name="l229"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l230"></a> *line = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l231"></a> line++;
|
||||
<a name="l232"></a> port = </span><span class=cF5>Str2I64</span><span class=cF0>(line);
|
||||
<a name="l233"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l234"></a>
|
||||
<a name="l235"></a> </span><span class=cF1>if</span><span class=cF0> (!*host)
|
||||
<a name="l236"></a> </span><span class=cF1>return</span><span class=cF0>;
|
||||
<a name="l237"></a>
|
||||
<a name="l238"></a> </span><span class=cF1>switch</span><span class=cF0> (type)
|
||||
<a name="l239"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l240"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'3'</span><span class=cF0>:
|
||||
<a name="l241"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>""</span><span class=cF0>);
|
||||
<a name="l242"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF6>'i'</span><span class=cF0>:
|
||||
<a name="l243"></a> PrintEscaped(display);
|
||||
<a name="l244"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l245"></a> </span><span class=cF1>default</span><span class=cF0>:
|
||||
<a name="l246"></a> </span><span class=cF6>"$MA,\""</span><span class=cF0>;
|
||||
<a name="l247"></a> PrintEscaped(display, </span><span class=cF6>"\\"</span><span class=cF0>);
|
||||
<a name="l248"></a> </span><span class=cF6>"\",LM=\"%s(\\\""</span><span class=cF0>, gopher_associations[type];
|
||||
<a name="l249"></a> PrintEscaped(host, </span><span class=cF6>"\\\\\\"</span><span class=cF0>);
|
||||
<a name="l250"></a> </span><span class=cF6>"\\\",%d,\\\""</span><span class=cF0>, port;
|
||||
<a name="l251"></a> PrintEscaped(selector, </span><span class=cF6>"\\\\\\"</span><span class=cF0>);
|
||||
<a name="l252"></a> </span><span class=cF6>"\\\");\\n\"$"</span><span class=cF0>;
|
||||
<a name="l253"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l254"></a> </span><span class=cF6>"\n"</span><span class=cF0>;
|
||||
<a name="l255"></a>}
|
||||
<a name="l256"></a>
|
||||
<a name="l257"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> GopherMenu(</span><span class=cF1>U8</span><span class=cF0> *host, </span><span class=cF9>U16</span><span class=cF0> port = </span><span class=cFE>70</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *selector = </span><span class=cF6>"/"</span><span class=cF0>, </span><span class=cF1>U8</span><span class=cF0> *query = </span><span class=cF3>NULL</span><span class=cF0>)
|
||||
<a name="l258"></a>{
|
||||
<a name="l259"></a> </span><span class=cF9>I64</span><span class=cF0> sock, n;
|
||||
<a name="l260"></a> </span><span class=cF1>U8</span><span class=cF0> buf[</span><span class=cFE>256</span><span class=cF0>];
|
||||
<a name="l261"></a>
|
||||
<a name="l262"></a> sock = GopherOpen(host, port, selector, query);
|
||||
<a name="l263"></a> </span><span class=cF1>if</span><span class=cF0> (sock <= </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l264"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l265"></a> </span><span class=cF1>return</span><span class=cF0> sock;
|
||||
<a name="l266"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l267"></a>
|
||||
<a name="l268"></a> </span><span class=cF1>do</span><span class=cF0>
|
||||
<a name="l269"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l270"></a></span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>n = recvLine(sock, buf, sizeof(buf), 0);</span><span class=cF0>
|
||||
<a name="l271"></a> n = TCPSocketReceiveLine(sock, buf, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>buf</span><span class=cF7>)</span><span class=cF0>);
|
||||
<a name="l272"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>buf, </span><span class=cF6>"."</span><span class=cF7>)</span><span class=cF0> == </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l273"></a> {
|
||||
<a name="l274"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l275"></a> }
|
||||
<a name="l276"></a> GopherLine(buf);
|
||||
<a name="l277"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l278"></a> </span><span class=cF1>while</span><span class=cF0> (n > </span><span class=cFE>0</span><span class=cF0>);
|
||||
<a name="l279"></a>
|
||||
<a name="l280"></a></span><span class=cF2>//</span><span class=cF0> </span><span class=cF2>close(sock);</span><span class=cF0>
|
||||
<a name="l281"></a> TCPSocketClose(sock);
|
||||
<a name="l282"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l283"></a>}
|
||||
<a name="l284"></a>
|
||||
<a name="l285"></a></span><span class=cF1>class</span><span class=cF0> CQueryForm
|
||||
<a name="l286"></a>{
|
||||
<a name="l287"></a> </span><span class=cF1>U8</span><span class=cF0> query[</span><span class=cFE>65</span><span class=cF0>] format </span><span class=cF6>"$DA-P,A=\"Query:%s\"$"</span><span class=cF0>;
|
||||
<a name="l288"></a>};
|
||||
<a name="l289"></a></span><span class=cF1>U0</span><span class=cF0> GopherQueryPrompt(</span><span class=cF1>U8</span><span class=cF0> *host, </span><span class=cF9>U16</span><span class=cF0> port, </span><span class=cF1>U8</span><span class=cF0> *selector)
|
||||
<a name="l290"></a>{
|
||||
<a name="l291"></a> CQueryForm form;
|
||||
<a name="l292"></a>
|
||||
<a name="l293"></a> form.query[</span><span class=cFE>0</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l294"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PopUpForm</span><span class=cF7>(</span><span class=cF0>&form</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l295"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l296"></a> GopherMenu(host, port, selector, form.query);
|
||||
<a name="l297"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l298"></a>}
|
||||
<a name="l299"></a>
|
||||
<a name="l300"></a></span><span class=cF1>class</span><span class=cF0> CDlForm
|
||||
<a name="l301"></a>{
|
||||
<a name="l302"></a> </span><span class=cF1>U8</span><span class=cF0> name[</span><span class=cFE>256</span><span class=cF0>] format </span><span class=cF6>"$DA-P,LEN=255,A=\"FileName:%s\"$"</span><span class=cF0>;
|
||||
<a name="l303"></a>};
|
||||
<a name="l304"></a></span><span class=cF1>U0</span><span class=cF0> GopherDlPrompt(</span><span class=cF1>U8</span><span class=cF0> *host, </span><span class=cF9>U16</span><span class=cF0> port, </span><span class=cF1>U8</span><span class=cF0> *selector)
|
||||
<a name="l305"></a>{
|
||||
<a name="l306"></a> CDlForm form;
|
||||
<a name="l307"></a> </span><span class=cF1>U8</span><span class=cF0> *basename;
|
||||
<a name="l308"></a>
|
||||
<a name="l309"></a> basename = GopherBasename(selector);
|
||||
<a name="l310"></a> </span><span class=cF5>MemSet</span><span class=cF0>(form.name, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>256</span><span class=cF0>);
|
||||
<a name="l311"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(form.name, basename,
|
||||
<a name="l312"></a> </span><span class=cF5>MinI64</span><span class=cF7>(</span><span class=cF5>StrLen</span><span class=cF0>(basename), </span><span class=cF1>sizeof</span><span class=cF0>(form.name) - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>);
|
||||
<a name="l313"></a> form.name[</span><span class=cFE>255</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l314"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>PopUpForm</span><span class=cF7>(</span><span class=cF0>&form</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l315"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l316"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>form.name</span><span class=cF7>)</span><span class=cF0> >= </span><span class=cFE>26</span><span class=cF0>)
|
||||
<a name="l317"></a> form.name[</span><span class=cFE>25</span><span class=cF0>] = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l318"></a> GopherDl(host, port, selector,, form.name);
|
||||
<a name="l319"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l320"></a>}
|
||||
<a name="l321"></a>
|
||||
<a name="l322"></a></span><span class=cF1>public</span><span class=cF0> </span><span class=cF9>I64</span><span class=cF0> Gopher(</span><span class=cF1>U8</span><span class=cF0> *hostname)
|
||||
<a name="l323"></a>{
|
||||
<a name="l324"></a> </span><span class=cF1>return</span><span class=cF0> GopherMenu(hostname);
|
||||
<a name="l325"></a>}
|
||||
<a name="l326"></a>
|
||||
<a name="l327"></a></span><span class=cF5>MemSetI64</span><span class=cF0>(gopher_associations, </span><span class=cF6>"GopherDlPrompt"</span><span class=cF0>, </span><span class=cFE>256</span><span class=cF0>);
|
||||
<a name="l328"></a>gopher_associations[</span><span class=cF6>'0'</span><span class=cF0>] = </span><span class=cF6>"GopherTextView"</span><span class=cF0>;
|
||||
<a name="l329"></a>gopher_associations[</span><span class=cF6>'1'</span><span class=cF0>] = </span><span class=cF6>"GopherMenu"</span><span class=cF0>;
|
||||
<a name="l330"></a>gopher_associations[</span><span class=cF6>'7'</span><span class=cF0>] = </span><span class=cF6>"GopherQueryPrompt"</span><span class=cF0>;
|
||||
<a name="l331"></a></span><span class=cF2>/* Include this file from your Net/Load.ZC, then add more associations */</span><span class=cF0>
|
||||
<a name="l332"></a>
|
||||
<a name="l333"></a>
|
||||
<a name="l334"></a>
|
||||
<a name="l335"></a></span><span class=cF5>DocMax</span><span class=cF0>;
|
||||
<a name="l336"></a></span><span class=cF6>"\n\nTry using Gopher to connect to a gopher server, for example:"</span><span class=cF0>
|
||||
<a name="l337"></a></span><span class=cF6>"\n\n Gopher(\"gopher.floodgap.com\");"</span><span class=cF0>
|
||||
<a name="l338"></a></span><span class=cF6>"\n\n GopherMenu(\"eyeblea.ch\",70,\"/~zealos\");"</span><span class=cF0>
|
||||
<a name="l339"></a></span><span class=cF6>"\n\n Gopher(\"codevoid.de\");"</span><span class=cF0>
|
||||
<a name="l340"></a></span><span class=cF6>"\n\n"</span><span class=cF0>;</span></pre></body>
|
||||
<a name="l334"></a></span><span class=cF5>DocMax</span><span class=cF0>;
|
||||
<a name="l335"></a></span><span class=cF6>"\n\nTry using Gopher to connect to a gopher server, for example:"</span><span class=cF0>
|
||||
<a name="l336"></a></span><span class=cF6>"\n\n Gopher(\"gopher.floodgap.com\");"</span><span class=cF0>
|
||||
<a name="l337"></a></span><span class=cF6>"\n\n GopherMenu(\"eyeblea.ch\",70,\"/~zealos\");"</span><span class=cF0>
|
||||
<a name="l338"></a></span><span class=cF6>"\n\n Gopher(\"codevoid.de\");"</span><span class=cF0>
|
||||
<a name="l339"></a></span><span class=cF6>"\n\n"</span><span class=cF0>;</span></pre></body>
|
||||
</html>
|
||||
|
|
|
@ -40,70 +40,146 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l13"></a>};
|
||||
<a name="l14"></a>
|
||||
<a name="l15"></a>
|
||||
<a name="l16"></a></span><span class=cF1>U0</span><span class=cF0> ICMPReplySend(</span><span class=cF9>U32</span><span class=cF0> destination_ip_address,
|
||||
<a name="l17"></a> </span><span class=cF9>U16</span><span class=cF0> identifier,
|
||||
<a name="l18"></a> </span><span class=cF9>U16</span><span class=cF0> sequence_number,
|
||||
<a name="l19"></a> </span><span class=cF9>U16</span><span class=cF0> request_checksum,
|
||||
<a name="l20"></a> </span><span class=cF1>U8</span><span class=cF0> *payload,
|
||||
<a name="l21"></a> </span><span class=cF9>I64</span><span class=cF0> length)
|
||||
<a name="l22"></a>{
|
||||
<a name="l23"></a> </span><span class=cF1>U8</span><span class=cF0> *icmp_frame;
|
||||
<a name="l24"></a> </span><span class=cF9>I64</span><span class=cF0> de_index;
|
||||
<a name="l25"></a> CICMPHeader *header;
|
||||
<a name="l16"></a></span><span class=cF2>/*</span><span class=cF0> </span><span class=cF2>global variable containing last reply ICMP header received,</span><span class=cF0>
|
||||
<a name="l17"></a> </span><span class=cF2>Ping() checks this to make ping report.</span><span class=cF0>
|
||||
<a name="l18"></a></span><span class=cF2>*/</span><span class=cF0>
|
||||
<a name="l19"></a>CICMPHeader icmp_reply;
|
||||
<a name="l20"></a>
|
||||
<a name="l21"></a>
|
||||
<a name="l22"></a></span><span class=cF1>U0</span><span class=cF0> ICMPInit()
|
||||
<a name="l23"></a>{
|
||||
<a name="l24"></a> </span><span class=cF5>MemSet</span><span class=cF0>(&icmp_reply, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0>);
|
||||
<a name="l25"></a>}
|
||||
<a name="l26"></a>
|
||||
<a name="l27"></a> de_index = IPV4PacketAllocate(&icmp_frame,
|
||||
<a name="l28"></a> IP_PROTOCOL_ICMP,
|
||||
<a name="l29"></a> IPV4AddressGet,
|
||||
<a name="l30"></a> destination_ip_address,
|
||||
<a name="l31"></a> </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0> + length);
|
||||
<a name="l32"></a> </span><span class=cF1>if</span><span class=cF0> (de_index < </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l33"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l34"></a> NetErr(</span><span class=cF6>"ICMP SEND REPLY: Failed to allocate IPV4 packet."</span><span class=cF0>);
|
||||
<a name="l35"></a> </span><span class=cF1>return</span><span class=cF0>;
|
||||
<a name="l36"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l37"></a>
|
||||
<a name="l38"></a> header = icmp_frame;
|
||||
<a name="l39"></a>
|
||||
<a name="l40"></a> header->type = ICMP_TYPE_ECHO_REPLY;
|
||||
<a name="l41"></a> header->code = </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>// why is 0 okay?</span><span class=cF0>
|
||||
<a name="l42"></a> header->checksum = </span><span class=cF5>EndianU16</span><span class=cF0>(</span><span class=cF5>EndianU16</span><span class=cF7>(</span><span class=cF0>request_checksum</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>0x0800</span><span class=cF0>);
|
||||
<a name="l43"></a> header->identifier = identifier;
|
||||
<a name="l44"></a> header->sequence_number = sequence_number;
|
||||
<a name="l45"></a> </span><span class=cF2>// TODO: header checksum is awful. Shrine says hack alert.</span><span class=cF0>
|
||||
<a name="l27"></a>NetQueueInit;
|
||||
<a name="l28"></a>
|
||||
<a name="l29"></a></span><span class=cF9>U16</span><span class=cF0> ICMPChecksum(</span><span class=cF1>U8</span><span class=cF0> *buf, </span><span class=cF9>I64</span><span class=cF0> size)
|
||||
<a name="l30"></a>{
|
||||
<a name="l31"></a> </span><span class=cF9>U64</span><span class=cF0> i, sum = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l32"></a>
|
||||
<a name="l33"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < size; i += </span><span class=cFE>2</span><span class=cF0>)
|
||||
<a name="l34"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l35"></a> sum += *buf(</span><span class=cF9>U16</span><span class=cF0> *);
|
||||
<a name="l36"></a> buf += </span><span class=cFE>2</span><span class=cF0>;
|
||||
<a name="l37"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l38"></a>
|
||||
<a name="l39"></a> </span><span class=cF1>if</span><span class=cF0> (size - i > </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l40"></a> sum += *buf;
|
||||
<a name="l41"></a>
|
||||
<a name="l42"></a> </span><span class=cF1>while</span><span class=cF0> (sum >> </span><span class=cFE>16</span><span class=cF0> != </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l43"></a> sum = sum & </span><span class=cFE>0xFFFF</span><span class=cF0> + sum >> </span><span class=cFE>16</span><span class=cF0>;
|
||||
<a name="l44"></a>
|
||||
<a name="l45"></a> </span><span class=cF1>return</span><span class=cF0> ~sum(</span><span class=cF9>U16</span><span class=cF0>);
|
||||
<a name="l46"></a>
|
||||
<a name="l47"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(icmp_frame + </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0>, payload, length);
|
||||
<a name="l47"></a>}
|
||||
<a name="l48"></a>
|
||||
<a name="l49"></a> IPV4PacketFinish(de_index);
|
||||
<a name="l50"></a>}
|
||||
<a name="l51"></a>
|
||||
<a name="l52"></a></span><span class=cF9>I64</span><span class=cF0> ICMPHandler(CIPV4Packet *packet)
|
||||
<a name="l53"></a>{
|
||||
<a name="l54"></a> CICMPHeader *header;
|
||||
<a name="l55"></a>
|
||||
<a name="l56"></a> </span><span class=cF1>if</span><span class=cF0> (packet->length < </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l57"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l58"></a> NetErr(</span><span class=cF6>"ICMP HANDLER: Caught wrong IPV4 length."</span><span class=cF0>);
|
||||
<a name="l59"></a> </span><span class=cF1>return</span><span class=cF0> -</span><span class=cFE>1</span><span class=cF0>;
|
||||
<a name="l60"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l61"></a>
|
||||
<a name="l62"></a> header = packet->data;
|
||||
<a name="l63"></a>
|
||||
<a name="l64"></a> </span><span class=cF1>if</span><span class=cF0> (header->type == ICMP_TYPE_ECHO_REQUEST && header->code == ICMP_CODE_ECHO)
|
||||
<a name="l65"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l66"></a> ARPCachePut(packet->source_ip_address, packet->ethernet_frame->source_address);
|
||||
<a name="l67"></a>
|
||||
<a name="l68"></a> ICMPReplySend(packet->source_ip_address,
|
||||
<a name="l69"></a> header->identifier,
|
||||
<a name="l70"></a> header->sequence_number,
|
||||
<a name="l71"></a> header->checksum,
|
||||
<a name="l72"></a> packet->data + </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF2>// Data payload at IPV4Packet data location after the ICMP header</span><span class=cF0>
|
||||
<a name="l73"></a> packet->length - </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0>);</span><span class=cF2>// Payload length is size of packet after dropping header.</span><span class=cF0>
|
||||
<a name="l74"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l75"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l76"></a> NetWarn(</span><span class=cF6>"ICMP HANDLER: Unhandled ICMP packet. type, code: 0x%X, 0x%X"</span><span class=cF0>, header->type, header->code);
|
||||
<a name="l77"></a>
|
||||
<a name="l78"></a> NetLog(</span><span class=cF6>"ICMP HANDLER: Exiting."</span><span class=cF0>);
|
||||
<a name="l79"></a>
|
||||
<a name="l80"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l81"></a>}</span></pre></body>
|
||||
<a name="l49"></a>
|
||||
<a name="l50"></a></span><span class=cF1>U0</span><span class=cF0> ICMPReplySend(</span><span class=cF9>U32</span><span class=cF0> destination_ip_address,
|
||||
<a name="l51"></a> </span><span class=cF9>U16</span><span class=cF0> identifier,
|
||||
<a name="l52"></a> </span><span class=cF9>U16</span><span class=cF0> sequence_number,
|
||||
<a name="l53"></a> </span><span class=cF9>U16</span><span class=cF0> request_checksum,
|
||||
<a name="l54"></a> </span><span class=cF1>U8</span><span class=cF0> *payload,
|
||||
<a name="l55"></a> </span><span class=cF9>I64</span><span class=cF0> length)
|
||||
<a name="l56"></a>{
|
||||
<a name="l57"></a> </span><span class=cF1>U8</span><span class=cF0> *icmp_frame;
|
||||
<a name="l58"></a> </span><span class=cF9>I64</span><span class=cF0> de_index;
|
||||
<a name="l59"></a> CICMPHeader *header;
|
||||
<a name="l60"></a>
|
||||
<a name="l61"></a> de_index = IPV4PacketAllocate(&icmp_frame,
|
||||
<a name="l62"></a> IP_PROTOCOL_ICMP,
|
||||
<a name="l63"></a> IPV4AddressGet,
|
||||
<a name="l64"></a> destination_ip_address,
|
||||
<a name="l65"></a> </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0> + length);
|
||||
<a name="l66"></a> </span><span class=cF1>if</span><span class=cF0> (de_index < </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l67"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l68"></a> NetErr(</span><span class=cF6>"ICMP SEND REPLY: Failed to allocate IPV4 packet."</span><span class=cF0>);
|
||||
<a name="l69"></a> </span><span class=cF1>return</span><span class=cF0>;
|
||||
<a name="l70"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l71"></a>
|
||||
<a name="l72"></a> header = icmp_frame;
|
||||
<a name="l73"></a>
|
||||
<a name="l74"></a> header->type = ICMP_TYPE_ECHO_REPLY;
|
||||
<a name="l75"></a> header->code = </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>// why is 0 okay?</span><span class=cF0>
|
||||
<a name="l76"></a> header->checksum = </span><span class=cF5>EndianU16</span><span class=cF0>(</span><span class=cF5>EndianU16</span><span class=cF7>(</span><span class=cF0>request_checksum</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>0x0800</span><span class=cF0>);
|
||||
<a name="l77"></a> header->identifier = identifier;
|
||||
<a name="l78"></a> header->sequence_number = sequence_number;
|
||||
<a name="l79"></a> </span><span class=cF2>// TODO: header checksum is awful. Shrine says hack alert.</span><span class=cF0>
|
||||
<a name="l80"></a>
|
||||
<a name="l81"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(icmp_frame + </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0>, payload, length);
|
||||
<a name="l82"></a>
|
||||
<a name="l83"></a> IPV4PacketFinish(de_index);
|
||||
<a name="l84"></a>}
|
||||
<a name="l85"></a>
|
||||
<a name="l86"></a></span><span class=cF1>U0</span><span class=cF0> ICMPRequestSend(</span><span class=cF9>U32</span><span class=cF0> destination_ip_address,
|
||||
<a name="l87"></a> </span><span class=cF9>U16</span><span class=cF0> identifier,
|
||||
<a name="l88"></a> </span><span class=cF9>U16</span><span class=cF0> sequence_number,
|
||||
<a name="l89"></a> </span><span class=cF1>U8</span><span class=cF0> *payload,
|
||||
<a name="l90"></a> </span><span class=cF9>I64</span><span class=cF0> length)
|
||||
<a name="l91"></a>{
|
||||
<a name="l92"></a> </span><span class=cF1>U8</span><span class=cF0> *icmp_frame;
|
||||
<a name="l93"></a> </span><span class=cF9>I64</span><span class=cF0> de_index;
|
||||
<a name="l94"></a> CICMPHeader *header;
|
||||
<a name="l95"></a>
|
||||
<a name="l96"></a> de_index = IPV4PacketAllocate(&icmp_frame,
|
||||
<a name="l97"></a> IP_PROTOCOL_ICMP,
|
||||
<a name="l98"></a> IPV4AddressGet,
|
||||
<a name="l99"></a> destination_ip_address,
|
||||
<a name="l100"></a> </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0> + length);
|
||||
<a name="l101"></a> </span><span class=cF1>if</span><span class=cF0> (de_index < </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l102"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l103"></a> NetErr(</span><span class=cF6>"ICMP SEND REQUEST: Failed to allocate IPV4 packet."</span><span class=cF0>);
|
||||
<a name="l104"></a> </span><span class=cF1>return</span><span class=cF0>;
|
||||
<a name="l105"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l106"></a>
|
||||
<a name="l107"></a> header = icmp_frame;
|
||||
<a name="l108"></a>
|
||||
<a name="l109"></a> header->type = ICMP_TYPE_ECHO_REQUEST;
|
||||
<a name="l110"></a> header->code = </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>// why is 0 okay?</span><span class=cF0>
|
||||
<a name="l111"></a> header->checksum = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l112"></a> header->identifier = identifier;
|
||||
<a name="l113"></a> header->sequence_number = sequence_number;
|
||||
<a name="l114"></a>
|
||||
<a name="l115"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(icmp_frame + </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0>, payload, length);
|
||||
<a name="l116"></a>
|
||||
<a name="l117"></a> header->checksum = ICMPChecksum(header, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0> + length);
|
||||
<a name="l118"></a>
|
||||
<a name="l119"></a> IPV4PacketFinish(de_index);
|
||||
<a name="l120"></a>}
|
||||
<a name="l121"></a>
|
||||
<a name="l122"></a></span><span class=cF9>I64</span><span class=cF0> ICMPHandler(CIPV4Packet *packet)
|
||||
<a name="l123"></a>{
|
||||
<a name="l124"></a> CICMPHeader *header;
|
||||
<a name="l125"></a>
|
||||
<a name="l126"></a> </span><span class=cF1>if</span><span class=cF0> (packet->length < </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l127"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l128"></a> NetErr(</span><span class=cF6>"ICMP HANDLER: Caught wrong IPV4 length."</span><span class=cF0>);
|
||||
<a name="l129"></a> </span><span class=cF1>return</span><span class=cF0> -</span><span class=cFE>1</span><span class=cF0>;
|
||||
<a name="l130"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l131"></a>
|
||||
<a name="l132"></a> header = packet->data;
|
||||
<a name="l133"></a>
|
||||
<a name="l134"></a> </span><span class=cF1>if</span><span class=cF0> (header->type == ICMP_TYPE_ECHO_REQUEST && header->code == ICMP_CODE_ECHO)
|
||||
<a name="l135"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l136"></a> ARPCachePut(packet->source_ip_address, packet->ethernet_frame->source_address);
|
||||
<a name="l137"></a>
|
||||
<a name="l138"></a> ICMPReplySend(packet->source_ip_address,
|
||||
<a name="l139"></a> header->identifier,
|
||||
<a name="l140"></a> header->sequence_number,
|
||||
<a name="l141"></a> header->checksum,
|
||||
<a name="l142"></a> packet->data + </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0>, </span><span class=cF2>// Data payload at IPV4Packet data location after the ICMP header</span><span class=cF0>
|
||||
<a name="l143"></a> packet->length - </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0>);</span><span class=cF2>// Payload length is size of packet after dropping header.</span><span class=cF0>
|
||||
<a name="l144"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l145"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (header->type == ICMP_TYPE_ECHO_REPLY && header->code == ICMP_CODE_ECHO)
|
||||
<a name="l146"></a> </span><span class=cF7>{</span><span class=cF0> </span><span class=cF2>// save the reply to the global ICMP reply header</span><span class=cF0>
|
||||
<a name="l147"></a> </span><span class=cF5>MemCopy</span><span class=cF0>(&icmp_reply, header, </span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF0>CICMPHeader</span><span class=cF7>)</span><span class=cF0>);
|
||||
<a name="l148"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l149"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l150"></a> NetWarn(</span><span class=cF6>"ICMP HANDLER: Unhandled ICMP packet. type, code: 0x%X, 0x%X"</span><span class=cF0>, header->type, header->code);
|
||||
<a name="l151"></a>
|
||||
<a name="l152"></a> NetLog(</span><span class=cF6>"ICMP HANDLER: Exiting."</span><span class=cF0>);
|
||||
<a name="l153"></a>
|
||||
<a name="l154"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l155"></a>}
|
||||
<a name="l156"></a>
|
||||
<a name="l157"></a>ICMPInit;</span></pre></body>
|
||||
</html>
|
||||
|
|
|
@ -304,8 +304,8 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l277"></a>
|
||||
<a name="l278"></a> </span><span class=cF2>// review RFC Reset-Generation ...</span><span class=cF0>
|
||||
<a name="l279"></a>
|
||||
<a name="l280"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&header->flags, TCPf_RST</span><span class=cF7>)</span><span class=cF0> && </span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&header->flags, TCPf_ACK</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l281"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>// bail: we probably sent an RST earlier, and this is the acknowledgement</span><span class=cF0>
|
||||
<a name="l280"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Bt</span><span class=cF7>(</span><span class=cF0>&header->flags, TCPf_RST</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l281"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cFE>0</span><span class=cF0>; </span><span class=cF2>// bail: don't respond to a reset for a connection that doesn't exist</span><span class=cF0>
|
||||
<a name="l282"></a>
|
||||
<a name="l283"></a> de_index = TCPSend(packet->destination_ip_address,
|
||||
<a name="l284"></a> </span><span class=cF5>EndianU16</span><span class=cF7>(</span><span class=cF0>header->destination_port</span><span class=cF7>)</span><span class=cF0>,
|
||||
|
|
|
@ -25,25 +25,26 @@ body {background-color:#1f1f1f;}
|
|||
</head>
|
||||
<body>
|
||||
<pre style="font-family:monospace;font-size:12pt">
|
||||
<a name="l1"></a><span class=cF5>Cd</span><span class=cF0>(</span><span class=cF3>__DIR__</span><span class=cF0>);;
|
||||
<a name="l2"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Load"</span><span class=cF0>
|
||||
<a name="l3"></a>NetConfigure;
|
||||
<a name="l4"></a>
|
||||
<a name="l5"></a></span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0> != </span><span class=cFB>sys_task</span><span class=cF0>)
|
||||
<a name="l6"></a>{
|
||||
<a name="l7"></a> </span><span class=cF1>if</span><span class=cF0> (ipv4_globals.local_ip != </span><span class=cFE>0</span><span class=cF0>) </span><span class=cF2>// is set if NetConfigure is successful</span><span class=cF0>
|
||||
<a name="l8"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l9"></a> NetRep;
|
||||
<a name="l10"></a>
|
||||
<a name="l11"></a> </span><span class=cF6>"\nNow run one of the </span><span class=cF9><u>Tests</u></span><span class=cF6> or </span><span class=cF9><u>Programs</u></span><span class=cF6>.\n"</span><span class=cF0>;
|
||||
<a name="l12"></a>
|
||||
<a name="l13"></a> </span><span class=cF6>"\nIf a test crashes to Debug, try typing G2;\n\n"</span><span class=cF0>;
|
||||
<a name="l14"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l15"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l16"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l17"></a> </span><span class=cF6>"\nNetConfigure unsuccessful. See Network Log for details.\n\n"</span><span class=cF0>;
|
||||
<a name="l18"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l19"></a>
|
||||
<a name="l20"></a>}
|
||||
<a name="l1"></a><span class=cF0>
|
||||
<a name="l2"></a></span><span class=cF5>Cd</span><span class=cF0>(</span><span class=cF3>__DIR__</span><span class=cF0>);;
|
||||
<a name="l3"></a>#</span><span class=cF1>include</span><span class=cF0> </span><span class=cF6>"Load"</span><span class=cF0>
|
||||
<a name="l4"></a>NetConfigure;
|
||||
<a name="l5"></a>
|
||||
<a name="l6"></a></span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0> != </span><span class=cFB>sys_task</span><span class=cF0>)
|
||||
<a name="l7"></a>{
|
||||
<a name="l8"></a> </span><span class=cF1>if</span><span class=cF0> (ipv4_globals.local_ip != </span><span class=cFE>0</span><span class=cF0>) </span><span class=cF2>// is set if NetConfigure is successful</span><span class=cF0>
|
||||
<a name="l9"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l10"></a> NetRep;
|
||||
<a name="l11"></a>
|
||||
<a name="l12"></a> </span><span class=cF6>"\nNow run one of the </span><span class=cF9><u>Tests</u></span><span class=cF6> or </span><span class=cF9><u>Programs</u></span><span class=cF6>.\n"</span><span class=cF0>;
|
||||
<a name="l13"></a>
|
||||
<a name="l14"></a> </span><span class=cF6>"\nIf a test crashes to Debug, try typing G2;\n\n"</span><span class=cF0>;
|
||||
<a name="l15"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l16"></a> </span><span class=cF1>else</span><span class=cF0>
|
||||
<a name="l17"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l18"></a> </span><span class=cF6>"\nNetConfigure unsuccessful. See Network Log for details.\n\n"</span><span class=cF0>;
|
||||
<a name="l19"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l20"></a>
|
||||
<a name="l21"></a>}
|
||||
</span></pre></body>
|
||||
</html>
|
||||
|
|
41
docs/Home/Net/Tests/ICMPTest1.ZC.html
Executable file
41
docs/Home/Net/Tests/ICMPTest1.ZC.html
Executable file
|
@ -0,0 +1,41 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
||||
<meta name="generator" content="ZealOS V1.07">
|
||||
<style type="text/css">
|
||||
body {background-color:#1f1f1f;}
|
||||
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
|
||||
.cF1{color:#4f84a6;background-color:#1f1f1f;}
|
||||
.cF2{color:#73a255;background-color:#1f1f1f;}
|
||||
.cF3{color:#297582;background-color:#1f1f1f;}
|
||||
.cF4{color:#b34f4b;background-color:#1f1f1f;}
|
||||
.cF5{color:#8a52c3;background-color:#1f1f1f;}
|
||||
.cF6{color:#b7822f;background-color:#1f1f1f;}
|
||||
.cF7{color:#444444;background-color:#1f1f1f;}
|
||||
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
|
||||
.cF9{color:#94bfde;background-color:#1f1f1f;}
|
||||
.cFA{color:#a1ce97;background-color:#1f1f1f;}
|
||||
.cFB{color:#6db4be;background-color:#1f1f1f;}
|
||||
.cFC{color:#e88e88;background-color:#1f1f1f;}
|
||||
.cFD{color:#ca94e8;background-color:#1f1f1f;}
|
||||
.cFE{color:#d4b475;background-color:#1f1f1f;}
|
||||
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre style="font-family:monospace;font-size:12pt">
|
||||
<a name="l1"></a><span class=cF1>U0</span><span class=cF0> ICMPTest()
|
||||
<a name="l2"></a>{
|
||||
<a name="l3"></a> </span><span class=cF9>U32</span><span class=cF0> a = </span><span class=cFE>0x08080808</span><span class=cF0>;
|
||||
<a name="l4"></a> </span><span class=cF1>U8</span><span class=cF0> *b = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cFE>64</span><span class=cF0>);
|
||||
<a name="l5"></a> </span><span class=cF9>I64</span><span class=cF0> i;
|
||||
<a name="l6"></a>
|
||||
<a name="l7"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>64</span><span class=cF0>; i++)
|
||||
<a name="l8"></a> b[i] = </span><span class=cF5>RandU8</span><span class=cF0>;
|
||||
<a name="l9"></a>
|
||||
<a name="l10"></a> ICMPRequestSend(a, </span><span class=cFE>0</span><span class=cF0>, </span><span class=cFE>0</span><span class=cF0>, b, </span><span class=cFE>64</span><span class=cF0>);
|
||||
<a name="l11"></a>}
|
||||
<a name="l12"></a>
|
||||
<a name="l13"></a>ICMPTest;</span></pre></body>
|
||||
</html>
|
|
@ -37,21 +37,22 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l9"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/EthernetTest.ZC.html#l1"><span class=cF4>EthernetTest.ZC</span></a><span class=cF4>
|
||||
<a name="l10"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/HostTest0.ZC.html#l1"><span class=cF4>HostTest0.ZC</span></a><span class=cF4>
|
||||
<a name="l11"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/HostTest1.ZC.html#l1"><span class=cF4>HostTest1.ZC</span></a><span class=cF4>
|
||||
<a name="l12"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/ICMPTest.ZC.html#l1"><span class=cF4>ICMPTest.ZC</span></a><span class=cF4>
|
||||
<a name="l13"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/IPV4Test.ZC.html#l1"><span class=cF4>IPV4Test.ZC</span></a><span class=cF4>
|
||||
<a name="l14"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/PCNetTest.ZC.html#l1"><span class=cF4>PCNetTest.ZC</span></a><span class=cF4>
|
||||
<a name="l15"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/PCP.ZC.html#l1"><span class=cF4>PCP.ZC</span></a><span class=cF4>
|
||||
<a name="l16"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/TCPEchoClient.ZC.html#l1"><span class=cF4>TCPEchoClient.ZC</span></a><span class=cF4>
|
||||
<a name="l17"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/TCPEchoServer.ZC.html#l1"><span class=cF4>TCPEchoServer.ZC</span></a><span class=cF4>
|
||||
<a name="l18"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/TCPTest0.ZC.html#l1"><span class=cF4>TCPTest0.ZC</span></a><span class=cF4>
|
||||
<a name="l19"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/TCPTest1.ZC.html#l1"><span class=cF4>TCPTest1.ZC</span></a><span class=cF4>
|
||||
<a name="l20"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/TCPTest2.ZC.html#l1"><span class=cF4>TCPTest2.ZC</span></a><span class=cF4>
|
||||
<a name="l21"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/UDPSocketTest0.ZC.html#l1"><span class=cF4>UDPSocketTest0.ZC</span></a><span class=cF4>
|
||||
<a name="l22"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/UDPSocketTest1.ZC.html#l1"><span class=cF4>UDPSocketTest1.ZC</span></a><span class=cF4>
|
||||
<a name="l23"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/UDPSocketTest2.ZC.html#l1"><span class=cF4>UDPSocketTest2.ZC</span></a><span class=cF4>
|
||||
<a name="l24"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/UDPTest0.ZC.html#l1"><span class=cF4>UDPTest0.ZC</span></a><span class=cF4>
|
||||
<a name="l25"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/UDPTest1.ZC.html#l1"><span class=cF4>UDPTest1.ZC</span></a><span class=cF0>
|
||||
<a name="l26"></a>
|
||||
<a name="l12"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/ICMPTest0.ZC.html#l1"><span class=cF4>ICMPTest0.ZC</span></a><span class=cF4>
|
||||
<a name="l13"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/ICMPTest1.ZC.html#l1"><span class=cF4>ICMPTest1.ZC</span></a><span class=cF4>
|
||||
<a name="l14"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/IPV4Test.ZC.html#l1"><span class=cF4>IPV4Test.ZC</span></a><span class=cF4>
|
||||
<a name="l15"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/PCNetTest.ZC.html#l1"><span class=cF4>PCNetTest.ZC</span></a><span class=cF4>
|
||||
<a name="l16"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/PCP.ZC.html#l1"><span class=cF4>PCP.ZC</span></a><span class=cF4>
|
||||
<a name="l17"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/TCPEchoClient.ZC.html#l1"><span class=cF4>TCPEchoClient.ZC</span></a><span class=cF4>
|
||||
<a name="l18"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/TCPEchoServer.ZC.html#l1"><span class=cF4>TCPEchoServer.ZC</span></a><span class=cF4>
|
||||
<a name="l19"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/TCPTest0.ZC.html#l1"><span class=cF4>TCPTest0.ZC</span></a><span class=cF4>
|
||||
<a name="l20"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/TCPTest1.ZC.html#l1"><span class=cF4>TCPTest1.ZC</span></a><span class=cF4>
|
||||
<a name="l21"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/TCPTest2.ZC.html#l1"><span class=cF4>TCPTest2.ZC</span></a><span class=cF4>
|
||||
<a name="l22"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/UDPSocketTest0.ZC.html#l1"><span class=cF4>UDPSocketTest0.ZC</span></a><span class=cF4>
|
||||
<a name="l23"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/UDPSocketTest1.ZC.html#l1"><span class=cF4>UDPSocketTest1.ZC</span></a><span class=cF4>
|
||||
<a name="l24"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/UDPSocketTest2.ZC.html#l1"><span class=cF4>UDPSocketTest2.ZC</span></a><span class=cF4>
|
||||
<a name="l25"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/UDPTest0.ZC.html#l1"><span class=cF4>UDPTest0.ZC</span></a><span class=cF4>
|
||||
<a name="l26"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Tests/UDPTest1.ZC.html#l1"><span class=cF4>UDPTest1.ZC</span></a><span class=cF0>
|
||||
<a name="l27"></a>
|
||||
<a name="l28"></a>
|
||||
</span></pre></body>
|
||||
</html>
|
||||
|
|
107
docs/Home/Net/Utilities/Ping.ZC.html
Executable file
107
docs/Home/Net/Utilities/Ping.ZC.html
Executable file
|
@ -0,0 +1,107 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
||||
<meta name="generator" content="ZealOS V1.07">
|
||||
<style type="text/css">
|
||||
body {background-color:#1f1f1f;}
|
||||
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
|
||||
.cF1{color:#4f84a6;background-color:#1f1f1f;}
|
||||
.cF2{color:#73a255;background-color:#1f1f1f;}
|
||||
.cF3{color:#297582;background-color:#1f1f1f;}
|
||||
.cF4{color:#b34f4b;background-color:#1f1f1f;}
|
||||
.cF5{color:#8a52c3;background-color:#1f1f1f;}
|
||||
.cF6{color:#b7822f;background-color:#1f1f1f;}
|
||||
.cF7{color:#444444;background-color:#1f1f1f;}
|
||||
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
|
||||
.cF9{color:#94bfde;background-color:#1f1f1f;}
|
||||
.cFA{color:#a1ce97;background-color:#1f1f1f;}
|
||||
.cFB{color:#6db4be;background-color:#1f1f1f;}
|
||||
.cFC{color:#e88e88;background-color:#1f1f1f;}
|
||||
.cFD{color:#ca94e8;background-color:#1f1f1f;}
|
||||
.cFE{color:#d4b475;background-color:#1f1f1f;}
|
||||
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre style="font-family:monospace;font-size:12pt">
|
||||
<a name="l1"></a><span class=cF9>I64</span><span class=cF0> Ping(</span><span class=cF1>U8</span><span class=cF0> *hostname, </span><span class=cF9>I64</span><span class=cF0> timeout=</span><span class=cF3>JIFFY_FREQ</span><span class=cF0>)
|
||||
<a name="l2"></a>{
|
||||
<a name="l3"></a> </span><span class=cF9>U32</span><span class=cF0> addr;
|
||||
<a name="l4"></a> CAddressInfo *current;
|
||||
<a name="l5"></a> CAddressInfo *result = </span><span class=cF3>NULL</span><span class=cF0>;
|
||||
<a name="l6"></a> </span><span class=cF9>I64</span><span class=cF0> error;
|
||||
<a name="l7"></a> </span><span class=cF9>I64</span><span class=cF0> i = </span><span class=cFE>0</span><span class=cF0>, t, delay, sent = </span><span class=cFE>0</span><span class=cF0>, min_delay = </span><span class=cF3>I64_MAX</span><span class=cF0>, max_delay = </span><span class=cF3>I64_MIN</span><span class=cF0>, sum_delay = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l8"></a> CSocketAddressIPV4 *ipv4_address;
|
||||
<a name="l9"></a> </span><span class=cF9>U16</span><span class=cF0> sequence_number = </span><span class=cFE>1</span><span class=cF0>, identifier = </span><span class=cF5>RandU16</span><span class=cF0>, count = </span><span class=cFE>0</span><span class=cF0>;
|
||||
<a name="l10"></a> </span><span class=cF1>U8</span><span class=cF0> *payload;
|
||||
<a name="l11"></a>
|
||||
<a name="l12"></a> </span><span class=cF1>if</span><span class=cF0> (!IPV4AddressParse</span><span class=cF7>(</span><span class=cF0>hostname, &addr</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l13"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l14"></a> error = DNSAddressInfoGet(hostname, </span><span class=cF3>NULL</span><span class=cF0>, &result);
|
||||
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (error < </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l16"></a> {
|
||||
<a name="l17"></a> NetErr(</span><span class=cF6>"Ping: Failed at DNS Get Address Info."</span><span class=cF0>);
|
||||
<a name="l18"></a> </span><span class=cF1>return</span><span class=cF0> -</span><span class=cFE>1</span><span class=cF0>;
|
||||
<a name="l19"></a> }
|
||||
<a name="l20"></a> current = result;
|
||||
<a name="l21"></a> </span><span class=cF1>while</span><span class=cF0> (current)
|
||||
<a name="l22"></a> {
|
||||
<a name="l23"></a> </span><span class=cF1>if</span><span class=cF0> (current->family == AF_INET)
|
||||
<a name="l24"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l25"></a> ipv4_address = current->address;
|
||||
<a name="l26"></a> addr = </span><span class=cF5>EndianU32</span><span class=cF0>(ipv4_address->address); </span><span class=cF2>// why does it need EndianU32</span><span class=cF0>
|
||||
<a name="l27"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l28"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l29"></a> current = current->next;
|
||||
<a name="l30"></a> }
|
||||
<a name="l31"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l32"></a>
|
||||
<a name="l33"></a> </span><span class=cF1>if</span><span class=cF0> (!current)
|
||||
<a name="l34"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l35"></a> NetErr(</span><span class=cF6>"Ping: Failed to resolve address."</span><span class=cF0>);
|
||||
<a name="l36"></a> </span><span class=cF1>return</span><span class=cF0> -</span><span class=cFE>1</span><span class=cF0>;
|
||||
<a name="l37"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l38"></a>
|
||||
<a name="l39"></a> </span><span class=cF1>while</span><span class=cF0> (!</span><span class=cF5>CharScan</span><span class=cF0>)
|
||||
<a name="l40"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l41"></a> payload = </span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cFE>64</span><span class=cF0>);
|
||||
<a name="l42"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i < </span><span class=cFE>64</span><span class=cF0>; i++)
|
||||
<a name="l43"></a> payload[i] = </span><span class=cF5>RandU8</span><span class=cF0>;
|
||||
<a name="l44"></a>
|
||||
<a name="l45"></a> </span><span class=cF6>"Sending Ping request #%d\n"</span><span class=cF0>, sequence_number;
|
||||
<a name="l46"></a> ICMPRequestSend(addr, identifier, </span><span class=cF5>EndianU16</span><span class=cF7>(</span><span class=cF0>sequence_number</span><span class=cF7>)</span><span class=cF0>, payload, </span><span class=cFE>64</span><span class=cF0>);
|
||||
<a name="l47"></a> sent++;
|
||||
<a name="l48"></a>
|
||||
<a name="l49"></a> t = </span><span class=cFB>counts</span><span class=cF0>.jiffies;
|
||||
<a name="l50"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cFB>counts</span><span class=cF0>.jiffies < t + timeout)
|
||||
<a name="l51"></a> {
|
||||
<a name="l52"></a> </span><span class=cF1>if</span><span class=cF0> (icmp_reply.identifier == identifier && icmp_reply.sequence_number == </span><span class=cF5>EndianU16</span><span class=cF7>(</span><span class=cF0>sequence_number</span><span class=cF7>)</span><span class=cF0>)
|
||||
<a name="l53"></a> </span><span class=cF7>{</span><span class=cF0>
|
||||
<a name="l54"></a> delay = </span><span class=cFB>counts</span><span class=cF0>.jiffies - t;
|
||||
<a name="l55"></a> min_delay = </span><span class=cF5>MinI64</span><span class=cF0>(min_delay, delay);
|
||||
<a name="l56"></a> max_delay = </span><span class=cF5>MaxI64</span><span class=cF0>(max_delay, delay);
|
||||
<a name="l57"></a> sum_delay += delay; </span><span class=cF2>// sum up delays, divide through by count during stat report to get average</span><span class=cF0>
|
||||
<a name="l58"></a> count++;
|
||||
<a name="l59"></a> </span><span class=cF6>"\tReceived reply, delay: %dms\n"</span><span class=cF0>, delay;
|
||||
<a name="l60"></a> </span><span class=cF1>break</span><span class=cF0>;
|
||||
<a name="l61"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l62"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>);
|
||||
<a name="l63"></a> }
|
||||
<a name="l64"></a> </span><span class=cF1>while</span><span class=cF0> (</span><span class=cFB>counts</span><span class=cF0>.jiffies < t + </span><span class=cF3>JIFFY_FREQ</span><span class=cF0>)
|
||||
<a name="l65"></a> </span><span class=cF5>Sleep</span><span class=cF0>(</span><span class=cFE>1</span><span class=cF0>);
|
||||
<a name="l66"></a>
|
||||
<a name="l67"></a> sequence_number++;
|
||||
<a name="l68"></a> </span><span class=cF5>Free</span><span class=cF0>(payload);
|
||||
<a name="l69"></a> </span><span class=cF7>}</span><span class=cF0>
|
||||
<a name="l70"></a>
|
||||
<a name="l71"></a> </span><span class=cF6>"\nPing Statistics:\n"</span><span class=cF0>;
|
||||
<a name="l72"></a> </span><span class=cF6>"\tSent: %d, Received: %d, Lost: %d (%0.02f %%)\n"</span><span class=cF0>, sent, count, sent - count, </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> - </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * count / sent;
|
||||
<a name="l73"></a> </span><span class=cF1>if</span><span class=cF0> (min_delay != </span><span class=cF3>I64_MAX</span><span class=cF0> && max_delay != </span><span class=cF3>I64_MIN</span><span class=cF0> && sum_delay != </span><span class=cFE>0</span><span class=cF0>)
|
||||
<a name="l74"></a> </span><span class=cF6>"\tMin: %dms, Max: %dms, Avg: %dms\n"</span><span class=cF0>, min_delay, max_delay, sum_delay / count;
|
||||
<a name="l75"></a> </span><span class=cF6>"\n"</span><span class=cF0>;
|
||||
<a name="l76"></a>
|
||||
<a name="l77"></a> </span><span class=cF1>return</span><span class=cF0> count;
|
||||
<a name="l78"></a>
|
||||
<a name="l79"></a>}</span></pre></body>
|
||||
</html>
|
|
@ -34,8 +34,9 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l6"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Utilities/BST.ZC.html#l1"><span class=cF4>BST.ZC</span></a><span class=cF4>
|
||||
<a name="l7"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Utilities/NetHandler.ZC.html#l1"><span class=cF4>NetHandler.ZC</span></a><span class=cF4>
|
||||
<a name="l8"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Utilities/NetLog.ZC.html#l1"><span class=cF4>NetLog.ZC</span></a><span class=cF4>
|
||||
<a name="l9"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Utilities/NetQueue.ZC.html#l1"><span class=cF4>NetQueue.ZC</span></a><span class=cF0>
|
||||
<a name="l10"></a>
|
||||
<a name="l9"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Utilities/NetQueue.ZC.html#l1"><span class=cF4>NetQueue.ZC</span></a><span class=cF4>
|
||||
<a name="l10"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Net/Utilities/Ping.ZC.html#l1"><span class=cF4>Ping.ZC</span></a><span class=cF0>
|
||||
<a name="l11"></a>
|
||||
<a name="l12"></a>
|
||||
</span></pre></body>
|
||||
</html>
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
||||
<meta name="generator" content="ZealOS V1.07">
|
||||
<style type="text/css">
|
||||
body {background-color:#1f1f1f;}
|
||||
.c0A{color:#a1ce97;background-color:#e3e3e3;}
|
||||
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
|
||||
.cF1{color:#4f84a6;background-color:#1f1f1f;}
|
||||
.cF2{color:#73a255;background-color:#1f1f1f;}
|
||||
.cF3{color:#297582;background-color:#1f1f1f;}
|
||||
.cF4{color:#b34f4b;background-color:#1f1f1f;}
|
||||
.cF5{color:#8a52c3;background-color:#1f1f1f;}
|
||||
.cF6{color:#b7822f;background-color:#1f1f1f;}
|
||||
.cF7{color:#444444;background-color:#1f1f1f;}
|
||||
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
|
||||
.cF9{color:#94bfde;background-color:#1f1f1f;}
|
||||
.cFA{color:#a1ce97;background-color:#1f1f1f;}
|
||||
.cFB{color:#6db4be;background-color:#1f1f1f;}
|
||||
.cFC{color:#e88e88;background-color:#1f1f1f;}
|
||||
.cFD{color:#ca94e8;background-color:#1f1f1f;}
|
||||
.cFE{color:#d4b475;background-color:#1f1f1f;}
|
||||
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre style="font-family:monospace;font-size:12pt">
|
||||
<a name="l1"></a><span class=cF5><u>+] System
|
||||
<a name="l2"></a>+] Once</span><span class=c0A>
|
||||
<a name="l3"></a>+] AutoComplete</u></span><span class=cF0>
|
||||
</span></pre></body>
|
||||
</html>
|
|
@ -36,9 +36,8 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l8"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/DoDistro.ZC.html#l1"><span class=cF4>DoDistro.ZC</span></a><span class=cF4>
|
||||
<a name="l9"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/HtmlGen.ZC.html#l1"><span class=cF4>HtmlGen.ZC</span></a><span class=cF4>
|
||||
<a name="l10"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/K.ZC.html#l1"><span class=cF4>K.ZC</span></a><span class=cF4>
|
||||
<a name="l11"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/Registry.ZC.html#l1"><span class=cF4>Registry.ZC</span></a><span class=cF4>
|
||||
<a name="l12"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/SSE.ZC.html#l1"><span class=cF4>SSE.ZC</span></a><span class=cF0>
|
||||
<a name="l11"></a></span><a href="https://zeal-operating-system.github.io/ZealOS/Home/SSE.ZC.html#l1"><span class=cF4>SSE.ZC</span></a><span class=cF0>
|
||||
<a name="l12"></a>
|
||||
<a name="l13"></a>
|
||||
<a name="l14"></a>
|
||||
</span></pre></body>
|
||||
</html>
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
<meta name="generator" content="ZealOS V1.07">
|
||||
<style type="text/css">
|
||||
body {background-color:#1f1f1f;}
|
||||
.c0F{color:#1f1f1f;background-color:#e3e3e3;}
|
||||
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
|
||||
.cF1{color:#4f84a6;background-color:#1f1f1f;}
|
||||
.cF2{color:#73a255;background-color:#1f1f1f;}
|
||||
|
@ -42,8 +41,8 @@ body {background-color:#1f1f1f;}
|
|||
<a name="l14"></a>
|
||||
<a name="l15"></a> </span><span class=cF2>//</span><a href="https://zeal-operating-system.github.io/ZealOS/System/Boot/BootDVD.ZC.html#l3"><span class=cF4>DD_BOOT_HIGH_LOC_DVD</span></a><span class=cF0>
|
||||
<a name="l16"></a></span><span class=cF5>
|
||||
<a name="l17"></a>+] LineRep</span><span class=c0F>
|
||||
<a name="l18"></a></span><span class=cF0>
|
||||
<a name="l17"></a>+] LineRep</span><span class=cF0>
|
||||
<a name="l18"></a>
|
||||
<a name="l19"></a> </span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>"DD_MP_VECT"</span><span class=cF0>, </span><span class=cF6>"%08X"</span><span class=cF0>, </span><span class=cF3>MP_VECT_ADDR</span><span class=cF0>);
|
||||
<a name="l20"></a> </span><span class=cF5>DefinePrint</span><span class=cF0>(</span><span class=cF6>"DD_MP_VECT_END"</span><span class=cF0>, </span><span class=cF6>"%08X"</span><span class=cF0>, </span><span class=cF3>MP_VECT_ADDR</span><span class=cF0> + </span><span class=cFD>COREAP_16BIT_INIT_END</span><span class=cF0> - </span><span class=cFD>COREAP_16BIT_INIT</span><span class=cF0> - </span><span class=cFE>1</span><span class=cF0>);
|
||||
<a name="l21"></a>
|
||||
|
|
12043
docs/index.html
12043
docs/index.html
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue