TempleOSTS_131005.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:45:52 +02:00
1 parent 1343005a29
commit 2d2a65d572
547 files changed
+33608 -12549

No files matched your search

+47 -47
View File
@@ -11,37 +11,37 @@ Bool ChkDskConfirm(Bool *_fix,Bool *_confirm)
return *_fix;
}
I64 RedSeaFSChkDskLst(CDirEntry *tempm1,U8 *bits,U8 *bits2,I64 size,I64 bpc)
I64 RedSeaFSChkDskLst(CDirEntry *tempde1,U8 *bits,U8 *bits2,I64 size,I64 bpc)
{
CDirEntry *tempm2;
CDirEntry *tempde2;
I64 i,j,errs=0;
while (tempm1) {
tempm2=tempm1->next;
if (tempm1->attr & _ATTR_DIR) {
if (tempm1->sub)
errs+=RedSeaFSChkDskLst(tempm1->sub,bits,bits2,size,bpc);
while (tempde1) {
tempde2=tempde1->next;
if (tempde1->attr & _ATTR_DIR) {
if (tempde1->sub)
errs+=RedSeaFSChkDskLst(tempde1->sub,bits,bits2,size,bpc);
}
j=(tempm1->size+bpc-1)/bpc;
j=(tempde1->size+bpc-1)/bpc;
for (i=0;i<j;i++) {
if (i+tempm1->cluster>size) {
PrintFErr("Invalid Cluster:%s Cluster:%X\n",tempm1->full_name,
i+tempm1->cluster);
if (i+tempde1->cluster>size) {
PrintErr("Invalid Cluster:%s Cluster:%X\n",tempde1->full_name,
i+tempde1->cluster);
errs++;
break;
}
if (LBts(bits,i+tempm1->cluster)) {
PrintFErr("Dbl Alloc:%s Cluster:%X\n",tempm1->full_name,
i+tempm1->cluster);
if (LBts(bits,i+tempde1->cluster)) {
PrintErr("Dbl Alloc:%s Cluster:%X\n",tempde1->full_name,
i+tempde1->cluster);
errs++;
}
if (!LBtr(bits2,i+tempm1->cluster)) {
PrintFErr("UnAlloc:%s Cluster:%X\n",tempm1->full_name,
i+tempm1->cluster);
if (!LBtr(bits2,i+tempde1->cluster)) {
PrintErr("UnAlloc:%s Cluster:%X\n",tempde1->full_name,
i+tempde1->cluster);
errs++;
}
}
CDirEntryDel(tempm1);
tempm1=tempm2;
DirEntryDel(tempde1);
tempde1=tempde2;
}
return errs;
}
@@ -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=MSPrintF("%c:/*",Prt2Drv(p)),
U8 *files_find_mask=MPrint("%c:/*",Prt2Drv(p)),
*old_dir=StrNew(Fs->cur_dir),
*bits,*bits2;
CDirEntry *ptr,*ptr2;
@@ -72,16 +72,16 @@ I64 RedSeaFSChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
for (i=0;i<j;i++) {
if (i+p->root_cluster>size) {
PrintFErr("Invalid Cluster: RootDir Cluster:%X\n",i+p->root_cluster);
PrintErr("Invalid Cluster: RootDir Cluster:%X\n",i+p->root_cluster);
errs++;
break;
}
if (LBts(bits,i+p->root_cluster)) {
PrintFErr("Dbl Alloc: RootDir Cluster:%X\n",i+p->root_cluster);
PrintErr("Dbl Alloc: RootDir Cluster:%X\n",i+p->root_cluster);
errs++;
}
if (!LBtr(bits2,i+p->root_cluster)) {
PrintFErr("UnAlloc: RootDir Cluster:%X\n",i+p->root_cluster);
PrintErr("UnAlloc: RootDir Cluster:%X\n",i+p->root_cluster);
errs++;
}
}
@@ -89,7 +89,7 @@ I64 RedSeaFSChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
errs+=RedSeaFSChkDskLst(FilesFind(files_find_mask,FUF_RECURSE),bits,bits2,size,bpc);
for (i=1;i<size;i++)
if (Bt(bits2,i)) {
PrintFWarn("Shouldn't Alloc Cluster:%0X\n",i);
PrintWarn("Shouldn't Alloc Cluster:%0X\n",i);
errs++;
if (ChkDskConfirm(_fix,_confirm))
RedSeaFSFreeClusters(p,i,1);
@@ -104,49 +104,49 @@ I64 RedSeaFSChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
return errs;
}
I64 FAT32ChkDskLst(CPrt *p,CDirEntry *tempm1,U8 *bits,U32 *bits2,I64 size,I64 bpc)
I64 FAT32ChkDskLst(CPrt *p,CDirEntry *tempde1,U8 *bits,U32 *bits2,I64 size,I64 bpc)
{
CDirEntry *tempm2;
CDirEntry *tempde2;
I64 i,c,errs=0;
while (tempm1) {
tempm2=tempm1->next;
if (tempm1->attr & _ATTR_DIR) {
if (tempm1->sub)
errs+=FAT32ChkDskLst(p,tempm1->sub,bits,bits2,size,bpc);
while (tempde1) {
tempde2=tempde1->next;
if (tempde1->attr & _ATTR_DIR) {
if (tempde1->sub)
errs+=FAT32ChkDskLst(p,tempde1->sub,bits,bits2,size,bpc);
}
i=0;
c=tempm1->cluster;
c=tempde1->cluster;
while (0<c<0x0FFFFFF8) {
if (c>size) {
PrintFErr("Invalid Cluster:%s Cluster:%X\n",tempm1->full_name,c);
PrintErr("Invalid Cluster:%s Cluster:%X\n",tempde1->full_name,c);
errs++;
break;
}
if (LBts(bits,c)) {
PrintFErr("Dbl Alloc:%s Cluster:%X\n",tempm1->full_name,c);
PrintErr("Dbl Alloc:%s Cluster:%X\n",tempde1->full_name,c);
errs++;
}
if (!bits2[c]) {
PrintFErr("UnAlloc:%s Cluster:%X\n",tempm1->full_name,c);
PrintErr("UnAlloc:%s Cluster:%X\n",tempde1->full_name,c);
errs++;
} else
bits2[c]=0;
c=ClusterNumNext(p,c);
i++;
}
if (!(tempm1->attr & _ATTR_DIR)) {
if (!(tempde1->attr & _ATTR_DIR)) {
i*=bpc;
if (tempm1->size>i) {
PrintFErr("Allocated File Too Short:%s\n",tempm1->full_name);
if (tempde1->size>i) {
PrintErr("Allocated File Too Short:%s\n",tempde1->full_name);
errs++;
}
if (i>tempm1->size+bpc-1) {
PrintFWarn("Allocated File Too Long:%s\n",tempm1->full_name);
if (i>tempde1->size+bpc-1) {
PrintWarn("Allocated File Too Long:%s\n",tempde1->full_name);
errs++;
}
}
CDirEntryDel(tempm1);
tempm1=tempm2;
DirEntryDel(tempde1);
tempde1=tempde2;
}
return errs;
}
@@ -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=MSPrintF("%c:/*",Prt2Drv(p)),
U8 *files_find_mask=MPrint("%c:/*",Prt2Drv(p)),
*old_dir=StrNew(Fs->cur_dir),
*bits;
U32 *bits2;
@@ -170,16 +170,16 @@ I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
c=p->root_cluster;
while (0<c<0x0FFFFFF8) {
if (c>size) {
PrintFErr("Invalid Cluster: RootDir Cluster:%X\n",c);
PrintErr("Invalid Cluster: RootDir Cluster:%X\n",c);
errs++;
break;
}
if (LBts(bits,c)) {
PrintFErr("Dbl Alloc: RootDir Cluster:%X\n",c);
PrintErr("Dbl Alloc: RootDir Cluster:%X\n",c);
errs++;
}
if (!bits2[c]) {
PrintFErr("UnAlloc: RootDir Cluster:%X\n",c);
PrintErr("UnAlloc: RootDir Cluster:%X\n",c);
errs++;
} else
bits2[c]=0;
@@ -191,7 +191,7 @@ I64 FAT32ChkDsk(U8 drv_let,Bool *_fix,Bool *_confirm)
bits2[1]=0; //See $LK,"FAT32Fmt","MN:FAT32Fmt"$()
for (i=1;i<size;i++)
if (bits2[i]) {
PrintFWarn("Shouldn't Alloc Cluster:%0X\n",i);
PrintWarn("Shouldn't Alloc Cluster:%0X\n",i);
errs++;
if (ChkDskConfirm(_fix,_confirm))
FAT32FreeClusters(p,i);
+105 -129
View File
@@ -3,7 +3,7 @@
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>.
//See $LK-A,"::/TempleOS/Demo/Dsk/Raw.CPP"$.
//See $LK-A,"::/TempleOS/Demo/Dsk/DskRaw.CPP"$.
U8 *buf=MAlloc(BLK_SIZE);
RBlks(Fs->cur_prt,buf,blk,1);
@@ -21,7 +21,7 @@ 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>.
//See $LK-A,"::/TempleOS/Demo/Dsk/Raw.CPP"$.
//See $LK-A,"::/TempleOS/Demo/Dsk/DskRaw.CPP"$.
//Do $LK,"Dir","MN:Dir"$("*",TRUE); to get cluster numbers of files.
U8 *buf=MAlloc(Fs->cur_prt->spc<<BLK_SIZE_BITS);
c=ClusterNumNext(Fs->cur_prt,c,num);
@@ -40,49 +40,48 @@ public U8 *DCluster(I64 c,Bool write=FALSE,I64 num=0)
#help_index "File/Program Routines"
U0 OFFlatten(CDirEntry *tempm,CDirEntry **a,I64 *i)
U0 FOFlatten(CDirEntry *tempde,CDirEntry **a,I64 *i)
{
CDirEntry *tempm1;
while (tempm) {
tempm1=tempm->next;
if (tempm->attr&_ATTR_DIR) {
OFFlatten(tempm->sub,a,i);
CDirEntryDel(tempm);
CDirEntry *tempde1;
while (tempde) {
tempde1=tempde->next;
if (tempde->attr&_ATTR_DIR) {
FOFlatten(tempde->sub,a,i);
DirEntryDel(tempde);
} else {
a[*i]=tempm;
a[*i]=tempde;
*i=*i+1;
}
tempm=tempm1;
tempde=tempde1;
}
}
public I64 CFileCnt(CDirEntry *tempm)
public I64 FileCnt(CDirEntry *tempde)
{
I64 cnt=0;
while (tempm) {
if (tempm->attr&_ATTR_DIR)
cnt+=CFileCnt(tempm->sub);
while (tempde) {
if (tempde->attr&_ATTR_DIR)
cnt+=FileCnt(tempde->sub);
else
cnt++;
tempm=tempm->next;
tempde=tempde->next;
}
return cnt;
}
I64 OFCompare(CDirEntry *e1,CDirEntry *e2)
I64 FOCompare(CDirEntry *tempde1,CDirEntry *tempde2)
{
return e1->cluster-e2->cluster;
return tempde1->cluster-tempde2->cluster;
}
public CDirEntry **FilesOrder(CDirEntry *tempm,I64 *_cnt=NULL)
public CDirEntry **FilesOrder(CDirEntry *tempde,I64 *_cnt=NULL)
{ //See $LK-A,"::/TempleOS/Demo/Dsk/OrderedIO.CPP"$.
I64 cnt=CFileCnt(tempm),i=0;
CDirEntry **a=MAlloc(sizeof(CDirEntry *)*cnt);
OFFlatten(tempm,a,&i);
QSortI64(a,cnt,&OFCompare);
I64 cnt=FileCnt(tempde),i=0;
CDirEntry **flst=MAlloc(sizeof(CDirEntry *)*cnt);
FOFlatten(tempde,flst,&i);
QSortI64(flst,cnt,&FOCompare);
if (_cnt) *_cnt=cnt;
return a;
return flst;
}
@@ -92,22 +91,22 @@ public Bool Copy(U8 *src_files_find_mask,U8 *dst_files_find_mask=".")
{
Bool result=TRUE;
CFileAccess *fa;
CDirEntry *tempm,*tempm1;
CDirEntry *tempde,*tempde1;
U8 *st;
if (!(tempm=FilesFind(src_files_find_mask)))
if (!(tempde=FilesFind(src_files_find_mask)))
return FALSE;
if (IsDir(dst_files_find_mask)) {
if (fa=FileAccessNew(dst_files_find_mask,TRUE)) {
while (tempm) {
tempm1=tempm->next;
if (!(tempm->attr & _ATTR_DIR)) {
st=FileNameAbs(tempm->name);
if (!CopySingle(tempm->full_name,st))
while (tempde) {
tempde1=tempde->next;
if (!(tempde->attr & _ATTR_DIR)) {
st=FileNameAbs(tempde->name);
if (!CopySingle(tempde->full_name,st))
result=FALSE;
Free(st);
}
CDirEntryDel(tempm);
tempm=tempm1;
DirEntryDel(tempde);
tempde=tempde1;
}
FileAccessDel(fa);
}
@@ -125,22 +124,22 @@ public Bool Move(U8 *f1,U8 *f2)
return FALSE;
}
I64 PutCopyTree(CDirEntry *tempm,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
I64 PutCopyTree(CDirEntry *tempde,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
{
U8 *st;
I64 result=1;
while (tempm) {
st=MAlloc(StrLen(tempm->full_name)+dst_dir_len+2);
while (tempde) {
st=MAlloc(StrLen(tempde->full_name)+dst_dir_len+2);
MemCpy(st,dst_dir,dst_dir_len);
StrCpy(st+dst_dir_len,tempm->full_name+src_dir_len);
if (tempm->attr & _ATTR_DIR) {
StrCpy(st+dst_dir_len,tempde->full_name+src_dir_len);
if (tempde->attr & _ATTR_DIR) {
MkDir(st);
result+=PutCopyTree(tempm->sub,src_dir_len,dst_dir_len,dst_dir);
result+=PutCopyTree(tempde->sub,src_dir_len,dst_dir_len,dst_dir);
} else
if (CopySingle(tempm->full_name,st))
if (CopySingle(tempde->full_name,st))
result++;
Free(st);
tempm=tempm->next;
tempde=tempde->next;
}
return result;
}
@@ -148,7 +147,7 @@ I64 PutCopyTree(CDirEntry *tempm,I64 src_dir_len,I64 dst_dir_len,U8 *dst_dir)
public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask)
{ //returns count of copied files (not dirs)
CFileAccess *fa;
CDirEntry *tempm=NULL;
CDirEntry *tempde=NULL;
I64 result=0,i1,i2;
U8 *st1,*st2;
@@ -163,7 +162,7 @@ public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask)
Free(st1);
Free(st2);
if (fa=FileAccessNew(src_files_find_mask,TRUE)) {
tempm=SysFilesFind(fa->mask,FUF_RECURSE);
tempde=SysFilesFind(fa->mask,FUF_RECURSE);
st1=CurDir;
FileAccessDel(fa);
i1=StrLen(st1);
@@ -172,46 +171,46 @@ public I64 CopyTree(U8 *src_files_find_mask,U8 *dst_files_find_mask)
st2=CurDir;
i2=StrLen(st2);
if (i2==3) i2--;
result=PutCopyTree(tempm,i1,i2,st2);
result=PutCopyTree(tempde,i1,i2,st2);
FileAccessDel(fa);
Free(st2);
}
CDirLstDel(tempm);
DirLstDel(tempde);
Free(st1);
}
return result;
}
I64 DelTreeDirs(CDirEntry *tempm1)
I64 DelTreeDirs(CDirEntry *tempde1)
{
I64 result=0;
CDirEntry *tempm2;
while (tempm1) {
tempm2=tempm1->next;
if (tempm1->attr & _ATTR_DIR) {
if (tempm1->sub)
result+=DelTreeDirs(tempm1->sub);
result+=SysDel(tempm1->full_name,TRUE);
CDirEntry *tempde2;
while (tempde1) {
tempde2=tempde1->next;
if (tempde1->attr & _ATTR_DIR) {
if (tempde1->sub)
result+=DelTreeDirs(tempde1->sub);
result+=SysDel(tempde1->full_name,TRUE);
}
CDirEntryDel(tempm1);
tempm1=tempm2;
DirEntryDel(tempde1);
tempde1=tempde2;
}
return result;
}
I64 DelTreeFiles(CDirEntry *tempm1)
I64 DelTreeFiles(CDirEntry *tempde1)
{
I64 result=0;
CDirEntry *tempm2;
while (tempm1) {
tempm2=tempm1->next;
if (tempm1->attr & _ATTR_DIR) {
if (tempm1->sub)
result+=DelTreeFiles(tempm1->sub);
CDirEntry *tempde2;
while (tempde1) {
tempde2=tempde1->next;
if (tempde1->attr & _ATTR_DIR) {
if (tempde1->sub)
result+=DelTreeFiles(tempde1->sub);
} else
result+=SysDel(tempm1->full_name,FALSE);
CDirEntryDel(tempm1);
tempm1=tempm2;
result+=SysDel(tempde1->full_name,FALSE);
DirEntryDel(tempde1);
tempde1=tempde2;
}
return result;
}
@@ -219,8 +218,8 @@ I64 DelTreeFiles(CDirEntry *tempm1)
public I64 DelTree(U8 *files_find_mask,U8 *fu_flags=NULL)
{
I64 result=0,fuf_flags=0;
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
if (IsDir(files_find_mask)) {
result=DelTreeDirs(FilesFind(files_find_mask,fuf_flags));
result+=SysDel(files_find_mask,TRUE);
@@ -230,7 +229,7 @@ public I64 DelTree(U8 *files_find_mask,U8 *fu_flags=NULL)
return result;
}
U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=0) //Just one file
U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=0)
{
CPrt *p=Drv2Prt(*filename);
CDirEntry de;
@@ -239,39 +238,22 @@ U0 TouchFile(U8 *filename,U8 *attr,CDate cdt=0) //Just one file
if (FileFind(filename,&de,FUF_JUST_FILES)) {
Free(de.full_name);
if (!StrCmp(attr,"+?"))
"%-48ts %s\n",filename,SPrintFFlags(buf,Define("ST_FILE_ATTRS"),de.attr);
"%-48ts %s\n",filename,SPrintFlags(buf,Define("ST_FILE_ATTRS"),de.attr);
else {
StrFirstRem(cur_dir,":");
StrLastRem(cur_dir,"/");
if (!*cur_dir)
StrCpy(cur_dir,"/");
GetFFlags(&de.attr,Define("ST_FILE_ATTRS"),attr);
ScanFlags(&de.attr,Define("ST_FILE_ATTRS"),attr);
if (cdt)
de.datetime=cdt;
else
de.datetime=GetCurTimeDate;
CDirNew(p,cur_dir,&de,FALSE);
de.datetime=GetDateTime;
DirNew(p,cur_dir,&de,FALSE);
}
} else PutDefineErr("ST_FILE_NOT_FOUND");
}
U0 TouchLst(CDirEntry *tempm1,U8 *attr,CDate cdt=0)
{
CDirEntry *tempm2;
while (tempm1) {
tempm2=tempm1->next;
if (tempm1->attr & _ATTR_DIR) {
if (tempm1->sub) {
"%S%s\n","ST_SCANNING_DIR",tempm1->full_name;
TouchLst(tempm1->sub,attr,cdt);
}
} else
TouchFile(tempm1->full_name,attr,cdt);
CDirEntryDel(tempm1);
tempm1=tempm2;
}
}
public U0 Touch(U8 *files_find_mask,U8 *attr="+?",U8 *fu_flags=NULL,CDate cdt=0)
{
//Attr "+?" =show
@@ -279,38 +261,32 @@ public U0 Touch(U8 *files_find_mask,U8 *attr="+?",U8 *fu_flags=NULL,CDate cdt=0)
//To Set Date
// Touch(filename,"",,datetime);
I64 fuf_flags=0;
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
TouchLst(FilesFind(files_find_mask,fuf_flags),attr,cdt);
}
I64 FFLst(CDirEntry *tempm1)
{
I64 cnt=0;
CDirEntry *tempm2;
while (tempm1) {
tempm2=tempm1->next;
if (tempm1->attr & _ATTR_DIR) {
if (tempm1->sub)
cnt+=FFLst(tempm1->sub);
} else {
PutFileLink(tempm1->full_name);
NewLine;
cnt++;
}
CDirEntryDel(tempm1);
tempm1=tempm2;
CDirEntry *tempde,*tempde1;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+f+F");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
while (tempde) {
TouchFile(tempde->full_name,attr,cdt);
tempde=tempde->next;
}
return cnt;
DirLstDel(tempde1);
}
public I64 FF(U8 *files_find_mask,U8 *fu_flags=NULL)
//Files Find
{
I64 cnt=0,fuf_flags=0;
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
cnt+=FFLst(FilesFind(files_find_mask,fuf_flags));
CDirEntry *tempde,*tempde1;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r+f+F");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
tempde=tempde1=FilesFind(files_find_mask,fuf_flags);
while (tempde) {
PutFileLink(tempde->full_name);
NewLine;
cnt++;
tempde=tempde->next;
}
DirLstDel(tempde1);
return cnt;
}
@@ -386,19 +362,19 @@ public I64 UnusedDrvSpace(U8 drv_let=0)
#help_index "File/Program Routines"
I64 TreeSizeFiles(CDirEntry *tempm,I64 round_to)
I64 TreeSizeFiles(CDirEntry *tempde,I64 round_to)
{
I64 result=0,i;
while (tempm) {
while (tempde) {
if (round_to)
i=CeilU64(tempm->size,round_to);
i=CeilU64(tempde->size,round_to);
else
i=tempm->size;
if (tempm->attr&_ATTR_DIR)
i+=TreeSizeFiles(tempm->sub,round_to);
tempm->user_data=i;
i=tempde->size;
if (tempde->attr&_ATTR_DIR)
i+=TreeSizeFiles(tempde->sub,round_to);
tempde->user_data=i;
result+=i;
tempm=tempm->next;
tempde=tempde->next;
}
return result;
}
@@ -408,12 +384,12 @@ public I64 TreeSize(U8 *files_find_mask="/TempleOS/*",U8 *fu_flags=NULL,I64 roun
//Does not include directory size of base directory, but
//does include size of sub directories.
I64 fuf_flags=0,result=0;
CDirEntry *tempm1=NULL;
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
GetFFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
if (tempm1=FilesFind(files_find_mask,fuf_flags)) {
result=TreeSizeFiles(tempm1,round_to);
CDirLstDel(tempm1);
CDirEntry *tempde1=NULL;
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),"+r");
ScanFlags(&fuf_flags,Define("ST_FILE_UTIL_FLAGS"),fu_flags);
if (tempde1=FilesFind(files_find_mask,fuf_flags)) {
result=TreeSizeFiles(tempde1,round_to);
DirLstDel(tempde1);
}
return result;
}
+29 -29
View File
@@ -1,70 +1,70 @@
#help_index "File/Program Routines/Utils"
I64 CDirTreeFlattenSize(CDirEntry *tempm)
I64 DirTreeFlattenSize(CDirEntry *tempde)
{
I64 result=0;
while (tempm) {
while (tempde) {
result+=CDIR_SIZE+1;
if (tempm->attr & _ATTR_DIR)
result+=CDirTreeFlattenSize(tempm->sub);
tempm=tempm->next;
if (tempde->attr & _ATTR_DIR)
result+=DirTreeFlattenSize(tempde->sub);
tempde=tempde->next;
}
return result+1;
}
I64 CDirTreeFlattenFill(CDirEntry *tempm,U8 *dst)
I64 DirTreeFlattenFill(CDirEntry *tempde,U8 *dst)
{
I64 result=0,i;
while (tempm) {
while (tempde) {
*dst++=1;
result++;
i=CDIR_SIZE;
MemCpy(dst,&tempm->start,i);
MemCpy(dst,&tempde->start,i);
dst+=i;
result+=i;
if (tempm->attr & _ATTR_DIR) {
i=CDirTreeFlattenFill(tempm->sub,dst);
if (tempde->attr & _ATTR_DIR) {
i=DirTreeFlattenFill(tempde->sub,dst);
dst+=i;
result+=i;
}
tempm=tempm->next;
tempde=tempde->next;
}
*dst=0;
return result+1;
}
public U8 *CDirTreeFlatten(CDirEntry *tempm,I64 *_size=NULL)
public U8 *DirTreeFlatten(CDirEntry *tempde,I64 *_size=NULL)
{
I64 size=CDirTreeFlattenSize(tempm);
I64 size=DirTreeFlattenSize(tempde);
U8 *buf=MAlloc(size);
CDirTreeFlattenFill(tempm,buf);
DirTreeFlattenFill(tempde,buf);
if (_size) *_size=size;
return buf;
}
U8 *CDirTreeDoUnflatten(U8 *src,CDirEntry **tempm)
U8 *DirTreeDoUnflatten(U8 *src,CDirEntry **tempde)
{
I64 i;
CDirEntry *tempm1;
CDirEntry *tempde1;
if (*src++) {
tempm1=CAlloc(sizeof(CDirEntry));
*tempm=tempm1;
tempde1=CAlloc(sizeof(CDirEntry));
*tempde=tempde1;
i=CDIR_SIZE;
MemCpy(&tempm1->start,src,i);
MemCpy(&tempde1->start,src,i);
src+=i;
if (tempm1->attr & _ATTR_DIR)
src=CDirTreeDoUnflatten(src,&tempm1->sub);
src=CDirTreeDoUnflatten(src,&tempm1->next);
if (tempde1->attr & _ATTR_DIR)
src=DirTreeDoUnflatten(src,&tempde1->sub);
src=DirTreeDoUnflatten(src,&tempde1->next);
} else
*tempm=NULL;
*tempde=NULL;
return src;
}
public CDirEntry *CDirTreeUnflatten(U8 *src)
public CDirEntry *DirTreeUnflatten(U8 *src)
{
CDirEntry *tempm=NULL;
CDirTreeDoUnflatten(src,&tempm);
return tempm;
CDirEntry *tempde=NULL;
DirTreeDoUnflatten(src,&tempde);
return tempde;
}
#help_index "Install;File/Cmd Line (Typically);Cmd Line (Typically)"
@@ -386,7 +386,7 @@ public U0 DskView(U8 drv_let=0)
v>>1+radius*Sin(sect_end));
dc->color=j;
GrPrintF(dc,0,v-FONT_HEIGHT*j,"%C %-8Z",Prt2Drv(p),
GrPrint(dc,0,v-FONT_HEIGHT*j,"%C %-8Z",Prt2Drv(p),
p->type.u16[0],"ST_PRT_TYPES");
GrFloodFill(dc,
h>>1+(radius-4)*Cos((sect_start+sect_end)/2),
@@ -407,6 +407,6 @@ public U0 BlkDevRep()
I64 i;
for (i=0;i<NUM_BLKDEVS;i++)
if (sys_blkdevs[i].bd_signature==BD_SIGNATURE_VAL)
ClassRep("CBlkDev",&sys_blkdevs[i]);
ClassRep(&sys_blkdevs[i]);
}
#help_index ""
+186 -186
View File
@@ -1,24 +1,24 @@
#help_index "Doc/Output"
U0 CDirFileDoc(CDoc *doc,CDirEntry *tempm)
U0 DirFileDoc(CDoc *doc,CDirEntry *tempde)
{
CDocEntry *doc_e;
while (tempm) {
if (tempm->attr & _ATTR_DIR) {
doc_e=DocPrintF(doc,"$$TR,\"%s\"$$",tempm->name);
doc_e->user_data=tempm;
tempm->user_data=doc_e;
DocPutS(doc,"\n$$ID,+2$$");
if (tempm->sub)
CDirFileDoc(doc,tempm->sub);
DocPutS(doc,"$$ID,-2$$");
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;
DocPrint(doc,"\n$$ID,+2$$");
if (tempde->sub)
DirFileDoc(doc,tempde->sub);
DocPrint(doc,"$$ID,-2$$");
} else {
doc_e=DocPrintF(doc,"$$MU-LE,\"%s\"$$",
tempm->name);
doc_e->user_data=tempm;
tempm->user_data=doc_e;
DocPutS(doc,"\n");
doc_e=DocPrint(doc,"$$MU-LE,\"%s\"$$",
tempde->name);
doc_e->user_data=tempde;
tempde->user_data=doc_e;
DocPrint(doc,"\n");
}
tempm=tempm->next;
tempde=tempde->next;
}
}
@@ -34,15 +34,15 @@ CFMUncollapsedLst *FMCollectUncollapsedLst(CDoc *doc)
{
CDocEntry *doc_e=doc->root.next;
CFMUncollapsedLst *result=NULL,*tempc;
CDirEntry *tempm;
CDirEntry *tempde;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_TREE) {
if (!(doc_e->flags1&DOCEF1_CHECKED_COLLAPSED)) {
if (tempm=doc_e->user_data) {
if (tempde=doc_e->user_data) {
tempc=MAlloc(sizeof(CFMUncollapsedLst));
tempc->next=result;
result=tempc;
tempc->name=StrNew(tempm->full_name);
tempc->name=StrNew(tempde->full_name);
}
}
}
@@ -55,42 +55,42 @@ U0 FMMarkUncollapsed(CDoc *doc,CFMUncollapsedLst *tempc,U8 *cur_entry,U8 *next_e
{
CDocEntry *doc_e=doc->root.next;
CFMUncollapsedLst *tempc1;
CDirEntry *tempm;
CDirEntry *tempde;
while (doc_e!=doc) {
if (doc_e->type_u8==DOCT_TREE) {
tempm=doc_e->user_data;
tempde=doc_e->user_data;
tempc1=tempc;
while (tempc1) {
if (!StrCmp(tempc1->name,tempm->full_name)) {
if (!StrCmp(tempc1->name,tempde->full_name)) {
doc_e->flags1&=~DOCEF1_CHECKED_COLLAPSED;
break;
}
tempc1=tempc1->next;
}
if (cur_entry) {
if (!StrNCmp(cur_entry,tempm->full_name,StrLen(tempm->full_name))) {
if (!StrNCmp(cur_entry,tempde->full_name,StrLen(tempde->full_name))) {
doc->cur_entry=doc_e;
if (StrLen(tempm->full_name)==StrLen(cur_entry))
if (StrLen(tempde->full_name)==StrLen(cur_entry))
cur_entry=NULL;
} else if (next_entry) {
if (!StrNCmp(next_entry,tempm->full_name,StrLen(tempm->full_name))) {
if (!StrNCmp(next_entry,tempde->full_name,StrLen(tempde->full_name))) {
doc->cur_entry=doc_e;
if (StrLen(tempm->full_name)==StrLen(next_entry))
if (StrLen(tempde->full_name)==StrLen(next_entry))
cur_entry=NULL;
}
}
}
} else if (doc_e->type_u8==DOCT_MENU_VAL) {
tempm=doc_e->user_data;
tempde=doc_e->user_data;
if (cur_entry) {
if (!StrNCmp(cur_entry,tempm->full_name,StrLen(tempm->full_name))) {
if (!StrNCmp(cur_entry,tempde->full_name,StrLen(tempde->full_name))) {
doc->cur_entry=doc_e;
if (StrLen(tempm->full_name)==StrLen(cur_entry))
if (StrLen(tempde->full_name)==StrLen(cur_entry))
cur_entry=NULL;
} else if (next_entry) {
if (!StrNCmp(next_entry,tempm->full_name,StrLen(tempm->full_name))) {
if (!StrNCmp(next_entry,tempde->full_name,StrLen(tempde->full_name))) {
doc->cur_entry=doc_e;
if (StrLen(tempm->full_name)==StrLen(next_entry))
if (StrLen(tempde->full_name)==StrLen(next_entry))
cur_entry=NULL;
}
}
@@ -114,33 +114,33 @@ U0 FMDelUncollapsedLst(CFMUncollapsedLst *tempc)
CDirEntry *FMRebuildDocDrv(U8 drv_let,CDoc *doc,CDirEntry **_root,Bool init)
{
CDocEntry *doc_e;
CDirEntry *tempm,*tempm1;
CDirEntry *tempde,*tempde1;
U8 *st;
tempm=CAlloc(sizeof(CDirEntry));
tempm->full_name=MSPrintF("%C:/",drv_let);
tempm->attr=_ATTR_DIR;
st=MSPrintF("%c:/*",drv_let);
tempde=CAlloc(sizeof(CDirEntry));
tempde->full_name=MPrint("%C:/",drv_let);
tempde->attr=_ATTR_DIR;
st=MPrint("%c:/*",drv_let);
if (init)
tempm->sub=tempm1=FilesFind(st,FUF_RECURSE);
tempde->sub=tempde1=FilesFind(st,FUF_RECURSE);
else
tempm1=NULL;
tempde1=NULL;
Free(st);
doc_e=DocPrintF(doc,"$$TR,\"%s\"$$",tempm->full_name);
doc_e->user_data=tempm;
tempm->user_data=doc_e;
tempm->next=*_root;
*_root=tempm;
DocPutS(doc,"\n$$ID,+2$$");
doc_e=DocPrint(doc,"$$TR,\"%s\"$$",tempde->full_name);
doc_e->user_data=tempde;
tempde->user_data=doc_e;
tempde->next=*_root;
*_root=tempde;
DocPrint(doc,"\n$$ID,+2$$");
DocBottom(doc);
if (init) {
CDirFileDoc(doc,tempm1);
while (tempm1) {
tempm1->parent=tempm;
tempm1=tempm1->next;
DirFileDoc(doc,tempde1);
while (tempde1) {
tempde1->parent=tempde;
tempde1=tempde1->next;
}
}
DocPutS(doc,"$$ID,-2$$");
return tempm;
DocPrint(doc,"$$ID,-2$$");
return tempde;
}
U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
@@ -151,7 +151,7 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
CFMUncollapsedLst *tempc=NULL;
U8 *cur_entry=NULL,*next_entry=NULL;
CDocEntry *doc_ce;
CDirEntry *tempm,*tempm1,*cur_tree_entry;
CDirEntry *tempde,*tempde1,*cur_tree_entry;
if (!doc)
parent_doc=DocPut;
else {
@@ -166,36 +166,36 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
cur_tree_entry=doc_ce->user_data;
if (cur_tree_entry)
cur_entry=StrNew(cur_tree_entry->full_name);
tempm=NULL;
tempde=NULL;
if (doc_ce!=doc)
doc_ce=doc_ce->next;
while (doc_ce!=doc) {
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
tempm=doc_ce->user_data;
tempde=doc_ce->user_data;
else
tempm=NULL;
if (tempm) {
tempm1=tempm->parent;
while (tempm1) {
if (tempm1==cur_tree_entry) {
tempm=NULL;
tempde=NULL;
if (tempde) {
tempde1=tempde->parent;
while (tempde1) {
if (tempde1==cur_tree_entry) {
tempde=NULL;
break;
} else
tempm1=tempm1->parent;
tempde1=tempde1->parent;
}
if (tempm)
if (tempde)
break;
}
doc_ce=doc_ce->next;
}
if (tempm)
next_entry=StrNew(tempm->full_name);
if (tempde)
next_entry=StrNew(tempde->full_name);
tempc=FMCollectUncollapsedLst(doc);
DocDel(doc);
}
if (*_root) {
CDirLstDel(*_root);
DirLstDel(*_root);
*_root=NULL;
}
doc=DocNew;
@@ -204,30 +204,30 @@ U0 FMRebuildDoc(CDoc **_doc,CDirEntry **_root,I64 mode)
doc->flags|=DOCF_FORM;
switch (mode) {
case FM_NORMAL:
DocPutS(doc,"$$FG,PURPLE$$File Manager\n\n$$LK,\"Click for Help\",\"FI:::/TempleOS/Doc/FileMgr.TXT\"$$\n\n");
DocPrint(doc,"$$FG,PURPLE$$File Manager\n\n$$LK,\"Click for Help\",\"FI:::/TempleOS/Doc/FileMgr.TXT\"$$\n\n");
break;
case FM_PICK_FILE:
DocPutS(doc,"$$FG,PURPLE$$Pick file and press <ESC>\n\n");
DocPrint(doc,"$$FG,PURPLE$$Pick file and press <ESC>\n\n");
doc->flags|=DOCF_MIN_SIZE;
break;
case FM_PICK_DIR:
DocPutS(doc,"$$FG,PURPLE$$Pick directory and press <ESC>\n\n");
DocPrint(doc,"$$FG,PURPLE$$Pick directory and press <ESC>\n\n");
doc->flags|=DOCF_MIN_SIZE;
break;
}
DocPutS(doc,"$$FG,LTBLUE$$");
DocPrint(doc,"$$FG,LTBLUE$$");
for (i=0;i<NUM_PRTS;i++) {
p=&sys_prts[i];
if (p->type==PT_REDSEA||p->type==PT_FAT32)
FMRebuildDocDrv(Prt2Drv(p),doc,_root,TRUE);
else if (p->type==PT_ISO9660) {
if (p->bdev->flags&BDF_INITIALIZED)
tempm=FMRebuildDocDrv(Prt2Drv(p),doc,_root,TRUE);
tempde=FMRebuildDocDrv(Prt2Drv(p),doc,_root,TRUE);
else {
tempm=FMRebuildDocDrv(Prt2Drv(p),doc,_root,FALSE);
tempm->flags|=DEF_NOT_INITIALIZED;
tempde=FMRebuildDocDrv(Prt2Drv(p),doc,_root,FALSE);
tempde->flags|=DEF_NOT_INITIALIZED;
}
tempm->flags|=DEF_REMOVABLE;
tempde->flags|=DEF_REMOVABLE;
}
}
DocHome(doc);
@@ -246,28 +246,28 @@ U0 FMRename(CDoc *doc)
{
CEdFileName fn;
CDocEntry *doc_e=doc->cur_entry;
CDirEntry *tempm=NULL,*parent;
CDirEntry *tempde=NULL,*parent;
if (doc_e->type_u8==DOCT_MENU_VAL) {
tempm=doc_e->user_data;
if (parent=tempm->parent) {
tempde=doc_e->user_data;
if (parent=tempde->parent) {
Cd(parent->full_name);
StrCpy(fn.name,tempm->name);
if (DocFormDo(fn.name,"CEdFileName")) {
StrCpy(fn.name,tempde->name);
if (DocFormDo(&fn)) {
Silent(ON);
Move(tempm->name,fn.name);
Move(tempde->name,fn.name);
Silent(OFF);
}
}
} else if (doc_e->type_u8==DOCT_TREE) {
tempm=doc_e->user_data;
if (parent=tempm->parent) {
tempde=doc_e->user_data;
if (parent=tempde->parent) {
Cd(parent->full_name);
StrCpy(fn.name,tempm->name);
if (DocFormDo(fn.name,"CEdFileName")) {
if (StrCmp(tempm->name,fn.name)) {
StrCpy(fn.name,tempde->name);
if (DocFormDo(&fn)) {
if (StrCmp(tempde->name,fn.name)) {
Silent(ON);
if (CopyTree(tempm->name,fn.name))
DelTree(tempm->name);
if (CopyTree(tempde->name,fn.name))
DelTree(tempde->name);
Silent(OFF);
}
}
@@ -279,22 +279,22 @@ U0 FMMkDir(CDoc *doc)
{
CEdFileName fn;
CDocEntry *doc_e=doc->cur_entry;
CDirEntry *tempm=NULL,*parent;
CDirEntry *tempde=NULL,*parent;
*fn.name=0;
if (doc_e->type_u8==DOCT_MENU_VAL) {
tempm=doc_e->user_data;
if (parent=tempm->parent) {
tempde=doc_e->user_data;
if (parent=tempde->parent) {
Cd(parent->full_name);
if (DocFormDo(fn.name,"CEdFileName")) {
if (DocFormDo(&fn)) {
Silent(ON);
MkDir(fn.name);
Silent(OFF);
}
}
} else if (doc_e->type_u8==DOCT_TREE) {
tempm=doc_e->user_data;
Cd(tempm->full_name);
if (DocFormDo(fn.name,"CEdFileName")) {
tempde=doc_e->user_data;
Cd(tempde->full_name);
if (DocFormDo(&fn)) {
Silent(ON);
MkDir(fn.name);
Silent(OFF);
@@ -306,21 +306,21 @@ U0 FMDelete(CDoc *doc)
{
U8 *st;
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempm;
CDirEntry *tempde;
if (doc_ce->type_u8==DOCT_MENU_VAL) {
tempm=doc_ce->user_data;
tempde=doc_ce->user_data;
Silent(ON);
st=MSPrintF("Delete: %s",tempm->full_name);
st=MPrint("Delete: %s",tempde->full_name);
if (PopUpCancelOk(st))
Del(tempm->full_name);
Del(tempde->full_name);
Free(st);
Silent(OFF);
} else if (doc_ce->type_u8==DOCT_TREE) {
tempm=doc_ce->user_data;
tempde=doc_ce->user_data;
Silent(ON);
st=MSPrintF("Delete: %s",tempm->full_name);
st=MPrint("Delete: %s",tempde->full_name);
if (PopUpCancelOk(st))
DelTree(tempm->full_name);
DelTree(tempde->full_name);
Free(st);
Silent(OFF);
}
@@ -329,16 +329,16 @@ U0 FMDelete(CDoc *doc)
U0 FMMount(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempm;
CDirEntry *tempde;
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
tempm=doc_ce->user_data;
tempde=doc_ce->user_data;
else
tempm=NULL;
if (tempm) {
while (tempm->parent)
tempm=tempm->parent;
tempde=NULL;
if (tempde) {
while (tempde->parent)
tempde=tempde->parent;
Silent(ON);
ChgDsk(*tempm->full_name);
ChgDsk(*tempde->full_name);
Silent(OFF);
}
}
@@ -346,19 +346,19 @@ U0 FMMount(CDoc *doc)
U0 FMFmtDrv(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempm;
CDirEntry *tempde;
U8 *st=NULL;
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
tempm=doc_ce->user_data;
tempde=doc_ce->user_data;
else
tempm=NULL;
if (tempm) {
while (tempm->parent)
tempm=tempm->parent;
st=MSPrintF("Format Drive '%c'?\nAre You Sure?\n",*tempm->full_name);
tempde=NULL;
if (tempde) {
while (tempde->parent)
tempde=tempde->parent;
st=MPrint("Format Drive '%c'?\nAre You Sure?\n",*tempde->full_name);
if (PopUpCancelOk(st)) {
Silent(ON);
Fmt(*tempm->full_name,TRUE,FALSE);
Fmt(*tempde->full_name,TRUE,FALSE);
Silent(OFF);
}
}
@@ -368,21 +368,21 @@ U0 FMFmtDrv(CDoc *doc)
U0 FMMakeISO(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempm;
CDirEntry *tempde;
U8 *st;
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
tempm=doc_ce->user_data;
tempde=doc_ce->user_data;
else
tempm=NULL;
if (tempm) {
tempde=NULL;
if (tempde) {
if (doc_ce->type_u8==DOCT_MENU_VAL)
tempm=tempm->parent;
if (tempm && *tempm->full_name) {
tempde=tempde->parent;
if (tempde && *tempde->full_name) {
Silent(ON);
if (tempm->full_name[StrLen(tempm->full_name)-1]=='/')
st=MSPrintF("%s*",tempm->full_name);
if (tempde->full_name[StrLen(tempde->full_name)-1]=='/')
st=MPrint("%s*",tempde->full_name);
else
st=MSPrintF("%s/*",tempm->full_name);
st=MPrint("%s/*",tempde->full_name);
CDFileCreate(,st);
Free(st);
Silent(OFF);
@@ -393,16 +393,16 @@ U0 FMMakeISO(CDoc *doc)
U0 FMBurnISO(CDoc *doc)
{
CDocEntry *doc_ce=doc->cur_entry;
CDirEntry *tempm;
CDirEntry *tempde;
if (doc_ce->type_u8==DOCT_TREE || doc_ce->type_u8==DOCT_MENU_VAL)
tempm=doc_ce->user_data;
tempde=doc_ce->user_data;
else
tempm=NULL;
if (tempm) {
while (tempm->parent)
tempm=tempm->parent;
tempde=NULL;
if (tempde) {
while (tempde->parent)
tempde=tempde->parent;
Silent(ON);
CDImageWrite(*tempm->full_name);
CDImageWrite(*tempde->full_name);
Silent(OFF);
}
}
@@ -412,37 +412,37 @@ U0 FMCopy(CDoc *doc)
CDoc *doc2=sys_clipboard_doc;
U8 *st;
CDocEntry *doc_ce=doc->cur_entry,*doc_e;
CDirEntry *tempm,*tempm1=NULL,*tempm2;
CDirEntry *tempde,*tempde1=NULL,*tempde2;
Bool unlock_doc2=DocLock(doc2);
doc_e=doc2->root.next;
tempm1=doc_ce->user_data;
tempde1=doc_ce->user_data;
if (doc_ce->type_u8==DOCT_MENU_VAL)
tempm1=tempm1->parent;
tempde1=tempde1->parent;
else if (doc_ce->type_u8!=DOCT_TREE)
tempm1=NULL;
if (tempm1) {
tempde1=NULL;
if (tempde1) {
while (doc_e!=doc2) {
if (doc_e->type_u8==DOCT_MENU_VAL) {
tempm=doc_e->user_data;
tempm->flags|=DEF_PROCESSED;
tempm2=tempm->parent;
if (!tempm2 || !(tempm2->flags&DEF_PROCESSED)) {
tempde=doc_e->user_data;
tempde->flags|=DEF_PROCESSED;
tempde2=tempde->parent;
if (!tempde2 || !(tempde2->flags&DEF_PROCESSED)) {
Silent(ON);
Copy(tempm->full_name,tempm1->full_name);
Copy(tempde->full_name,tempde1->full_name);
Silent(OFF);
}
} else if (doc_e->type_u8==DOCT_TREE) {
tempm=doc_e->user_data;
tempm->flags|=DEF_PROCESSED;
tempm2=tempm->parent;
if (!tempm2 || !(tempm2->flags&DEF_PROCESSED)) {
tempde=doc_e->user_data;
tempde->flags|=DEF_PROCESSED;
tempde2=tempde->parent;
if (!tempde2 || !(tempde2->flags&DEF_PROCESSED)) {
Silent(ON);
if (*tempm1->name)
st=MSPrintF("%s/%s",tempm1->full_name,tempm->name);
if (*tempde1->name)
st=MPrint("%s/%s",tempde1->full_name,tempde->name);
else
st=MSPrintF("%s%s",tempm1->full_name,tempm->name);
CopyTree(tempm->full_name,st);
st=MPrint("%s%s",tempde1->full_name,tempde->name);
CopyTree(tempde->full_name,st);
Free(st);
Silent(OFF);
}
@@ -471,8 +471,8 @@ I64 PopUpCancelPasteDel(U8 *header=NULL,U8 *footer=NULL)
{
I64 i;
CDoc *doc=DocNew;
if (header) DocPutS(doc,header);
DocPutS(doc,"$$CM+LX,1,1 $$$$BT,\"INCLUDE \",FMR_INCLUDE$$"
if (header) DocPrint(doc,"%s",header);
DocPrint(doc,"$$CM+LX,1,1 $$$$BT,\"INCLUDE \",FMR_INCLUDE$$"
"$$CM+LX,27,0$$$$BT,\"ADAM INCLUDE \",FMR_ADAM_INCLUDE$$"
"$$CM+LX,1,3 $$$$BT,\"DELETE \",FMR_DELETE$$"
"$$CM+LX,27,0$$$$BT,\"RENAME \",FMR_RENAME$$"
@@ -485,7 +485,7 @@ I64 PopUpCancelPasteDel(U8 *header=NULL,U8 *footer=NULL)
"$$CM+LX,27,0$$$$BT,\"BURN ISO (CD-ROM) FILE\",FMR_BURN_ISO$$"
"$$CM+LX,1,3 $$$$BT,\"HELP \",FMR_HELP$$"
"$$CM+LX,27,0$$$$BT,\"CANCEL \",DOCM_CANCEL$$\n");
if (footer) DocPutS(doc,footer);
if (footer) DocPrint(doc,"%s",footer);
i=PopUpMenu(doc);
DocDel(doc);
return i;
@@ -541,14 +541,14 @@ U0 FMFinalScreenUpdate(CDC *dc)
{
if (fm_ip_str) {
dc->color=LTRED;
GrPutS(dc,ipx,ipy,fm_ip_str);
GrPrint(dc,ipx,ipy,"%s",fm_ip_str);
}
(*fp_old_final_screen_update)(dc);
}
public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
{
CDirEntry *root=NULL,*tempm,*tempm1,*tempm2;
CDirEntry *root=NULL,*tempde,*tempde1,*tempde2;
I64 sc,ch,p1,p2,msg_code;
CDoc *doc=NULL,*old_put_doc=DocPut,*old_display_doc=DocDisplay;
U8 *result=NULL,*st,*st2,*old_cur_dir=CurDir;
@@ -559,12 +559,12 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
fp_old_final_screen_update=fp_final_screen_update;
MenuFilePush("::/TempleOS/Doc/FileMgrPullDown.TXT");
FMRebuildDoc(&doc,&root,mode);
if (tempm1=Cd2DirEntry(root,old_cur_dir))
doc->cur_entry=tempm1->user_data;
while (tempm1) {
if (tempm1->attr&_ATTR_DIR)
tempm1->user_data(CDocEntry *)->flags1&=~DOCEF1_CHECKED_COLLAPSED;
tempm1=tempm1->parent;
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;
tempde1=tempde1->parent;
}
do {
DocUnlock(doc);
@@ -592,40 +592,40 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
if (doc_e!=doc_ce) {
st2=NULL;
if (doc_e->type_u8==DOCT_MENU_VAL) {
tempm1=doc_e->user_data;
if (tempm1=tempm1->parent)
st2=StrNew(tempm1->full_name);
tempde1=doc_e->user_data;
if (tempde1=tempde1->parent)
st2=StrNew(tempde1->full_name);
} else if (doc_e->type_u8==DOCT_TREE) {
tempm1=doc_e->user_data;
st2=StrNew(tempm1->full_name);
tempde1=doc_e->user_data;
st2=StrNew(tempde1->full_name);
}
if (st2 && doc_ce->type_u8==DOCT_MENU_VAL) {
tempm=doc_ce->user_data;
tempde=doc_ce->user_data;
Silent(ON);
Move(tempm->full_name,st2);
Move(tempde->full_name,st2);
Silent(OFF);
FMRebuildDoc(&doc,&root,mode);
} else if (st2 && doc_ce->type_u8==DOCT_TREE) {
tempm=doc_ce->user_data;
tempde=doc_ce->user_data;
okay=TRUE;
tempm2=tempm1;
while (tempm2) {
if (tempm2!=tempm)
tempm2=tempm2->parent;
tempde2=tempde1;
while (tempde2) {
if (tempde2!=tempde)
tempde2=tempde2->parent;
else {
okay=FALSE;
break;
}
}
if (okay) {
if (*tempm1->name)
st=MSPrintF("%s/%s",tempm1->full_name,tempm->name);
if (*tempde1->name)
st=MPrint("%s/%s",tempde1->full_name,tempde->name);
else
st=MSPrintF("%s%s",tempm1->full_name,tempm->name);
if (StrCmp(tempm->full_name,st)) {
st=MPrint("%s%s",tempde1->full_name,tempde->name);
if (StrCmp(tempde->full_name,st)) {
Silent(ON);
CopyTree(tempm->full_name,st);
DelTree(tempm->full_name);
CopyTree(tempde->full_name,st);
DelTree(tempde->full_name);
Silent(OFF);
FMRebuildDoc(&doc,&root,mode);
}
@@ -715,14 +715,14 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
break;
case CH_ESC:
doc_ce=doc->cur_entry;
tempm=doc_ce->user_data;
tempde=doc_ce->user_data;
if (mode==FM_PICK_FILE && doc_ce->type_u8==DOCT_MENU_VAL)
result=StrNew(tempm->full_name,mem_task);
result=StrNew(tempde->full_name,mem_task);
else if (mode==FM_PICK_DIR) {
if (doc_ce->type_u8==DOCT_TREE)
result=StrNew(tempm->full_name,mem_task);
else if (doc_ce->type_u8==DOCT_MENU_VAL && (tempm=tempm->parent))
result=StrNew(tempm->full_name,mem_task);
result=StrNew(tempde->full_name,mem_task);
else if (doc_ce->type_u8==DOCT_MENU_VAL && (tempde=tempde->parent))
result=StrNew(tempde->full_name,mem_task);
}
break;
default:
@@ -731,12 +731,12 @@ public U8 *FileMgr(I64 mode=FM_NORMAL,CTask *mem_task=NULL)
FMRebuildDoc(&doc,&root,mode);
} else if (sc.u8[0]==SC_F5) {
if (doc->cur_entry->type_u8==DOCT_MENU_VAL) {
tempm=doc->cur_entry->user_data;
tempde=doc->cur_entry->user_data;
DocUnlock(doc);
if (sc&SCF_SHIFT)
AdamFile(tempm->full_name);
AdamFile(tempde->full_name);
else
PopUpFile(tempm->full_name);
PopUpFile(tempde->full_name);
DocLock(doc);
}
} else {
@@ -754,7 +754,7 @@ regular_key:
Fs->display_doc=old_display_doc;
SettingsPop;
DocDel(doc);
CDirLstDel(root);
DirLstDel(root);
Cd(old_cur_dir);
Free(old_cur_dir);
if (mode!=FM_NORMAL && !result)