TempleOSCD_140715.ISO
This commit is contained in:
1 parent
7ef616a20e
commit
64f679eeb9
1095 files changed
+24814
-221011
No files matched your search
+7
-8
@@ -17,7 +17,7 @@ I64 RedSeaFSChkDskLst(CDirEntry *tempde1,U8 *bits,U8 *bits2,I64 size,I64 bpc)
|
||||
I64 i,j,errs=0;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
errs+=RedSeaFSChkDskLst(tempde1->sub,bits,bits2,size,bpc);
|
||||
}
|
||||
@@ -50,7 +50,7 @@ I64 RedSeaFSChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
{
|
||||
I64 i,j,bpc,size,errs=0;
|
||||
CPrt *p=Drv2Prt(drv_let),*old_prt=Fs->cur_prt;
|
||||
U8 *files_find_mask=MPrint("%c:/*",Prt2Drv(p)),
|
||||
U8 *files_find_mask=MStrPrint("%c:/*",Prt2Drv(p)),
|
||||
*old_dir=StrNew(Fs->cur_dir),
|
||||
*bits,*bits2;
|
||||
CDirEntry *ptr,*ptr2;
|
||||
@@ -110,7 +110,7 @@ I64 FAT32ChkDskLst(CPrt *p,CDirEntry *tempde1,U8 *bits,U32 *bits2,I64 size,I64 b
|
||||
I64 i,c,errs=0;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (tempde1->attr & _ATTR_DIR) {
|
||||
if (tempde1->attr & RS_ATTR_DIR) {
|
||||
if (tempde1->sub)
|
||||
errs+=FAT32ChkDskLst(p,tempde1->sub,bits,bits2,size,bpc);
|
||||
}
|
||||
@@ -134,7 +134,7 @@ I64 FAT32ChkDskLst(CPrt *p,CDirEntry *tempde1,U8 *bits,U32 *bits2,I64 size,I64 b
|
||||
c=ClusterNumNext(p,c);
|
||||
i++;
|
||||
}
|
||||
if (!(tempde1->attr & _ATTR_DIR)) {
|
||||
if (!(tempde1->attr & RS_ATTR_DIR)) {
|
||||
i*=bpc;
|
||||
if (tempde1->size>i) {
|
||||
PrintErr("Allocated File Too Short:%s\n",tempde1->full_name);
|
||||
@@ -155,7 +155,7 @@ I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
{
|
||||
I64 i,bpc,size,c,errs=0;
|
||||
CPrt *p=Drv2Prt(drv_let),*old_prt=Fs->cur_prt;
|
||||
U8 *files_find_mask=MPrint("%c:/*",Prt2Drv(p)),
|
||||
U8 *files_find_mask=MStrPrint("%c:/*",Prt2Drv(p)),
|
||||
*old_dir=StrNew(Fs->cur_dir),
|
||||
*bits;
|
||||
U32 *bits2;
|
||||
@@ -206,7 +206,8 @@ I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
|
||||
}
|
||||
|
||||
public I64 ChkDsk(U8 drv_let=0,Bool fix=FALSE,Bool confirm=TRUE)
|
||||
{ //Check for allocation errors.
|
||||
{//Check disk for allocation errors and, optionally, fix.
|
||||
//You probably want to reformat and reinstall.
|
||||
I64 errs=0;
|
||||
CPrt *p=Drv2Prt(drv_let);
|
||||
switch (p->type) {
|
||||
@@ -228,5 +229,3 @@ public I64 ChkDsk(U8 drv_let=0,Bool fix=FALSE,Bool confirm=TRUE)
|
||||
}
|
||||
return errs;
|
||||
}
|
||||
|
||||
#help_index ""
|
||||
+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 ""
|
||||
+76
-48
@@ -1,28 +1,26 @@
|
||||
#help_index "File/Program Routines/Utils"
|
||||
|
||||
I64 DirTreeFlattenSize(CDirEntry *tempde)
|
||||
#help_index "File/Internal"
|
||||
I64 DirTreeSerializeSize(CDirEntry *tempde)
|
||||
{
|
||||
I64 result=0;
|
||||
while (tempde) {
|
||||
result+=CDIR_SIZE+1;
|
||||
if (tempde->attr & _ATTR_DIR)
|
||||
result+=DirTreeFlattenSize(tempde->sub);
|
||||
if (tempde->attr & RS_ATTR_DIR)
|
||||
result+=DirTreeSerializeSize(tempde->sub);
|
||||
tempde=tempde->next;
|
||||
}
|
||||
return result+1;
|
||||
}
|
||||
I64 DirTreeFlattenFill(CDirEntry *tempde,U8 *dst)
|
||||
I64 DirTreeSerializeFill(CDirEntry *tempde,U8 *dst)
|
||||
{
|
||||
I64 result=0,i;
|
||||
while (tempde) {
|
||||
*dst++=1;
|
||||
result++;
|
||||
i=CDIR_SIZE;
|
||||
MemCpy(dst,&tempde->start,i);
|
||||
dst+=i;
|
||||
result+=i;
|
||||
if (tempde->attr & _ATTR_DIR) {
|
||||
i=DirTreeFlattenFill(tempde->sub,dst);
|
||||
MemCpy(dst,&tempde->start,CDIR_SIZE);
|
||||
dst+=CDIR_SIZE;
|
||||
result+=CDIR_SIZE;
|
||||
if (tempde->attr & RS_ATTR_DIR) {
|
||||
i=DirTreeSerializeFill(tempde->sub,dst);
|
||||
dst+=i;
|
||||
result+=i;
|
||||
}
|
||||
@@ -31,36 +29,34 @@ I64 DirTreeFlattenFill(CDirEntry *tempde,U8 *dst)
|
||||
*dst=0;
|
||||
return result+1;
|
||||
}
|
||||
public U8 *DirTreeFlatten(CDirEntry *tempde,I64 *_size=NULL)
|
||||
{
|
||||
I64 size=DirTreeFlattenSize(tempde);
|
||||
public U8 *DirTreeSerialize(CDirEntry *tempde,I64 *_size=NULL)
|
||||
{//Serialize tree returned from $LK,"FilesFind",A="MN:FilesFind"$() into a one contiguous U8 array.
|
||||
I64 size=DirTreeSerializeSize(tempde);
|
||||
U8 *buf=MAlloc(size);
|
||||
DirTreeFlattenFill(tempde,buf);
|
||||
DirTreeSerializeFill(tempde,buf);
|
||||
if (_size) *_size=size;
|
||||
return buf;
|
||||
}
|
||||
|
||||
U8 *DirTreeDoUnflatten(U8 *src,CDirEntry **tempde)
|
||||
U8 *DirTreeUnserialize2(U8 *src,CDirEntry **tempde)
|
||||
{
|
||||
I64 i;
|
||||
CDirEntry *tempde1;
|
||||
if (*src++) {
|
||||
tempde1=CAlloc(sizeof(CDirEntry));
|
||||
*tempde=tempde1;
|
||||
i=CDIR_SIZE;
|
||||
MemCpy(&tempde1->start,src,i);
|
||||
src+=i;
|
||||
if (tempde1->attr & _ATTR_DIR)
|
||||
src=DirTreeDoUnflatten(src,&tempde1->sub);
|
||||
src=DirTreeDoUnflatten(src,&tempde1->next);
|
||||
MemCpy(&tempde1->start,src,CDIR_SIZE);
|
||||
src+=CDIR_SIZE;
|
||||
if (tempde1->attr & RS_ATTR_DIR)
|
||||
src=DirTreeUnserialize2(src,&tempde1->sub);
|
||||
src=DirTreeUnserialize2(src,&tempde1->next);
|
||||
} else
|
||||
*tempde=NULL;
|
||||
return src;
|
||||
}
|
||||
public CDirEntry *DirTreeUnflatten(U8 *src)
|
||||
{
|
||||
public CDirEntry *DirTreeUnserialize(U8 *src)
|
||||
{//Unserialize tree to make it like a tree returned from $LK,"FilesFind",A="MN:FilesFind"$().
|
||||
CDirEntry *tempde=NULL;
|
||||
DirTreeDoUnflatten(src,&tempde);
|
||||
DirTreeUnserialize2(src,&tempde);
|
||||
return tempde;
|
||||
}
|
||||
|
||||
@@ -76,13 +72,13 @@ class CPlannedPrt
|
||||
Bool pri;
|
||||
};
|
||||
|
||||
//This is available to assist in writing scripts.
|
||||
//Available to assist in writing scripts.
|
||||
I64 prt_dsk_dsk_size;
|
||||
|
||||
public U0 PrtDsk(U8 drv_let=0)
|
||||
//Partition Disk containing partition drv_let.
|
||||
//or drv_let=0 means add new drv that is not already mounted.
|
||||
{
|
||||
{//Partition the disk containing partition drv_let.
|
||||
//drv_let=0 means add new drive that
|
||||
//is not already mounted.
|
||||
CBlkDev *bdev;
|
||||
CPlannedPrt root,*temppp;
|
||||
CMasterBoot mbr;
|
||||
@@ -141,7 +137,7 @@ public U0 PrtDsk(U8 drv_let=0)
|
||||
}
|
||||
"Blocks Remaining:%d (0x%X)\n",
|
||||
remaining-PRT_HEADER,remaining-PRT_HEADER;
|
||||
temppp->size=CeilU64(PmtI64("Size in Blocks :",
|
||||
temppp->size=CeilU64(GetI64("Size in Blocks :",
|
||||
remaining-PRT_HEADER)+PRT_HEADER,ROUND_PRT_TO);
|
||||
} while (!(ROUND_PRT_TO<=temppp->size<=FloorU64(remaining,ROUND_PRT_TO)));
|
||||
QueIns(temppp,root.last);
|
||||
@@ -237,7 +233,6 @@ pd_done:
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#help_index "Info;File/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
|
||||
U0 RedSeaFSDrvView(U8 drv_let=0)
|
||||
@@ -267,9 +262,9 @@ U0 RedSeaFSDrvView(U8 drv_let=0)
|
||||
lohi=i*s;
|
||||
c1=lohi/l;
|
||||
if (Bt(bitmap,c1))
|
||||
dc->color=ROP_XOR+BLUE^COLOR_TRANSPARENT;
|
||||
dc->color=ROP_XOR+BLUE^TRANSPARENT;
|
||||
else
|
||||
dc->color=ROP_XOR+WHITE^COLOR_TRANSPARENT;
|
||||
dc->color=ROP_XOR+WHITE^TRANSPARENT;
|
||||
GrPlot(dc,x,y);
|
||||
i++;
|
||||
}
|
||||
@@ -309,9 +304,9 @@ U0 FAT32DrvView(U8 drv_let=0)
|
||||
lohi=i*s;
|
||||
c1=lohi/l;
|
||||
if (bitmap[c1])
|
||||
dc->color=ROP_XOR+BLUE^COLOR_TRANSPARENT;
|
||||
dc->color=ROP_XOR+BLUE^TRANSPARENT;
|
||||
else
|
||||
dc->color=ROP_XOR+WHITE^COLOR_TRANSPARENT;
|
||||
dc->color=ROP_XOR+WHITE^TRANSPARENT;
|
||||
GrPlot(dc,x,y);
|
||||
i++;
|
||||
}
|
||||
@@ -326,7 +321,7 @@ U0 FAT32DrvView(U8 drv_let=0)
|
||||
DCDel(dc);
|
||||
}
|
||||
public U0 DrvView(U8 drv_let=0)
|
||||
{
|
||||
{//Drive view. Graph the allocation map's fragmentation.
|
||||
CPrt *p=Drv2Prt(drv_let),*p_old=Fs->cur_prt;
|
||||
Drv(drv_let);
|
||||
switch (p->type) {
|
||||
@@ -343,7 +338,7 @@ public U0 DrvView(U8 drv_let=0)
|
||||
}
|
||||
|
||||
public U0 DskView(U8 drv_let=0)
|
||||
{
|
||||
{//Disk view. Pie chart of partition sizes.
|
||||
I64 i,j,
|
||||
h=Fs->pix_width,
|
||||
v=Fs->pix_height,
|
||||
@@ -366,7 +361,7 @@ public U0 DskView(U8 drv_let=0)
|
||||
|
||||
j=1;
|
||||
for (i=0;i<NUM_PRTS;i++) {
|
||||
p=&sys_prts[i];
|
||||
p=&dsk.prts[i];
|
||||
if (bdev==p->bdev && p->type) {
|
||||
sect_start=-(p->offset*2*ã/(bdev->max_blk+1));
|
||||
sect_end =-((p->offset+p->size)*2*ã/(bdev->max_blk+1));
|
||||
@@ -394,12 +389,45 @@ public U0 DskView(U8 drv_let=0)
|
||||
DCDel(dc);
|
||||
}
|
||||
|
||||
#help_index "Info;File/Cmd Line (Typically);Cmd Line (Typically);Install"
|
||||
public U0 BlkDevRep()
|
||||
{
|
||||
I64 i;
|
||||
for (i=0;i<NUM_BLKDEVS;i++)
|
||||
if (sys_blkdevs[i].bd_signature==BD_SIGNATURE_VAL)
|
||||
ClassRep(&sys_blkdevs[i]);
|
||||
public I64 Zip(U8 *files_find_mask="*",U8 *fu_flags=NULL)
|
||||
{//Compress files by moving to .Z filename.
|
||||
U8 *st;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
I64 result=0,fuf_flags=0;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+O");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
if (!IsDotZ(tempde->full_name)) {
|
||||
st=MStrPrint("%s.Z",tempde->full_name);
|
||||
result+=Move(tempde->full_name,st);
|
||||
Free(st);
|
||||
}
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
return result;
|
||||
}
|
||||
|
||||
public I64 Unzip(U8 *files_find_mask="*.Z",U8 *fu_flags=NULL)
|
||||
{//Uncompress files by moving to not .Z filename.
|
||||
//You don't have to do this for normal operation.
|
||||
//It automatically unzips ".Z" files.
|
||||
U8 *st;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
I64 result=0,fuf_flags=0;
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F+O");
|
||||
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
|
||||
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
|
||||
while (tempde) {
|
||||
if (IsDotZ(tempde->full_name)) {
|
||||
st=StrNew(tempde->full_name);
|
||||
StrLastRem(st,".");
|
||||
result+=Move(tempde->full_name,st);
|
||||
Free(st);
|
||||
}
|
||||
tempde=tempde->next;
|
||||
}
|
||||
DirTreeDel(tempde1);
|
||||
return result;
|
||||
}
|
||||
#help_index ""
|
||||
+45
-52
@@ -1,21 +1,15 @@
|
||||
#help_index "Doc/Output"
|
||||
#help_index "DolDoc/Output"
|
||||
U0 DirFileDoc(CDoc *doc,CDirEntry *tempde)
|
||||
{
|
||||
CDocEntry *doc_e;
|
||||
while (tempde) {
|
||||
if (tempde->attr & _ATTR_DIR) {
|
||||
doc_e=DocPrint(doc,"$$TR,\"%s\"$$",tempde->name);
|
||||
doc_e->user_data=tempde;
|
||||
tempde->user_data=doc_e;
|
||||
if (tempde->attr & RS_ATTR_DIR) {
|
||||
tempde->user_data=DocPrint(doc,"$$TR,\"%s\",U=0x%X$$",tempde->name,tempde);
|
||||
DocPrint(doc,"\n$$ID,+2$$");
|
||||
if (tempde->sub)
|
||||
DirFileDoc(doc,tempde->sub);
|
||||
DocPrint(doc,"$$ID,-2$$");
|
||||
} else {
|
||||
doc_e=DocPrint(doc,"$$MU,\"%s\"$$",
|
||||
tempde->name);
|
||||
doc_e->user_data=tempde;
|
||||
tempde->user_data=doc_e;
|
||||
tempde->user_data=DocPrint(doc,"$$MU,\"%s\",U=0x%X$$",tempde->name,tempde);
|
||||
DocPrint(doc,"\n");
|
||||
}
|
||||
tempde=tempde->next;
|
||||
@@ -24,6 +18,10 @@ U0 DirFileDoc(CDoc *doc,CDirEntry *tempde)
|
||||
|
||||
#help_index "File/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
|
||||
#define FM_NORMAL 0
|
||||
#define FM_PICK_FILE 1
|
||||
#define FM_PICK_DIR 2
|
||||
|
||||
class CFMUncollapsedLst
|
||||
{
|
||||
CFMUncollapsedLst *next;
|
||||
@@ -37,7 +35,7 @@ CFMUncollapsedLst *FMCollectUncollapsedLst(CDoc *doc)
|
||||
CDirEntry *tempde;
|
||||
while (doc_e!=doc) {
|
||||
if (doc_e->type_u8==DOCT_TREE) {
|
||||
if (!(doc_e->flags1&DOCEF1_CHECKED_COLLAPSED)) {
|
||||
if (!(doc_e->de_flags&DOCEF_CHECKED_COLLAPSED)) {
|
||||
if (tempde=doc_e->user_data) {
|
||||
tempc=MAlloc(sizeof(CFMUncollapsedLst));
|
||||
tempc->next=result;
|
||||
@@ -62,7 +60,7 @@ U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tempc,U8 *cur_entry,U8 *next_e
|
||||
tempc1=tempc;
|
||||
while (tempc1) {
|
||||
if (!StrCmp(tempc1->name,tempde->full_name)) {
|
||||
doc_e->flags1&=~DOCEF1_CHECKED_COLLAPSED;
|
||||
doc_e->de_flags&=~DOCEF_CHECKED_COLLAPSED;
|
||||
break;
|
||||
}
|
||||
tempc1=tempc1->next;
|
||||
@@ -113,21 +111,18 @@ U0 FMDelUncollapsedLst(CFMUncollapsedLst *tempc)
|
||||
|
||||
CDirEntry *FMRebuildDocDrv(U8 drv_let,CDoc *doc,CDirEntry **_root,Bool init)
|
||||
{
|
||||
CDocEntry *doc_e;
|
||||
CDirEntry *tempde,*tempde1;
|
||||
U8 *st;
|
||||
tempde=CAlloc(sizeof(CDirEntry));
|
||||
tempde->full_name=MPrint("%C:/",drv_let);
|
||||
tempde->attr=_ATTR_DIR;
|
||||
st=MPrint("%c:/*",drv_let);
|
||||
tempde->full_name=MStrPrint("%C:/",drv_let);
|
||||
tempde->attr=RS_ATTR_DIR;
|
||||
st=MStrPrint("%c:/*",drv_let);
|
||||
if (init)
|
||||
tempde->sub=tempde1=FilesFind(st,FUF_RECURSE);
|
||||
else
|
||||
tempde1=NULL;
|
||||
Free(st);
|
||||
doc_e=DocPrint(doc,"$$TR,\"%s\"$$",tempde->full_name);
|
||||
doc_e->user_data=tempde;
|
||||
tempde->user_data=doc_e;
|
||||
tempde->user_data=DocPrint(doc,"$$TR,\"%s\",U=0x%X$$",tempde->full_name,tempde);
|
||||
tempde->next=*_root;
|
||||
*_root=tempde;
|
||||
DocPrint(doc,"\n$$ID,+2$$");
|
||||
@@ -195,16 +190,16 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
|
||||
DocDel(doc);
|
||||
}
|
||||
if (*_root) {
|
||||
DirLstDel(*_root);
|
||||
DirTreeDel(*_root);
|
||||
*_root=NULL;
|
||||
}
|
||||
doc=DocNew;
|
||||
StrCpy(doc->desc,"FileMan");
|
||||
doc->desc='FileMan';
|
||||
doc->parent_doc=parent_doc;
|
||||
doc->flags|=DOCF_FORM;
|
||||
switch (mode) {
|
||||
case FM_NORMAL:
|
||||
DocPrint(doc,"$$PURPLE$$File Manager\n\n$$LK,\"Click for Help\",\"FI:::/Doc/FileMgr.TXT\"$$\n\n");
|
||||
DocPrint(doc,"$$PURPLE$$File Manager\n\n$$LK,\"Click for Help\",A=\"FI:::/Doc/FileMgr.TXT\"$$\n\n");
|
||||
break;
|
||||
case FM_PICK_FILE:
|
||||
DocPrint(doc,"$$PURPLE$$Pick file and press <ESC>\n\n");
|
||||
@@ -217,7 +212,7 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
|
||||
}
|
||||
DocPrint(doc,"$$LTBLUE$$");
|
||||
for (i=0;i<NUM_PRTS;i++) {
|
||||
p=&sys_prts[i];
|
||||
p=&dsk.prts[i];
|
||||
if (p->type==PT_REDSEA||p->type==PT_FAT32)
|
||||
FMRebuildDocDrv(Prt2Drv(p),doc,_root,TRUE);
|
||||
else if (p->type==PT_ISO9660) {
|
||||
@@ -230,7 +225,7 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
|
||||
tempde->flags|=DEF_REMOVABLE;
|
||||
}
|
||||
}
|
||||
DocHome(doc);
|
||||
DocTop(doc);
|
||||
FMMarkUncollapsed(doc,tempc,cur_entry,next_entry);
|
||||
DocCenter(doc);
|
||||
DocRst(doc2,TRUE);
|
||||
@@ -310,7 +305,7 @@ U0 FMDelete(CDoc *doc)
|
||||
if (doc_ce->type_u8==DOCT_MENU_VAL) {
|
||||
tempde=doc_ce->user_data;
|
||||
Silent(ON);
|
||||
st=MPrint("Delete: %s",tempde->full_name);
|
||||
st=MStrPrint("Delete: %s",tempde->full_name);
|
||||
if (PopUpCancelOk(st))
|
||||
Del(tempde->full_name);
|
||||
Free(st);
|
||||
@@ -318,7 +313,7 @@ U0 FMDelete(CDoc *doc)
|
||||
} else if (doc_ce->type_u8==DOCT_TREE) {
|
||||
tempde=doc_ce->user_data;
|
||||
Silent(ON);
|
||||
st=MPrint("Delete: %s",tempde->full_name);
|
||||
st=MStrPrint("Delete: %s",tempde->full_name);
|
||||
if (PopUpCancelOk(st))
|
||||
DelTree(tempde->full_name);
|
||||
Free(st);
|
||||
@@ -355,7 +350,7 @@ U0 FMFmtDrv(CDoc *doc)
|
||||
if (tempde) {
|
||||
while (tempde->parent)
|
||||
tempde=tempde->parent;
|
||||
st=MPrint("Format Drive '%c'?\nAre You Sure?\n",*tempde->full_name);
|
||||
st=MStrPrint("Format Drive '%c'?\nAre You Sure?\n",*tempde->full_name);
|
||||
if (PopUpCancelOk(st)) {
|
||||
Silent(ON);
|
||||
Fmt(*tempde->full_name,,FALSE);
|
||||
@@ -380,9 +375,9 @@ U0 FMMakeISO(CDoc *doc)
|
||||
if (tempde && *tempde->full_name) {
|
||||
Silent(ON);
|
||||
if (tempde->full_name[StrLen(tempde->full_name)-1]=='/')
|
||||
st=MPrint("%s*",tempde->full_name);
|
||||
st=MStrPrint("%s*",tempde->full_name);
|
||||
else
|
||||
st=MPrint("%s/*",tempde->full_name);
|
||||
st=MStrPrint("%s/*",tempde->full_name);
|
||||
CDFileCreate(,st);
|
||||
Free(st);
|
||||
Silent(OFF);
|
||||
@@ -439,9 +434,9 @@ U0 FMCopy(CDoc *doc)
|
||||
if (!tempde2 || !(tempde2->flags&DEF_PROCESSED)) {
|
||||
Silent(ON);
|
||||
if (*tempde1->name)
|
||||
st=MPrint("%s/%s",tempde1->full_name,tempde->name);
|
||||
st=MStrPrint("%s/%s",tempde1->full_name,tempde->name);
|
||||
else
|
||||
st=MPrint("%s%s",tempde1->full_name,tempde->name);
|
||||
st=MStrPrint("%s%s",tempde1->full_name,tempde->name);
|
||||
CopyTree(tempde->full_name,st);
|
||||
Free(st);
|
||||
Silent(OFF);
|
||||
@@ -533,7 +528,6 @@ U0 FMRightClick()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
U8 *fm_ip_str=NULL;
|
||||
U0 (*fp_old_final_screen_update)(CDC *dc);
|
||||
|
||||
@@ -541,34 +535,34 @@ U0 FMFinalScreenUpdate(CDC *dc)
|
||||
{
|
||||
if (fm_ip_str) {
|
||||
dc->color=LTRED;
|
||||
GrPrint(dc,ipx,ipy,"%s",fm_ip_str);
|
||||
GrPrint(dc,ip.pos.x,ip.pos.y,"%s",fm_ip_str);
|
||||
}
|
||||
(*fp_old_final_screen_update)(dc);
|
||||
}
|
||||
|
||||
public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
{
|
||||
{//File manager. Also, used to choose files and dirs.
|
||||
CDirEntry *root=NULL,*tempde,*tempde1,*tempde2;
|
||||
I64 sc,ch,p1,p2,msg_code;
|
||||
I64 sc,ch,a1,a2,msg_code;
|
||||
CDoc *doc=NULL,*old_put_doc=DocPut,*old_display_doc=DocDisplay;
|
||||
U8 *result=NULL,*st,*st2,*old_cur_dir=CurDir;
|
||||
CDocEntry *doc_ce=NULL,*doc_e;
|
||||
Bool okay;
|
||||
|
||||
SettingsPush; //See $LK,"SettingsPush",A="MN:SettingsPush"$
|
||||
fp_old_final_screen_update=fp_final_screen_update;
|
||||
fp_old_final_screen_update=gr.fp_final_screen_update;
|
||||
MenuFilePush("::/Doc/FileMgrPullDown.TXT");
|
||||
FMRebuildDoc(&doc,&root,mode);
|
||||
if (tempde1=Cd2DirEntry(root,old_cur_dir))
|
||||
doc->cur_entry=tempde1->user_data;
|
||||
while (tempde1) {
|
||||
if (tempde1->attr&_ATTR_DIR)
|
||||
tempde1->user_data(CDocEntry *)->flags1&=~DOCEF1_CHECKED_COLLAPSED;
|
||||
if (tempde1->attr&RS_ATTR_DIR)
|
||||
tempde1->user_data(CDocEntry *)->de_flags&=~DOCEF_CHECKED_COLLAPSED;
|
||||
tempde1=tempde1->parent;
|
||||
}
|
||||
do {
|
||||
DocUnlock(doc);
|
||||
do msg_code=GetMsg(&p1,&p2,
|
||||
do msg_code=GetMsg(&a1,&a2,
|
||||
1<<MSG_KEY_DOWN|1<<MSG_IP_L_DOWN|1<<MSG_IP_L_UP|
|
||||
1<<MSG_IP_R_UP);
|
||||
while (Fs!=sys_focus_task);
|
||||
@@ -582,12 +576,12 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
case MSG_IP_L_DOWN:
|
||||
doc_ce=doc->cur_entry;
|
||||
fm_ip_str=doc_ce->tag;
|
||||
fp_final_screen_update=&FMFinalScreenUpdate;
|
||||
gr.fp_final_screen_update=&FMFinalScreenUpdate;
|
||||
break;
|
||||
case MSG_IP_L_UP:
|
||||
if (doc_ce) {
|
||||
fp_final_screen_update=fp_old_final_screen_update;
|
||||
if (SetCursorPos(Fs,p1/FONT_WIDTH+Fs->win_left+Fs->scroll_x/FONT_WIDTH,p2/FONT_HEIGHT+Fs->win_top+Fs->scroll_y/FONT_HEIGHT,TRUE)) {
|
||||
gr.fp_final_screen_update=fp_old_final_screen_update;
|
||||
if (SetCursorPos(Fs,a1/FONT_WIDTH+Fs->win_left+Fs->scroll_x/FONT_WIDTH,a2/FONT_HEIGHT+Fs->win_top+Fs->scroll_y/FONT_HEIGHT,TRUE)) {
|
||||
doc_e=doc->cur_entry;
|
||||
if (doc_e!=doc_ce) {
|
||||
st2=NULL;
|
||||
@@ -619,9 +613,9 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
}
|
||||
if (okay) {
|
||||
if (*tempde1->name)
|
||||
st=MPrint("%s/%s",tempde1->full_name,tempde->name);
|
||||
st=MStrPrint("%s/%s",tempde1->full_name,tempde->name);
|
||||
else
|
||||
st=MPrint("%s%s",tempde1->full_name,tempde->name);
|
||||
st=MStrPrint("%s%s",tempde1->full_name,tempde->name);
|
||||
if (StrCmp(tempde->full_name,st)) {
|
||||
Silent(ON);
|
||||
CopyTree(tempde->full_name,st);
|
||||
@@ -646,10 +640,10 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
break;
|
||||
case MSG_KEY_DOWN:
|
||||
doc_ce=NULL;
|
||||
ch=p1; sc=p2;
|
||||
ch=a1; sc=a2;
|
||||
if (sc.u8[0]==SC_DELETE && !(sc&(SCF_SHIFT|SCF_CTRL)))
|
||||
ch=CH_CTRLY;
|
||||
if (ch && sc&SCF_ALT) goto regular_key;
|
||||
if (ch && sc&SCF_ALT) goto fm_regular_key;
|
||||
switch (ch) {
|
||||
case '\n':
|
||||
DocUnlock(doc);
|
||||
@@ -693,7 +687,7 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
Ed(doc->cur_entry->user_data(CDirEntry *)->full_name);
|
||||
DocLock(doc);
|
||||
} else
|
||||
goto regular_key;
|
||||
goto fm_regular_key;
|
||||
break;
|
||||
case CH_SHIFT_SPACE:
|
||||
if (doc->cur_entry->type_u8==DOCT_MENU_VAL) {
|
||||
@@ -701,7 +695,7 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
Plain(doc->cur_entry->user_data(CDirEntry *)->full_name);
|
||||
DocLock(doc);
|
||||
} else
|
||||
goto regular_key;
|
||||
goto fm_regular_key;
|
||||
break;
|
||||
case CH_ESC:
|
||||
doc_ce=doc->cur_entry;
|
||||
@@ -730,7 +724,7 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
|
||||
DocLock(doc);
|
||||
}
|
||||
} else {
|
||||
regular_key:
|
||||
fm_regular_key:
|
||||
DocUnlock(doc);
|
||||
PutKey(ch,sc);
|
||||
DocLock(doc);
|
||||
@@ -739,12 +733,12 @@ regular_key:
|
||||
break;
|
||||
}
|
||||
} while (ch!=CH_ESC && ch!=CH_SHIFT_ESC);
|
||||
fp_final_screen_update=fp_old_final_screen_update;
|
||||
gr.fp_final_screen_update=fp_old_final_screen_update;
|
||||
Fs->put_doc =old_put_doc;
|
||||
Fs->display_doc=old_display_doc;
|
||||
SettingsPop;
|
||||
DocDel(doc);
|
||||
DirLstDel(root);
|
||||
DirTreeDel(root);
|
||||
Cd(old_cur_dir);
|
||||
Free(old_cur_dir);
|
||||
if (mode!=FM_NORMAL && !result)
|
||||
@@ -752,4 +746,3 @@ regular_key:
|
||||
MenuPop;
|
||||
return result;
|
||||
}
|
||||
#help_index ""
|
||||
Reference in new issue
Block a user