TempleOSCD_140715.ISO
This commit is contained in:
1 parent
7ef616a20e
commit
64f679eeb9
1095 files changed
+24814
-221011
No files matched your search
+42
-35
@@ -1,8 +1,9 @@
|
||||
#help_index "File/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
|
||||
public U8 *DBlk(I64 blk,Bool write=FALSE)
|
||||
{//Dump Disk Blk.
|
||||
//If you set write to TRUE, it will be written when you press <ESC>.
|
||||
{//Dump disk block. Optionally, write.
|
||||
//If you set write to TRUE, the block will
|
||||
//be written when you press <ESC>.
|
||||
//See $LK,"::/Demo/Dsk/DskRaw.CPP"$.
|
||||
U8 *buf=MAlloc(BLK_SIZE);
|
||||
|
||||
@@ -19,8 +20,9 @@ public U8 *DBlk(I64 blk,Bool write=FALSE)
|
||||
}
|
||||
|
||||
public U8 *DCluster(I64 c,Bool write=FALSE,I64 num=0)
|
||||
{//Dump Disk Cluster.
|
||||
//If you set write to TRUE, it will be written when you press <ESC>.
|
||||
{//Dump disk cluster. Optionally, write.
|
||||
//If you set write to TRUE, the cluster will
|
||||
//be written when you press <ESC>.
|
||||
//See $LK,"::/Demo/Dsk/DskRaw.CPP"$.
|
||||
//Do $LK,"Dir",A="MN:Dir"$("*",TRUE); to get cluster numbers of files.
|
||||
U8 *buf=MAlloc(Fs->cur_prt->spc<<BLK_SIZE_BITS);
|
||||
@@ -45,7 +47,7 @@ U0 FOFlatten(CDirEntry *tempde,CDirEntry **a,I64 *i)
|
||||
CDirEntry *tempde1;
|
||||
while (tempde) {
|
||||
tempde1=tempde->next;
|
||||
if (tempde->attr&_ATTR_DIR) {
|
||||
if (tempde->attr&RS_ATTR_DIR) {
|
||||
FOFlatten(tempde->sub,a,i);
|
||||
DirEntryDel(tempde);
|
||||
} else {
|
||||
@@ -57,10 +59,10 @@ U0 FOFlatten(CDirEntry *tempde,CDirEntry **a,I64 *i)
|
||||
}
|
||||
|
||||
public I64 FileCnt(CDirEntry *tempde)
|
||||
{
|
||||
{//Cnt of files in $LK,"CDirEntry",A="MN:CDirEntry"$ tree.
|
||||
I64 cnt=0;
|
||||
while (tempde) {
|
||||
if (tempde->attr&_ATTR_DIR)
|
||||
if (tempde->attr&RS_ATTR_DIR)
|
||||
cnt+=FileCnt(tempde->sub);
|
||||
else
|
||||
cnt++;
|
||||
@@ -72,7 +74,10 @@ public I64 FileCnt(CDirEntry *tempde)
|
||||
#help_index "File/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
|
||||
public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
|
||||
{
|
||||
{//Copy files.
|
||||
//If the name ends in ".Z", it will
|
||||
//be stored compressed. If not ".Z"
|
||||
//it will be stored uncompressed.
|
||||
Bool result=TRUE;
|
||||
CFileAccess *fa;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
@@ -83,7 +88,7 @@ public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
|
||||
if (fa=FileAccessNew(dst_files_find_mask,TRUE)) {
|
||||
while (tempde) {
|
||||
tempde1=tempde->next;
|
||||
if (!(tempde->attr & _ATTR_DIR)) {
|
||||
if (!(tempde->attr & RS_ATTR_DIR)) {
|
||||
st=FileNameAbs(tempde->name);
|
||||
if (!CopySingle(tempde->full_name,st))
|
||||
result=FALSE;
|
||||
@@ -100,7 +105,7 @@ public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
|
||||
}
|
||||
|
||||
public Bool Move(U8 *f1,U8 *f2)
|
||||
{
|
||||
{//Move files from one location to another or rename.
|
||||
if (Copy(f1,f2)) {
|
||||
Del(f1);
|
||||
return TRUE;
|
||||
@@ -116,7 +121,7 @@ I64 CopyTree2(CDirEntry *tempde,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
|
||||
st=MAlloc(StrLen(tempde->full_name)+dst_dir_len+2);
|
||||
MemCpy(st,dst_dir,dst_dir_len);
|
||||
StrCpy(st+dst_dir_len,tempde->full_name+src_dir_len);
|
||||
if (tempde->attr & _ATTR_DIR) {
|
||||
if (tempde->attr & RS_ATTR_DIR) {
|
||||
MkDir(st);
|
||||
result+=CopyTree2(tempde->sub,src_dir_len,dst_dir_len,dst_dir);
|
||||
} else
|
||||
@@ -128,7 +133,8 @@ I64 CopyTree2(CDirEntry *tempde,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
|
||||
return result;
|
||||
}
|
||||
public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,Bool no_mask=TRUE)
|
||||
{ //returns count of copied files (not dirs)
|
||||
{//Copy directory tree.
|
||||
//Returns the count of copied files (not dirs).
|
||||
CFileAccess *fa;
|
||||
CDirEntry *tempde=NULL;
|
||||
I64 result=0,i1,i2;
|
||||
@@ -158,7 +164,7 @@ public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask,Bool no_mask
|
||||
FileAccessDel(fa);
|
||||
Free(st2);
|
||||
}
|
||||
DirLstDel(tempde);
|
||||
DirTreeDel(tempde);
|
||||
Free(st1);
|
||||
}
|
||||
return result;
|
||||
@@ -170,7 +176,7 @@ I64 DelTreeDirs(CDirEntry *tempde1)
|
||||
CDirEntry *tempde2;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
result+=DelTreeDirs(tempde1->sub);
|
||||
result+=SysDel(tempde1->full_name,TRUE);
|
||||
@@ -186,7 +192,7 @@ I64 DelTreeFiles(CDirEntry *tempde1)
|
||||
CDirEntry *tempde2;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
result+=DelTreeFiles(tempde1->sub);
|
||||
} else
|
||||
@@ -197,7 +203,7 @@ I64 DelTreeFiles(CDirEntry *tempde1)
|
||||
return result;
|
||||
}
|
||||
public I64 DelTree(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
{
|
||||
{//Delete directory tree.
|
||||
I64 result=0,fuf_flags=0;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
@@ -219,7 +225,7 @@ U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=MIN_I64)
|
||||
if (FileFind(filename,&de,FUF_JUST_FILES)) {
|
||||
Free(de.full_name);
|
||||
if (!StrCmp(attr,"+?"))
|
||||
"%-48ts %s\n",filename,SPrintFlags(buf,Define("ST_FILE_ATTRS"),de.attr);
|
||||
"%-48ts %s\n",filename,StrPrintFlags(buf,Define("ST_FILE_ATTRS"),de.attr);
|
||||
else {
|
||||
StrFirstRem(cur_dir,":");
|
||||
StrLastRem(cur_dir,"/");
|
||||
@@ -236,11 +242,14 @@ U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=MIN_I64)
|
||||
PrintErr("File not found.\n");
|
||||
}
|
||||
public U0 Touch(U8 *files_find_mask,U8 *attr="+?",U8 *fu_flags=NULL,CDate cdt=MIN_I64)
|
||||
{
|
||||
//Attr "+?" =show
|
||||
// "+T" =resident
|
||||
//To Set Date
|
||||
// Touch(filename,"",,datetime);
|
||||
{/*Touch file attributes and DateTime.
|
||||
Default lists attributes.
|
||||
attr: "+?" =show current
|
||||
"+T" =resident
|
||||
$LK,"RS_ATTR_READ_ONLY",A="MN:RS_ATTR_READ_ONLY"$ $LK,"ST_FILE_ATTRS",A="MN:ST_FILE_ATTRS"$
|
||||
To Set DateL:
|
||||
Touch(filename,"",,datetime);
|
||||
*/
|
||||
I64 fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F");
|
||||
@@ -250,12 +259,11 @@ public U0 Touch(U8 *files_find_mask,U8 *attr="+?",U8 *fu_flags=NULL,CDate cdt=MI
|
||||
TouchFile(tempde->full_name,attr,cdt);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirLstDel(tempde1);
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
|
||||
public I64 FF(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
//Files Find
|
||||
{
|
||||
{//Files find. List files matching mask.
|
||||
I64 cnt=0,fuf_flags=0;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F");
|
||||
@@ -263,16 +271,17 @@ public I64 FF(U8 *files_find_mask,U8 *fu_flags=NULL)
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
PutFileLink(tempde->full_name);
|
||||
NewLine;
|
||||
'\n';
|
||||
cnt++;
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirLstDel(tempde1);
|
||||
DirTreeDel(tempde1);
|
||||
return cnt;
|
||||
}
|
||||
|
||||
public U0 SetDrvTextAttr(U8 drv_let,U8 attr)
|
||||
{ //This is to color the border text according to the current drive
|
||||
{//Set color of the window border text
|
||||
//for when this drive is the current drive.
|
||||
CPrt *p;
|
||||
try {
|
||||
p=Drv2Prt(drv_let);
|
||||
@@ -317,7 +326,7 @@ I64 FAT32UnusedDrvSpace(U8 drv_let=0)
|
||||
return result*BLK_SIZE*p->spc;
|
||||
}
|
||||
public I64 UnusedDrvSpace(U8 drv_let=0)
|
||||
{ //returns size in bytes
|
||||
{//Returns unused size in bytes.
|
||||
CPrt *p=Drv2Prt(drv_let),*p_old=Fs->cur_prt;
|
||||
U8 *old_dir=StrNew(Fs->cur_dir);
|
||||
I64 result=0;
|
||||
@@ -346,14 +355,14 @@ I64 Size1(CDirEntry *tempde,I64 *_fuf_flags,I64 round_to)
|
||||
CPrt *p;
|
||||
while (tempde) {
|
||||
if ((i=tempde->size) && Bt(_fuf_flags,FUf_EXPAND) &&
|
||||
!(tempde->attr&_ATTR_DIR) && FileAttr(tempde->name)&_ATTR_COMPRESSED) {
|
||||
!(tempde->attr&RS_ATTR_DIR) && FileAttr(tempde->name)&RS_ATTR_COMPRESSED) {
|
||||
p=Drv2Prt(*tempde->full_name);
|
||||
RBlks(p,buf,Cluster2Blk(p,tempde->cluster),1);
|
||||
i=(&buf)(CArcCompress *)->expanded_size;
|
||||
}
|
||||
if (round_to)
|
||||
i=CeilU64(tempde->size,round_to);
|
||||
if (tempde->attr&_ATTR_DIR)
|
||||
if (tempde->attr&RS_ATTR_DIR)
|
||||
i+=Size1(tempde->sub,_fuf_flags,round_to);
|
||||
tempde->user_data=i;
|
||||
result+=i;
|
||||
@@ -362,8 +371,7 @@ I64 Size1(CDirEntry *tempde,I64 *_fuf_flags,I64 round_to)
|
||||
return result;
|
||||
}
|
||||
public I64 Size(U8 *files_find_mask="/*",U8 *fu_flags=NULL,I64 round_to=0)
|
||||
{
|
||||
//"+x" for expanded size.
|
||||
{//Total size of files in mask. "+x" for expanded size.
|
||||
//Does not include directory size of base directory, but
|
||||
//does include size of sub directories.
|
||||
I64 fuf_flags=0,result=0;
|
||||
@@ -373,8 +381,7 @@ public I64 Size(U8 *files_find_mask="/*",U8 *fu_flags=NULL,I64 round_to=0)
|
||||
if (tempde1=FilesFind(files_find_mask,fuf_flags&FUG_FILES_FIND)) {
|
||||
fuf_flags&=FUF_EXPAND;
|
||||
result=Size1(tempde1,&fuf_flags,round_to);
|
||||
DirLstDel(tempde1);
|
||||
DirTreeDel(tempde1);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#help_index ""
|
||||
Reference in new issue
Block a user