templeos-info/public/Wb/Kernel/BlkDev/DskDirB.HC.HTML

226 lines
24 KiB
HTML
Executable File

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="generator" content="TempleOS V5.03">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="/style/templeos.css">
<script src="/script/templeos.js"></script>
<style type="text/css">
.cF0{color:#000000;background-color:#ffffff;}
.cF1{color:#0000aa;background-color:#ffffff;}
.cF2{color:#00aa00;background-color:#ffffff;}
.cF3{color:#00aaaa;background-color:#ffffff;}
.cF4{color:#aa0000;background-color:#ffffff;}
.cF5{color:#aa00aa;background-color:#ffffff;}
.cF6{color:#aa5500;background-color:#ffffff;}
.cF7{color:#aaaaaa;background-color:#ffffff;}
.cF8{color:#555555;background-color:#ffffff;}
.cF9{color:#5555ff;background-color:#ffffff;}
.cFA{color:#55ff55;background-color:#ffffff;}
.cFB{color:#55ffff;background-color:#ffffff;}
.cFC{color:#ff5555;background-color:#ffffff;}
.cFD{color:#ff55ff;background-color:#ffffff;}
.cFE{color:#ffff55;background-color:#ffffff;}
.cFF{color:#ffffff;background-color:#ffffff;}
</style>
</head>
<body>
<pre id="content">
<a name="l1"></a><span class=cF1>U0</span><span class=cF0> </span><span class=cF5>HomeSet</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dirname)
<a name="l2"></a>{</span><span class=cF2>//Change home directory.</span><span class=cF0>
<a name="l3"></a> dirname=</span><span class=cF5>DirNameAbs</span><span class=cF0>(dirname);
<a name="l4"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cFB>blkdev</span><span class=cF0>.home_dir);
<a name="l5"></a> </span><span class=cFB>blkdev</span><span class=cF0>.home_dir=</span><span class=cF5>AStrNew</span><span class=cF0>(dirname);
<a name="l6"></a> </span><span class=cF5>Free</span><span class=cF0>(dirname);
<a name="l7"></a>}
<a name="l8"></a>
<a name="l9"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>Cd</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dirname=</span><span class=cF3>NULL</span><span class=cF0>,</span><span class=cF1>Bool</span><span class=cF0> make_dirs=</span><span class=cF3>FALSE</span><span class=cF0>)
<a name="l10"></a>{</span><span class=cF2>//Change directory. Optionally, make directories, too.</span><span class=cF0>
<a name="l11"></a> </span><span class=cF9>I64</span><span class=cF0> maxlen,cur_dir_clus=0;
<a name="l12"></a> </span><span class=cF1>U8</span><span class=cF0> *chg_to_buf,*new_cur_dir,*buf;
<a name="l13"></a> </span><span class=cF9>CDrv</span><span class=cF0> *dv;
<a name="l14"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l15"></a> </span><span class=cF1>if</span><span class=cF0> (!dirname)
<a name="l16"></a> dirname=</span><span class=cF6>&quot;~&quot;</span><span class=cF0>;
<a name="l17"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!*dirname)
<a name="l18"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l19"></a> </span><span class=cF1>if</span><span class=cF0> (dirname[1]==</span><span class=cF6>':'</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (*dirname==</span><span class=cF6>':'</span><span class=cF0>) {
<a name="l21"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dv!=</span><span class=cF5>Let2Drv</span><span class=cF7>(</span><span class=cF6>':'</span><span class=cF7>)</span><span class=cF0> &amp;&amp; !</span><span class=cF5>Drv</span><span class=cF7>(</span><span class=cF0>*dirname</span><span class=cF7>)</span><span class=cF0>)
<a name="l22"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l23"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dv!=</span><span class=cF5>Let2Drv</span><span class=cF7>(</span><span class=cF0>*dirname</span><span class=cF7>)</span><span class=cF0> &amp;&amp; !</span><span class=cF5>Drv</span><span class=cF7>(</span><span class=cF0>*dirname</span><span class=cF7>)</span><span class=cF0>)
<a name="l24"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l25"></a> dirname+=2;
<a name="l26"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l27"></a> </span><span class=cF1>if</span><span class=cF0> (*dirname==</span><span class=cF6>'/'</span><span class=cF0> || !*dirname || !</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dir) </span><span class=cF7>{</span><span class=cF0>
<a name="l28"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dir);
<a name="l29"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dir=</span><span class=cF5>StrNew</span><span class=cF0>(</span><span class=cF6>&quot;/&quot;</span><span class=cF0>);
<a name="l30"></a> </span><span class=cF1>if</span><span class=cF0> (*dirname==</span><span class=cF6>'/'</span><span class=cF0>)
<a name="l31"></a> dirname++;
<a name="l32"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l33"></a> chg_to_buf=</span><span class=cF5>MStrUtil</span><span class=cF0>(dirname,
<a name="l34"></a> </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="l35"></a> maxlen=</span><span class=cF5>StrLen</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dir)+1+</span><span class=cF5>StrLen</span><span class=cF0>(chg_to_buf)+1;
<a name="l36"></a> new_cur_dir=</span><span class=cF5>MAlloc</span><span class=cF0>(maxlen);
<a name="l37"></a> buf=</span><span class=cF5>MAlloc</span><span class=cF0>(maxlen);
<a name="l38"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(new_cur_dir,</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dir);
<a name="l39"></a> </span><span class=cF1>while</span><span class=cF0> (*chg_to_buf &amp;&amp; res) </span><span class=cF7>{</span><span class=cF0>
<a name="l40"></a> </span><span class=cF5>StrFirstRem</span><span class=cF0>(chg_to_buf,</span><span class=cF6>&quot;/&quot;</span><span class=cF0>,buf);
<a name="l41"></a> </span><span class=cF1>if</span><span class=cF0> (!*buf)
<a name="l42"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(new_cur_dir,</span><span class=cF6>&quot;/&quot;</span><span class=cF0>);
<a name="l43"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>buf,</span><span class=cF6>&quot;..&quot;</span><span class=cF7>)</span><span class=cF0>) {
<a name="l44"></a> </span><span class=cF5>StrLastRem</span><span class=cF0>(new_cur_dir,</span><span class=cF6>&quot;/&quot;</span><span class=cF0>);
<a name="l45"></a> </span><span class=cF1>if</span><span class=cF0> (!*new_cur_dir)
<a name="l46"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(new_cur_dir,</span><span class=cF6>&quot;/&quot;</span><span class=cF0>);
<a name="l47"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>buf,</span><span class=cF6>&quot;~&quot;</span><span class=cF7>)</span><span class=cF0>) {
<a name="l48"></a> </span><span class=cF5>Free</span><span class=cF0>(new_cur_dir);
<a name="l49"></a> new_cur_dir=</span><span class=cF5>MAlloc</span><span class=cF0>(</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cFB>blkdev</span><span class=cF0>.home_dir+2</span><span class=cF7>)</span><span class=cF0>+1+</span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>chg_to_buf</span><span class=cF7>)</span><span class=cF0>+1);
<a name="l50"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(new_cur_dir,</span><span class=cFB>blkdev</span><span class=cF0>.home_dir+2);
<a name="l51"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dv!=</span><span class=cF5>Let2Drv</span><span class=cF7>(</span><span class=cF6>'~'</span><span class=cF7>)</span><span class=cF0> &amp;&amp; !</span><span class=cF5>Drv</span><span class=cF7>(</span><span class=cF6>'~'</span><span class=cF7>)</span><span class=cF0>)
<a name="l52"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l53"></a> } </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>buf,</span><span class=cF6>&quot;.&quot;</span><span class=cF7>)</span><span class=cF0> &amp;&amp; *buf) {
<a name="l54"></a> dv=</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dv;
<a name="l55"></a> cur_dir_clus=</span><span class=cF5>Name2DirClus</span><span class=cF0>(dv,new_cur_dir);
<a name="l56"></a> </span><span class=cF1>switch</span><span class=cF0> (dv-&gt;fs_type) </span><span class=cF7>{</span><span class=cF0>
<a name="l57"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
<a name="l58"></a> res=</span><span class=cFD>RedSeaCd</span><span class=cF0>(buf,cur_dir_clus);
<a name="l59"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l60"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
<a name="l61"></a> res=</span><span class=cFD>FAT32Cd</span><span class=cF0>(buf,cur_dir_clus);
<a name="l62"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l63"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l64"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>&quot;File System Not Supported\n&quot;</span><span class=cF0>);
<a name="l65"></a> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l66"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l67"></a> </span><span class=cF1>if</span><span class=cF0> (!res &amp;&amp; make_dirs) </span><span class=cF7>{</span><span class=cF0>
<a name="l68"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dir);
<a name="l69"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dir=</span><span class=cF5>StrNew</span><span class=cF0>(new_cur_dir);
<a name="l70"></a> res=</span><span class=cF5>DirMk</span><span class=cF0>(buf);
<a name="l71"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l72"></a> </span><span class=cF1>if</span><span class=cF0> (res) </span><span class=cF7>{</span><span class=cF0>
<a name="l73"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrCmp</span><span class=cF7>(</span><span class=cF0>new_cur_dir,</span><span class=cF6>&quot;/&quot;</span><span class=cF7>)</span><span class=cF0>)
<a name="l74"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(new_cur_dir,</span><span class=cF6>&quot;/&quot;</span><span class=cF0>);
<a name="l75"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(new_cur_dir,buf);
<a name="l76"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l77"></a> }
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l79"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dir);
<a name="l80"></a> </span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dir=</span><span class=cF5>StrNew</span><span class=cF0>(new_cur_dir);
<a name="l81"></a> </span><span class=cF5>Free</span><span class=cF0>(buf);
<a name="l82"></a> </span><span class=cF5>Free</span><span class=cF0>(chg_to_buf);
<a name="l83"></a> </span><span class=cF5>Free</span><span class=cF0>(new_cur_dir);
<a name="l84"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l85"></a>}
<a name="l86"></a>
<a name="l87"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>IsDir</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *dir_name)
<a name="l88"></a>{</span><span class=cF2>//Is a str a valid, existing Dir?</span><span class=cF0>
<a name="l89"></a> </span><span class=cF1>U8</span><span class=cF0> *mask=</span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>&quot;%s/*&quot;</span><span class=cF0>,dir_name);
<a name="l90"></a> </span><span class=cF1>Bool</span><span class=cF0> res,old_silent=</span><span class=cF5>Silent</span><span class=cF0>;
<a name="l91"></a> </span><span class=cF9>CDirContext</span><span class=cF0> *dirc;
<a name="l92"></a> </span><span class=cF1>if</span><span class=cF0> (dirc=</span><span class=cF5>DirContextNew</span><span class=cF7>(</span><span class=cF0>mask</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l93"></a> </span><span class=cF5>DirContextDel</span><span class=cF0>(dirc);
<a name="l94"></a> res=</span><span class=cF3>TRUE</span><span class=cF0>;
<a name="l95"></a> </span><span class=cF7>}</span><span class=cF0> </span><span class=cF1>else</span><span class=cF0>
<a name="l96"></a> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l97"></a> </span><span class=cF5>Free</span><span class=cF0>(mask);
<a name="l98"></a> </span><span class=cF5>Silent</span><span class=cF0>(old_silent);
<a name="l99"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l100"></a>}
<a name="l101"></a>
<a name="l102"></a></span><span class=cF9>I64</span><span class=cF0> </span><span class=cF5>Dir</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *files_find_mask,</span><span class=cF1>Bool</span><span class=cF0> full)
<a name="l103"></a>{</span><span class=cF2>//List directory.</span><span class=cF0>
<a name="l104"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde1=</span><span class=cF3>NULL</span><span class=cF0>,*tmpde2;
<a name="l105"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
<a name="l106"></a> </span><span class=cF9>CDateStruct</span><span class=cF0> ds;
<a name="l107"></a> </span><span class=cF9>I64</span><span class=cF0> csize=0xFFFF,c=0xFFFF,res=0;
<a name="l108"></a> tmpde1=</span><span class=cF5>FilesFind</span><span class=cF0>(files_find_mask);
<a name="l109"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF7>(</span><span class=cF0>st=</span><span class=cF5>DirCur</span><span class=cF7>)</span><span class=cF0>)
<a name="l110"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>&quot;Invalid Drive\n&quot;</span><span class=cF0>);
<a name="l111"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l112"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1) {
<a name="l113"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l114"></a> st=</span><span class=cF5>MAllocIdent</span><span class=cF0>(tmpde1-&gt;full_name);
<a name="l115"></a> </span><span class=cF5>StrLastRem</span><span class=cF0>(st,</span><span class=cF6>&quot;/&quot;</span><span class=cF0>);
<a name="l116"></a> </span><span class=cF1>if</span><span class=cF0> (!st[2])
<a name="l117"></a> </span><span class=cF5>StrCpy</span><span class=cF0>(st+2,</span><span class=cF6>&quot;/&quot;</span><span class=cF0>);
<a name="l118"></a></span><span class=cF2>//Find max columns</span><span class=cF0>
<a name="l119"></a> tmpde2=tmpde1;
<a name="l120"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde2) </span><span class=cF7>{</span><span class=cF0>
<a name="l121"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde2-&gt;size&gt;csize)
<a name="l122"></a> csize=tmpde2-&gt;size;
<a name="l123"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde2-&gt;clus&gt;c)
<a name="l124"></a> c=tmpde2-&gt;clus;
<a name="l125"></a> tmpde2=tmpde2-&gt;next;
<a name="l126"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l127"></a> csize=</span><span class=cF5>Bsr</span><span class=cF0>(csize)/4+1;
<a name="l128"></a> c=</span><span class=cF5>Bsr</span><span class=cF0>(c)/4+1;
<a name="l129"></a>
<a name="l130"></a> </span><span class=cF6>&quot;$MA,T=\&quot;Directory\&quot;,LM=\&quot;PopUpCd;Dir;\n\&quot;$ of %s\n&quot;</span><span class=cF0>,st;
<a name="l131"></a> </span><span class=cF1>if</span><span class=cF0> (full)
<a name="l132"></a> </span><span class=cF6>&quot;__DATE__ __TIME__ %*ts %*ts\n&quot;</span><span class=cF0>,
<a name="l133"></a> csize,</span><span class=cF6>&quot;SIZE&quot;</span><span class=cF0>,c,</span><span class=cF6>&quot;BLK&quot;</span><span class=cF0>;
<a name="l134"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l135"></a> </span><span class=cF6>&quot;DATE_ TIME_ %*ts\n&quot;</span><span class=cF0>,csize,</span><span class=cF6>&quot;SIZE&quot;</span><span class=cF0>;
<a name="l136"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde1) </span><span class=cF7>{</span><span class=cF0>
<a name="l137"></a> tmpde2=tmpde1-&gt;next;
<a name="l138"></a> res++;
<a name="l139"></a> </span><span class=cF1>if</span><span class=cF0> (full)
<a name="l140"></a> </span><span class=cF6>&quot;%D %T %0*tX %0*tX &quot;</span><span class=cF0>,tmpde1-&gt;datetime,tmpde1-&gt;datetime,
<a name="l141"></a> csize,tmpde1-&gt;size,c,tmpde1-&gt;clus;
<a name="l142"></a> </span><span class=cF1>else</span><span class=cF0> {
<a name="l143"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(&amp;ds,tmpde1-&gt;datetime+</span><span class=cFB>local_time_offset</span><span class=cF0>);
<a name="l144"></a> </span><span class=cF6>&quot;%02d/%02d %02d:%02d %0*tX &quot;</span><span class=cF0>,ds.mon,ds.day_of_mon,ds.hour,ds.min,
<a name="l145"></a> csize,tmpde1-&gt;size;
<a name="l146"></a> }
<a name="l147"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1-&gt;attr &amp; </span><span class=cF3>RS_ATTR_DIR</span><span class=cF0>)
<a name="l148"></a> </span><span class=cF5>PutDirLink</span><span class=cF0>(tmpde1-&gt;name,tmpde1-&gt;full_name);
<a name="l149"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l150"></a> </span><span class=cF5>PutFileLink</span><span class=cF0>(tmpde1-&gt;name,tmpde1-&gt;full_name);
<a name="l151"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
<a name="l152"></a> </span><span class=cF5>DirEntryDel</span><span class=cF0>(tmpde1);
<a name="l153"></a> tmpde1=tmpde2;
<a name="l154"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l155"></a> } </span><span class=cF1>else</span><span class=cF0>
<a name="l156"></a> </span><span class=cF6>&quot;No matching entries\n&quot;</span><span class=cF0>;
<a name="l157"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
<a name="l158"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l159"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l160"></a>}
<a name="l161"></a>
<a name="l162"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DirMk</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename,</span><span class=cF9>I64</span><span class=cF0> entry_cnt=0)
<a name="l163"></a>{</span><span class=cF2>//Make directory. </span><a href="/Wb/Kernel/BlkDev/DskDirB.HC.HTML#l9"><span class=cF4>Cd</span></a><span class=cF2>() can also make directories.</span><span class=cF0>
<a name="l164"></a></span><span class=cF2>//entry_cnt is for preallocating dir blks, leave it zero if you like.</span><span class=cF0>
<a name="l165"></a> </span><span class=cF1>U8</span><span class=cF0> *name;
<a name="l166"></a> </span><span class=cF9>CDirContext</span><span class=cF0> *dirc;
<a name="l167"></a> </span><span class=cF1>Bool</span><span class=cF0> res=</span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l168"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>FileFind</span><span class=cF7>(</span><span class=cF0>filename,,</span><span class=cF3>FUF_JUST_DIRS</span><span class=cF7>)</span><span class=cF0>)
<a name="l169"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
<a name="l170"></a> </span><span class=cF1>if</span><span class=cF0> (dirc=</span><span class=cF5>DirContextNew</span><span class=cF7>(</span><span class=cF0>filename</span><span class=cF7>)</span><span class=cF0>) </span><span class=cF7>{</span><span class=cF0>
<a name="l171"></a> </span><span class=cF1>if</span><span class=cF0> (*dirc-&gt;mask) {
<a name="l172"></a> </span><span class=cF1>if</span><span class=cF0> (!</span><span class=cF5>FileNameChk</span><span class=cF7>(</span><span class=cF0>dirc-&gt;mask</span><span class=cF7>)</span><span class=cF0>)
<a name="l173"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>&quot;Invalid FileName: \&quot;%s\&quot;.\n&quot;</span><span class=cF0>,dirc-&gt;mask);
<a name="l174"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF7>{</span><span class=cF0>
<a name="l175"></a> </span><span class=cF6>&quot;Make Directory:%s\n&quot;</span><span class=cF0>,filename;
<a name="l176"></a> name=</span><span class=cF5>MStrUtil</span><span class=cF0>(dirc-&gt;mask,
<a name="l177"></a> </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="l178"></a> </span><span class=cF1>switch</span><span class=cF0> (dirc-&gt;dv-&gt;fs_type) {
<a name="l179"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
<a name="l180"></a> res=</span><span class=cFD>RedSeaMkDir</span><span class=cF0>(dirc-&gt;dv,</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dir,name,entry_cnt);
<a name="l181"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l182"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
<a name="l183"></a> res=</span><span class=cFD>FAT32MkDir</span><span class=cF0>(dirc-&gt;dv,</span><span class=cF5>Fs</span><span class=cF0>-&gt;cur_dir,name,entry_cnt);
<a name="l184"></a> </span><span class=cF1>break</span><span class=cF0>;
<a name="l185"></a> </span><span class=cF1>default</span><span class=cF0>:
<a name="l186"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>&quot;File System Not Supported\n&quot;</span><span class=cF0>);
<a name="l187"></a> }
<a name="l188"></a> </span><span class=cF5>Free</span><span class=cF0>(name);
<a name="l189"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l190"></a> }
<a name="l191"></a> </span><span class=cF5>DirContextDel</span><span class=cF0>(dirc);
<a name="l192"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l193"></a> </span><span class=cF1>return</span><span class=cF0> res;
<a name="l194"></a>}
</span></pre></body>
</html>