mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-30 17:26:31 +00:00
dbf8647d59
Added top & right borders to RawDr. Improved spacing in some debug and compiler reporting. Fixed RawPutChar and EdLite tab width. Fixed Ui missing '0x' prefix syntax highlighter bug. Added 32BitPaint demo.
251 lines
27 KiB
HTML
Executable file
251 lines
27 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.08">
|
|
<style type="text/css">
|
|
body {background-color:#000000;}
|
|
.cF0{color:#ffffff;background-color:#000000;}
|
|
.cF1{color:#3465a4;background-color:#000000;}
|
|
.cF2{color:#4e9a06;background-color:#000000;}
|
|
.cF3{color:#06989a;background-color:#000000;}
|
|
.cF4{color:#a24444;background-color:#000000;}
|
|
.cF5{color:#75507b;background-color:#000000;}
|
|
.cF6{color:#ce982f;background-color:#000000;}
|
|
.cF7{color:#bcc0b9;background-color:#000000;}
|
|
.cF8{color:#555753;background-color:#000000;}
|
|
.cF9{color:#729fcf;background-color:#000000;}
|
|
.cFA{color:#82bc49;background-color:#000000;}
|
|
.cFB{color:#34e2e2;background-color:#000000;}
|
|
.cFC{color:#ac3535;background-color:#000000;}
|
|
.cFD{color:#ad7fa8;background-color:#000000;}
|
|
.cFE{color:#fce94f;background-color:#000000;}
|
|
.cFF{color:#000000;background-color:#000000;}
|
|
</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>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>SysStrNew</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 = </span><span class=cFE>0</span><span class=cF0>;
|
|
<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>CDrive</span><span class=cF0> *drive;
|
|
<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>
|
|
<a name="l16"></a> </span><span class=cF1>if</span><span class=cF0> (!dirname)
|
|
<a name="l17"></a> dirname = </span><span class=cF6>"~"</span><span class=cF0>;
|
|
<a name="l18"></a> </span><span class=cF1>else</span><span class=cF0> </span><span class=cF1>if</span><span class=cF0> (!*dirname)
|
|
<a name="l19"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l20"></a> </span><span class=cF1>if</span><span class=cF0> (dirname[</span><span class=cFE>1</span><span class=cF0>] == </span><span class=cF6>':'</span><span class=cF0>)
|
|
<a name="l21"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l22"></a> </span><span class=cF1>if</span><span class=cF0> (*dirname == </span><span class=cF6>':'</span><span class=cF0>)
|
|
<a name="l23"></a> {
|
|
<a name="l24"></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=cF6>':'</span><span class=cF7>)</span><span class=cF0> && !</span><span class=cF5>Drive</span><span class=cF7>(</span><span class=cF0>*dirname</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l25"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l26"></a> }
|
|
<a name="l27"></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>->cur_dv != </span><span class=cF5>Letter2Drive</span><span class=cF7>(</span><span class=cF0>*dirname</span><span class=cF7>)</span><span class=cF0> && !</span><span class=cF5>Drive</span><span class=cF7>(</span><span class=cF0>*dirname</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l28"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l29"></a> dirname += </span><span class=cFE>2</span><span class=cF0>;
|
|
<a name="l30"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l31"></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>->cur_dir)
|
|
<a name="l32"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l33"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dir);
|
|
<a name="l34"></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="l35"></a> </span><span class=cF1>if</span><span class=cF0> (*dirname == </span><span class=cF6>'/'</span><span class=cF0>)
|
|
<a name="l36"></a> dirname++;
|
|
<a name="l37"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l38"></a> chg_to_buf = </span><span class=cF5>MStrUtil</span><span class=cF0>(dirname, </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="l39"></a> maxlen = </span><span class=cF5>StrLen</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dir) + </span><span class=cFE>1</span><span class=cF0> + </span><span class=cF5>StrLen</span><span class=cF0>(chg_to_buf) + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l40"></a> new_cur_dir = </span><span class=cF5>MAlloc</span><span class=cF0>(maxlen);
|
|
<a name="l41"></a> buf = </span><span class=cF5>MAlloc</span><span class=cF0>(maxlen);
|
|
<a name="l42"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(new_cur_dir, </span><span class=cF5>Fs</span><span class=cF0>->cur_dir);
|
|
<a name="l43"></a> </span><span class=cF1>while</span><span class=cF0> (*chg_to_buf && res)
|
|
<a name="l44"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l45"></a> </span><span class=cF5>StrFirstRemove</span><span class=cF0>(chg_to_buf, </span><span class=cF6>"/"</span><span class=cF0>, buf);
|
|
<a name="l46"></a> </span><span class=cF1>if</span><span class=cF0> (!*buf)
|
|
<a name="l47"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(new_cur_dir, </span><span class=cF6>"/"</span><span class=cF0>);
|
|
<a name="l48"></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=cF0>buf, </span><span class=cF6>".."</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l49"></a> {
|
|
<a name="l50"></a> </span><span class=cF5>StrLastRemove</span><span class=cF0>(new_cur_dir, </span><span class=cF6>"/"</span><span class=cF0>);
|
|
<a name="l51"></a> </span><span class=cF1>if</span><span class=cF0> (!*new_cur_dir)
|
|
<a name="l52"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(new_cur_dir, </span><span class=cF6>"/"</span><span class=cF0>);
|
|
<a name="l53"></a> }
|
|
<a name="l54"></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=cF0>buf, </span><span class=cF6>"~"</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l55"></a> {
|
|
<a name="l56"></a> </span><span class=cF5>Free</span><span class=cF0>(new_cur_dir);
|
|
<a name="l57"></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 + </span><span class=cFE>2</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0> + </span><span class=cF5>StrLen</span><span class=cF7>(</span><span class=cF0>chg_to_buf</span><span class=cF7>)</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>);
|
|
<a name="l58"></a> </span><span class=cF5>StrCopy</span><span class=cF0>(new_cur_dir, </span><span class=cFB>blkdev</span><span class=cF0>.home_dir + </span><span class=cFE>2</span><span class=cF0>);
|
|
<a name="l59"></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=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="l60"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l61"></a> }
|
|
<a name="l62"></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=cF0>buf, </span><span class=cF6>"."</span><span class=cF7>)</span><span class=cF0> && *buf)
|
|
<a name="l63"></a> {
|
|
<a name="l64"></a> drive = </span><span class=cF5>Fs</span><span class=cF0>->cur_dv;
|
|
<a name="l65"></a> cur_dir_clus = </span><span class=cF5>Name2DirClus</span><span class=cF0>(drive, new_cur_dir);
|
|
<a name="l66"></a> </span><span class=cF1>switch</span><span class=cF0> (drive->fs_type)
|
|
<a name="l67"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l68"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
|
<a name="l69"></a> res = </span><span class=cFD>RedSeaCd</span><span class=cF0>(buf, cur_dir_clus);
|
|
<a name="l70"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l71"></a>
|
|
<a name="l72"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
|
<a name="l73"></a> res = </span><span class=cFD>FAT32Cd</span><span class=cF0>(buf, cur_dir_clus);
|
|
<a name="l74"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l75"></a>
|
|
<a name="l76"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l77"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"File System Not Supported\n"</span><span class=cF0>);
|
|
<a name="l78"></a> res = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l79"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l80"></a> </span><span class=cF1>if</span><span class=cF0> (!res && make_dirs)
|
|
<a name="l81"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l82"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dir);
|
|
<a name="l83"></a> </span><span class=cF5>Fs</span><span class=cF0>->cur_dir = </span><span class=cF5>StrNew</span><span class=cF0>(new_cur_dir);
|
|
<a name="l84"></a> res = </span><span class=cF5>DirMake</span><span class=cF0>(buf);
|
|
<a name="l85"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l86"></a> </span><span class=cF1>if</span><span class=cF0> (res)
|
|
<a name="l87"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l88"></a> </span><span class=cF1>if</span><span class=cF0> (</span><span class=cF5>StrCompare</span><span class=cF7>(</span><span class=cF0>new_cur_dir, </span><span class=cF6>"/"</span><span class=cF7>)</span><span class=cF0>)
|
|
<a name="l89"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(new_cur_dir, </span><span class=cF6>"/"</span><span class=cF0>);
|
|
<a name="l90"></a> </span><span class=cF5>CatPrint</span><span class=cF0>(new_cur_dir, buf);
|
|
<a name="l91"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l92"></a> }
|
|
<a name="l93"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l94"></a> </span><span class=cF5>Free</span><span class=cF0>(</span><span class=cF5>Fs</span><span class=cF0>->cur_dir);
|
|
<a name="l95"></a> </span><span class=cF5>Fs</span><span class=cF0>->cur_dir = </span><span class=cF5>StrNew</span><span class=cF0>(new_cur_dir);
|
|
<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>(chg_to_buf);
|
|
<a name="l98"></a> </span><span class=cF5>Free</span><span class=cF0>(new_cur_dir);
|
|
<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=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="l103"></a>{</span><span class=cF2>//Is a str a valid, existing Dir?</span><span class=cF0>
|
|
<a name="l104"></a> </span><span class=cF1>U8</span><span class=cF0> *mask = </span><span class=cF5>MStrPrint</span><span class=cF0>(</span><span class=cF6>"%s/*"</span><span class=cF0>, dir_name);
|
|
<a name="l105"></a> </span><span class=cF1>Bool</span><span class=cF0> res, old_silent = </span><span class=cF5>Silent</span><span class=cF0>;
|
|
<a name="l106"></a> </span><span class=cF9>CDirContext</span><span class=cF0> *dirc;
|
|
<a name="l107"></a>
|
|
<a name="l108"></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>)
|
|
<a name="l109"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l110"></a> </span><span class=cF5>DirContextDel</span><span class=cF0>(dirc);
|
|
<a name="l111"></a> res = </span><span class=cF3>TRUE</span><span class=cF0>;
|
|
<a name="l112"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l113"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l114"></a> res = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l115"></a> </span><span class=cF5>Free</span><span class=cF0>(mask);
|
|
<a name="l116"></a> </span><span class=cF5>Silent</span><span class=cF0>(old_silent);
|
|
<a name="l117"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l118"></a>}
|
|
<a name="l119"></a>
|
|
<a name="l120"></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="l121"></a>{</span><span class=cF2>//List directory.</span><span class=cF0>
|
|
<a name="l122"></a> </span><span class=cF9>CDirEntry</span><span class=cF0> *tmpde1 = </span><span class=cF3>NULL</span><span class=cF0>, *tmpde2;
|
|
<a name="l123"></a> </span><span class=cF1>U8</span><span class=cF0> *st;
|
|
<a name="l124"></a> </span><span class=cF9>CDateStruct</span><span class=cF0> ds;
|
|
<a name="l125"></a> </span><span class=cF9>I64</span><span class=cF0> csize = </span><span class=cFE>0xFFFF</span><span class=cF0>, c = </span><span class=cFE>0xFFFF</span><span class=cF0>, res = </span><span class=cFE>0</span><span class=cF0>;
|
|
<a name="l126"></a>
|
|
<a name="l127"></a> tmpde1 = </span><span class=cF5>FilesFind</span><span class=cF0>(files_find_mask);
|
|
<a name="l128"></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="l129"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Invalid Drive\n"</span><span class=cF0>);
|
|
<a name="l130"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l131"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l132"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde1)
|
|
<a name="l133"></a> {
|
|
<a name="l134"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l135"></a> st = </span><span class=cF5>MAllocIdent</span><span class=cF0>(tmpde1->full_name);
|
|
<a name="l136"></a> </span><span class=cF5>StrLastRemove</span><span class=cF0>(st, </span><span class=cF6>"/"</span><span class=cF0>);
|
|
<a name="l137"></a> </span><span class=cF1>if</span><span class=cF0> (!st[</span><span class=cFE>2</span><span class=cF0>])
|
|
<a name="l138"></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="l139"></a></span><span class=cF2>//Find max columns</span><span class=cF0>
|
|
<a name="l140"></a> tmpde2 = tmpde1;
|
|
<a name="l141"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde2)
|
|
<a name="l142"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l143"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde2->size > csize)
|
|
<a name="l144"></a> csize = tmpde2->size;
|
|
<a name="l145"></a> </span><span class=cF1>if</span><span class=cF0> (tmpde2->clus > c)
|
|
<a name="l146"></a> c = tmpde2->clus;
|
|
<a name="l147"></a> tmpde2 = tmpde2->next;
|
|
<a name="l148"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l149"></a> csize = </span><span class=cF5>Bsr</span><span class=cF0>(csize) / </span><span class=cFE>4</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l150"></a> c = </span><span class=cF5>Bsr</span><span class=cF0>(c) / </span><span class=cFE>4</span><span class=cF0> + </span><span class=cFE>1</span><span class=cF0>;
|
|
<a name="l151"></a>
|
|
<a name="l152"></a> </span><span class=cF6>"$MA,T=\"Directory\",LM=\"PopUpCd;Dir;\n\"$ of %s\n"</span><span class=cF0>, st;
|
|
<a name="l153"></a> </span><span class=cF1>if</span><span class=cF0> (full)
|
|
<a name="l154"></a> </span><span class=cF6>"__DATE__ __TIME__ %*ts %*ts\n"</span><span class=cF0>, csize, </span><span class=cF6>"SIZE"</span><span class=cF0>, c, </span><span class=cF6>"BLK"</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>"DATE_ TIME_ %*ts\n"</span><span class=cF0>, csize, </span><span class=cF6>"SIZE"</span><span class=cF0>;
|
|
<a name="l157"></a> </span><span class=cF1>while</span><span class=cF0> (tmpde1)
|
|
<a name="l158"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l159"></a> tmpde2 = tmpde1->next;
|
|
<a name="l160"></a> res++;
|
|
<a name="l161"></a> </span><span class=cF1>if</span><span class=cF0> (full)
|
|
<a name="l162"></a> </span><span class=cF6>"%D %T %0*tX %0*tX "</span><span class=cF0>, tmpde1->datetime, tmpde1->datetime, csize, tmpde1->size, c, tmpde1->clus;
|
|
<a name="l163"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l164"></a> {
|
|
<a name="l165"></a> </span><span class=cF5>Date2Struct</span><span class=cF0>(&ds, tmpde1->datetime + </span><span class=cFB>local_time_offset</span><span class=cF0>);
|
|
<a name="l166"></a> </span><span class=cF6>"%02d/%02d %02d:%02d %0*tX "</span><span class=cF0>, ds.mon, ds.day_of_mon, ds.hour, ds.min, csize, tmpde1->size;
|
|
<a name="l167"></a> }
|
|
<a name="l168"></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="l169"></a> </span><span class=cF5>PutDirLink</span><span class=cF0>(tmpde1->name, tmpde1->full_name);
|
|
<a name="l170"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l171"></a> </span><span class=cF5>PutFileLink</span><span class=cF0>(tmpde1->name, tmpde1->full_name);
|
|
<a name="l172"></a> </span><span class=cF6>'\n'</span><span class=cF0>;
|
|
<a name="l173"></a> </span><span class=cF5>DirEntryDel</span><span class=cF0>(tmpde1);
|
|
<a name="l174"></a> tmpde1 = tmpde2;
|
|
<a name="l175"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l176"></a> }
|
|
<a name="l177"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l178"></a> </span><span class=cF6>"No matching entries\n"</span><span class=cF0>;
|
|
<a name="l179"></a> </span><span class=cF5>Free</span><span class=cF0>(st);
|
|
<a name="l180"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l181"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l182"></a>}
|
|
<a name="l183"></a>
|
|
<a name="l184"></a></span><span class=cF1>Bool</span><span class=cF0> </span><span class=cF5>DirMake</span><span class=cF0>(</span><span class=cF1>U8</span><span class=cF0> *filename, </span><span class=cF9>I64</span><span class=cF0> entry_count=</span><span class=cFE>0</span><span class=cF0>)
|
|
<a name="l185"></a>{</span><span class=cF2>//Make directory. </span><a href="https://tomawezome.github.io/ZealOS/Kernel/BlkDev/DiskDirB.CC.html#l9"><span class=cF4>Cd</span></a><span class=cF2>() can also make directories.</span><span class=cF0>
|
|
<a name="l186"></a></span><span class=cF2>//entry_count is for preallocating dir blks, leave it zero if you like.</span><span class=cF0>
|
|
<a name="l187"></a> </span><span class=cF1>U8</span><span class=cF0> *name;
|
|
<a name="l188"></a> </span><span class=cF9>CDirContext</span><span class=cF0> *dirc;
|
|
<a name="l189"></a> </span><span class=cF1>Bool</span><span class=cF0> res = </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l190"></a>
|
|
<a name="l191"></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="l192"></a> </span><span class=cF1>return</span><span class=cF0> </span><span class=cF3>FALSE</span><span class=cF0>;
|
|
<a name="l193"></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>)
|
|
<a name="l194"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l195"></a> </span><span class=cF1>if</span><span class=cF0> (*dirc->mask)
|
|
<a name="l196"></a> {
|
|
<a name="l197"></a> </span><span class=cF1>if</span><span class=cF0> (!</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="l198"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"Invalid FileName: \"%s\".\n"</span><span class=cF0>, dirc->mask);
|
|
<a name="l199"></a> </span><span class=cF1>else</span><span class=cF0>
|
|
<a name="l200"></a> </span><span class=cF7>{</span><span class=cF0>
|
|
<a name="l201"></a> </span><span class=cF6>"Make Directory:%s\n"</span><span class=cF0>, filename;
|
|
<a name="l202"></a> name = </span><span class=cF5>MStrUtil</span><span class=cF0>(dirc->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="l203"></a> </span><span class=cF1>switch</span><span class=cF0> (dirc->drive->fs_type)
|
|
<a name="l204"></a> {
|
|
<a name="l205"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_REDSEA</span><span class=cF0>:
|
|
<a name="l206"></a> res = </span><span class=cFD>RedSeaMkDir</span><span class=cF0>(dirc->drive, </span><span class=cF5>Fs</span><span class=cF0>->cur_dir, name, entry_count);
|
|
<a name="l207"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l208"></a>
|
|
<a name="l209"></a> </span><span class=cF1>case</span><span class=cF0> </span><span class=cF3>FSt_FAT32</span><span class=cF0>:
|
|
<a name="l210"></a> res = </span><span class=cFD>FAT32MkDir</span><span class=cF0>(dirc->drive, </span><span class=cF5>Fs</span><span class=cF0>->cur_dir, name, entry_count);
|
|
<a name="l211"></a> </span><span class=cF1>break</span><span class=cF0>;
|
|
<a name="l212"></a>
|
|
<a name="l213"></a> </span><span class=cF1>default</span><span class=cF0>:
|
|
<a name="l214"></a> </span><span class=cF5>PrintErr</span><span class=cF0>(</span><span class=cF6>"File System Not Supported\n"</span><span class=cF0>);
|
|
<a name="l215"></a> }
|
|
<a name="l216"></a> </span><span class=cF5>Free</span><span class=cF0>(name);
|
|
<a name="l217"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l218"></a> }
|
|
<a name="l219"></a> </span><span class=cF5>DirContextDel</span><span class=cF0>(dirc);
|
|
<a name="l220"></a> </span><span class=cF7>}</span><span class=cF0>
|
|
<a name="l221"></a> </span><span class=cF1>return</span><span class=cF0> res;
|
|
<a name="l222"></a>}
|
|
</span></pre></body>
|
|
</html>
|