mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-28 08:16:31 +00:00
133 lines
13 KiB
HTML
Executable file
133 lines
13 KiB
HTML
Executable file
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
|
|
<meta name="generator" content="ZealOS V0.14">
|
|
<style type="text/css">
|
|
body {background-color:#fef1f0;}
|
|
.cF0{color:#000000;background-color:#fef1f0;}
|
|
.cF1{color:#0148a4;background-color:#fef1f0;}
|
|
.cF2{color:#3b7901;background-color:#fef1f0;}
|
|
.cF3{color:#057c7e;background-color:#fef1f0;}
|
|
.cF4{color:#bb2020;background-color:#fef1f0;}
|
|
.cF5{color:#9e42ae;background-color:#fef1f0;}
|
|
.cF6{color:#b57901;background-color:#fef1f0;}
|
|
.cF7{color:#b2b6af;background-color:#fef1f0;}
|
|
.cF8{color:#555753;background-color:#fef1f0;}
|
|
.cF9{color:#678fbb;background-color:#fef1f0;}
|
|
.cFA{color:#82bc49;background-color:#fef1f0;}
|
|
.cFB{color:#0097a2;background-color:#fef1f0;}
|
|
.cFC{color:#e26a6a;background-color:#fef1f0;}
|
|
.cFD{color:#c671bc;background-color:#fef1f0;}
|
|
.cFE{color:#c7ab00;background-color:#fef1f0;}
|
|
.cFF{color:#fef1f0;background-color:#fef1f0;}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<pre style="font-family:monospace;font-size:12pt">
|
|
<a name="l1"></a><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>DirContextDel</span><span class=cF0>(</span><span class=cF9>CDirContext</span><span class=cF0> *dirc, </span><span class=cF1>Bool</span><span class=cF0> restore=</span><span class=cF3>TRUE</span><span class=cF0>)
|
|
<a name="l2"></a>{</span><span class=cF2>//Change back to old cur_dir and drv.</span><span class=cF0>
|
|
<a name="l3"></a> </span><span class=cF9>CBlkDev</span><span class=cF0> *bd;
|
|
<a name="l4"></a>
|
|
<a name="l5"></a> </span><span class=cF1>if</span><span class=cF0> (!dirc)
|
|
<a name="l6"></a> </span><span class=cF1>return</span><span class=cF0>;
|
|
<a name="l7"></a> </span><span class=cF1>if</span><span class=cF0> (restore)
|
|
<a name="l8"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l9"></a> bd = dirc->old_dv->bd;
|
|
<a name="l10"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>bd->flags & </span><span class=cF3>BDF_INIT_IN_PROGRESS</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l11"></a> {
|
|
<a name="l12"></a> </span><span class=cF1>if</span><span class=cF0> (dirc->old_dir)
|
|
<a name="l13"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l14"></a> </span><span class=cF5>Drive</span><span class=cF0>(</span><span class=cF5>Drive2Letter</span><span class=cF7>(</span><span class=cF0>dirc->old_dv</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l15"></a> </span><span class=cF5>Cd</span><span class=cF0>(dirc->old_dir);
|
|
<a name="l16"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l17"></a> }
|
|
<a name="l18"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l19"></a> {
|
|
<a name="l20"></a> </span><span class=cF5>Fs</span><span class=cF0>->cur_dv = dirc->old_dv;
|
|
<a name="l21"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dir);
|
|
<a name="l22"></a> </span><span class=cF5>Fs</span><span class=cF0>->cur_dir = </span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>"/"</span><span class=cF0>);
|
|
<a name="l23"></a> }
|
|
<a name="l24"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l25"></a> </span><span class=cF5>Free</span><span class=cF0>(dirc->old_dir);
|
|
<a name="l26"></a> </span><span class=cF5>Free</span><span class=cF0>(dirc->mask);
|
|
<a name="l27"></a> </span><span class=cF5>Free</span><span class=cF0>(dirc);
|
|
<a name="l28"></a>}
|
|
<a name="l29"></a>
|
|
<a name="l30"></a></span><span class=cF9>CDirContext</span><span class=cF0> *</span><span class=cF5>DirContextNew</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *_mask, </span><span class=cF1>Bool</span><span class=cF0> make_mask=</span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> make_dirs=</span><span class=cF3>FALSE</span><span class=cF0>, </span><span class=cF1>Bool</span><span class=cF0> no_mask=</span><span class=cF3>FALSE</span><span class=cF0>)
|
|
<a name="l31"></a>{</span><span class=cF2>//Save cur_dir and drv. Change to new dir.</span><span class=cF0>
|
|
<a name="l32"></a> </span><span class=cF1>Bool</span><span class=cF0> valid = </span><span class=cF3>TRUE</span><span class=cF0>, old_silent;
|
|
<a name="l33"></a> </span><span class=cF9>I64</span><span class=cF0> mask_len = </span><span class=cF5>StrLen</span><span class=cF0>(_mask);
|
|
<a name="l34"></a> </span><span class=cF1>U8</span><span class=cF0> *buf, *mask, *tmp_mask, *semicolon_mask;
|
|
<a name="l35"></a> </span><span class=cF9>CDirContext</span><span class=cF0> *dirc = </span><span class=cF5>CAlloc</span><span class=cF0>(</span><span class=cF1>sizeof</span><span class=cF7>(</span><span class=cF9>CDirContext</span><span class=cF7>)</span><span class=cF0>);
|
|
<a name="l36"></a>
|
|
<a name="l37"></a> dirc->old_dir = </span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dir);
|
|
<a name="l38"></a> dirc->old_dv = </span><span class=cF5>Fs</span><span class=cF0>->cur_dv;
|
|
<a name="l39"></a> mask = </span><span class=cF5>MStrUtil</span><span class=cF0>(_mask, </span><span class=cF3>SUF_REM_LEADING</span><span class=cF0> | </span><span class=cF3>SUF_REM_TRAILING</span><span class=cF0> | </span><span class=cF3>SUF_REM_CTRL_CHARS</span><span class=cF0>);
|
|
<a name="l40"></a> tmp_mask = mask;
|
|
<a name="l41"></a> </span><span class=cF1>if</span><span class=cF0> (*mask && mask[</span><span class=cFE>1</span><span class=cF0>] == </span><span class=cF6>':'</span><span class=cF0>)
|
|
<a name="l42"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l43"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>->cur_dv != </span><span class=cF5>Letter2Drive</span><span class=cF7>(</span><span class=cF0>*mask</span><span class=cF7>)</span><span class=cF0> && !</span><span class=cF5>Drive</span><span class=cF7>(</span><span class=cF0>*mask</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l44"></a> valid = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l45"></a> mask += </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l46"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l47"></a> </span><span class=cF1>if</span><span class=cF0> (*mask == </span><span class=cF6>'~'</span><span class=cF0> && </span><span class=cF5>Fs</span><span class=cF0>->cur_dv != </span><span class=cF5>Letter2Drive</span><span class=cF7>(</span><span class=cF6>'~'</span><span class=cF7>)</span><span class=cF0> && !</span><span class=cF5>Drive</span><span class=cF7>(</span><span class=cF6>'~'</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l48"></a> valid = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l49"></a> dirc->drive = </span><span class=cF5>Fs</span><span class=cF0>->cur_dv;
|
|
<a name="l50"></a> </span><span class=cF5>DriveCheck</span><span class=cF0>(dirc->drive);
|
|
<a name="l51"></a> buf = </span><span class=cF5>MAlloc</span><span class=cF0>(mask_len + </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l52"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(buf, mask);
|
|
<a name="l53"></a>
|
|
<a name="l54"></a> dirc->mask = </span><span class=cF5>MAlloc</span><span class=cF0>(mask_len + </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l55"></a> </span><span class=cF1>if</span><span class=cF0> (no_mask)
|
|
<a name="l56"></a> *dirc->mask = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l57"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrOcc</span><span class=cF7>(</span><span class=cF0>buf, </span><span class=cF6>';'</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l58"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l59"></a> semicolon_mask = </span><span class=cF5>MAlloc</span><span class=cF0>(mask_len + </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l60"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(semicolon_mask, mask);
|
|
<a name="l61"></a> </span><span class=cF5>StrFirstRemove</span><span class=cF0>(semicolon_mask, </span><span class=cF6>";"</span><span class=cF0>, buf);
|
|
<a name="l62"></a> </span><span class=cF5>StrLastRemove</span><span class=cF0>(buf, </span><span class=cF6>"/"</span><span class=cF0>, dirc->mask);
|
|
<a name="l63"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(dirc->mask, </span><span class=cF6>";%s"</span><span class=cF0>, semicolon_mask);
|
|
<a name="l64"></a> </span><span class=cF5>Free</span><span class=cF0>(semicolon_mask);
|
|
<a name="l65"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l66"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l67"></a> </span><span class=cF5>StrLastRemove</span><span class=cF0>(buf, </span><span class=cF6>"/"</span><span class=cF0>, dirc->mask);
|
|
<a name="l68"></a>
|
|
<a name="l69"></a> </span><span class=cF1>if</span><span class=cF0> (*mask == </span><span class=cF6>'/'</span><span class=cF0> && !*buf)
|
|
<a name="l70"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(buf, </span><span class=cF6>"/"</span><span class=cF0>);
|
|
<a name="l71"></a></span><span class=cF2>//If began with Dir, change to Dir.</span><span class=cF0>
|
|
<a name="l72"></a> </span><span class=cF1>if</span><span class=cF0> (*buf && !</span><span class=cF5>Cd</span><span class=cF7>(</span><span class=cF0>buf, make_dirs</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l73"></a> valid = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l74"></a> </span><span class=cF1>if</span><span class=cF0> (valid && make_mask)
|
|
<a name="l75"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l76"></a> </span><span class=cF1>if</span><span class=cF0> (!*dirc->mask)
|
|
<a name="l77"></a> {
|
|
<a name="l78"></a> </span><span class=cF5>Free</span><span class=cF0>(dirc->mask);
|
|
<a name="l79"></a> dirc->mask = </span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>"*"</span><span class=cF0>);
|
|
<a name="l80"></a> }
|
|
<a name="l81"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l82"></a> {
|
|
<a name="l83"></a> </span><span class=cF1>if</span><span class=cF0> (!make_dirs || </span><span class=cF5>FileNameCheck</span><span class=cF7>(</span><span class=cF0>dirc->mask</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l84"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l85"></a> old_silent = </span><span class=cF5>Silent</span><span class=cF0>;
|
|
<a name="l86"></a></span><span class=cF2>//Try mask to see if Dir. If Dir, change to dir and set to "*".</span><span class=cF0>
|
|
<a name="l87"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Cd</span><span class=cF7>(</span><span class=cF0>dirc->mask, make_dirs</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l88"></a> {
|
|
<a name="l89"></a> </span><span class=cF5>Free</span><span class=cF0>(dirc->mask);
|
|
<a name="l90"></a> dirc->mask = </span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>"*"</span><span class=cF0>);
|
|
<a name="l91"></a> }
|
|
<a name="l92"></a> </span><span class=cF5>Silent</span><span class=cF0>(old_silent);
|
|
<a name="l93"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l94"></a> }
|
|
<a name="l95"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l96"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
|
|
<a name="l97"></a> </span><span class=cF5>Free</span><span class=cF0>(tmp_mask);
|
|
<a name="l98"></a> </span><span class=cF1>if</span><span class=cF0> (!valid)
|
|
<a name="l99"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l100"></a> </span><span class=cF5>DirContextDel</span><span class=cF0>(dirc);
|
|
<a name="l101"></a> dirc = </span><span class=cF3>NULL</span><span class=cF0>;
|
|
<a name="l102"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l103"></a> </span><span class=cF1>return</span><span class=cF0> dirc;
|
|
<a name="l104"></a>}
|
|
</span></pre></body>
|
|
</html>
|