4 Original GPL release version 4.12
5 Copyright 1993-2000 Jonathan Potter
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 All users of Directory Opus 4 (including versions distributed
22 under the GPL) are entitled to upgrade to the latest version of
23 Directory Opus version 5 at a reduced price. Please see
24 http://www.gpsoft.com.au for more information.
26 The release of Directory Opus 4 under the GPL in NO WAY affects
27 the existing commercial status of Directory Opus 5.
33 #include <proto/inovamusic.h>
39 int dofilefunction(function
,flags
,sourcedir
,destdir
,act
,inact
,rexx
)
41 char *sourcedir
,*destdir
;
44 struct InfoData __aligned infodata
;
45 struct FileInfoBlock __aligned fileinfo
;
46 int a
,b
,special
=0,candoicon
=1,old
,specflags
,noshow
=0,err
;
47 int sourcewild
=0,destwild
=0,firstset
=0,breakout
,rexarg
,protstuff
[2];
48 int pt
=1,okayflag
,show
,lastfile
,flag
,exist
,count
,data
,mask
=0,temp
;
49 int globflag
,noremove
,doicons
=0,total
,value
=0,progtype
,blocksize
,retval
=0;
53 struct Directory
*file
= NULL
,*tempfile
,*nextfile
,filebuf
,dummyfile
;
54 char *sourcename
,*destname
,*oldiconname
,*newiconname
;
55 char *buf
,*buf1
,*buf2
,*namebuf
,*srename
,*drename
,*ptr
,*database
;
56 static char tbuf
[256],titlebuf
[32];
57 struct DOpusDateTime datetime
;
58 struct DOpusRemember
*funckey
;
59 struct dopusfiletype
*type
;
60 struct dopusfuncpar par
;
61 struct DirectoryWindow
*swindow
,*dwindow
;
62 struct DOpusArgsList arglist
;
63 struct ViewData
*viewdata
=NULL
;
65 static int entry_depth
;
66 char progress_copy
=0,prog_indicator
=0;
69 if (act
>-1) swindow
=dopus_curwin
[act
];
71 if (inact
>-1) dwindow
=dopus_curwin
[inact
];
74 if (destdir
&& (dwindow
->flags
& DWF_ARCHIVE
))
76 dostatustext(globstring
[STR_OPERATION_NOT_SUPPORTED
]); //HUX
77 return 0; // XAD archive can't be modified
80 data
=rexarg
=0; funckey
=NULL
;
81 specflags
=flags
&~255; flags
&=255;
83 if (config
->iconflags
&ICONFLAG_DOUNTOICONS
|| func_external_file
[0]) doicons
=1;
88 if (!MUSICBase
) return(0);
91 if (MUSICBase
) FlushModule();
96 /* Find the first file to work upon; if only one file specified,
99 if (status_flags
&STATUS_GLOBALFILE
) /* kludge */
100 flags
=FUNCFLAGS_FILES
;
104 if (func_single_entry
) {
105 file
=func_single_entry
;
106 //D(bug("func_single_entry\n"));
111 if (flags
&FUNCFLAGS_DIRS
) {
112 //D(bug("first dir\n"));
113 file
=checkdirtot(swindow
); /* First dir */
114 total
=swindow
->dirsel
;
117 if (flags
&FUNCFLAGS_DEVS
&& !file
) {
118 //D(bug("first dev\n"));
119 file
=checkdevtot(swindow
); /* or dev */
120 total
=swindow
->dirsel
;
123 if (flags
&FUNCFLAGS_FILES
) {
124 //D(bug("first file\n"));
125 file
=checktot(swindow
); /* First file */
126 total
=swindow
->filesel
;
129 if (flags
==0 || flags
&FUNCFLAGS_ANYTHING
) {
130 //D(bug("first entry\n"));
131 file
=checkalltot(swindow
);
132 total
=swindow
->filesel
+swindow
->dirsel
; /* Anything */
135 if (!file
&& flags
&FUNCFLAGS_ANYTHING
) {
136 //D(bug("first dev2\n"));
137 file
=checkdevtot(swindow
);
138 total
=swindow
->dirsel
;
142 /* Name may be in ARexx */
144 if (rexx
&& (tempfile
=findfile(swindow
,rexx_args
[0],NULL
))) {
145 //D(bug("from rexx\n"));
148 func_single_entry
=file
;
149 strcpy(func_single_file
,file
->name
);
153 D(bug("dofilefunction(%ld,%lx,%s,%s,%ld,%ld,%ld)\n",function
,flags
,sourcedir
?sourcedir
:"<NULL>",destdir
?destdir
:"<NULL>",act
,inact
,rexx
));
154 D(bug("\tfunc_single_entry: %lx\n",func_single_entry
));
155 D(bug("\tfile: %lx\n",file
));
157 if (!file
) return(0); /* No files selected, return */
159 if (!(database
=LAllocRemember(&funckey
,3000,MEMF_CLEAR
))) return(0);
160 sourcename
=database
; destname
=database
+300;
161 oldiconname
=database
+600; newiconname
=database
+900;
162 buf
=database
+1200; buf1
=database
+1500; buf2
=database
+1800;
163 namebuf
=database
+2100; srename
=database
+2400; drename
=database
+2700;
165 if (swindow
) scrdata_old_offset_store
=swindow
->offset
; /* Store directory offset for auto-scroll */
166 else scrdata_old_offset_store
=-1;
168 status_justabort
=count
=0; namebuf
[0]=0;
171 /* Bump entry depth to check for recursion */
175 /* Do initial setting up functions */
183 !(viewdata
=LAllocRemember(&funckey
,sizeof(struct ViewData
),MEMF_CLEAR
)))
193 if (config
->deleteflags
&DELETE_ASK
&& !globflag
) {
194 /* Ask for confirmation before commencing delete */
195 displaydirgiven(act
,file
,0);
196 if (!(a
=simplerequest(globstring
[STR_REALLY_DELETE
],
197 globstring
[STR_DELETE
],str_cancelstring
,globstring
[STR_ALL
],NULL
))) {
204 glob_unprotect_all
=0;
208 if (rexx_argcount
<2) goto endfunction
;
209 strcpy(srename
,rexx_args
[0]);
210 strcpy(drename
,rexx_args
[1]);
211 if (strchr(srename
,'*')) sourcewild
=1;
212 if (strchr(drename
,'*')) destwild
=1;
214 strcpy(namebuf
,drename
);
219 if (file
->selected
) {
220 strcpy(srename
,file
->name
); strcpy(drename
,file
->name
);
221 displaydirgiven(act
,file
,0);
222 if (!(a
=getrenamedata(srename
,drename
)) ||
223 !srename
[0] || !drename
[0]) {
229 if (strchr(srename
,'*')) sourcewild
=1;
230 if (strchr(drename
,'*')) destwild
=1;
232 strcpy(namebuf
,drename
);
249 if (destdir
[0] && (checksame(sourcedir
,destdir
,1)==LOCK_SAME
)) goto endfunction
;
251 if (!(checkdest(inact
))) goto endfunction
;
252 if (!(config
->existflags
&REPLACE_ALWAYS
)) askeach
=1;
254 if (checksame(sourcedir
,destdir
,2)!=LOCK_SAME_VOLUME
) progress_copy
=1;
257 if (destdir
[0] && (checksame(sourcedir
,destdir
,1)==LOCK_SAME
)) goto endfunction
;
260 if (!(checkdest(inact
))) goto endfunction
;
261 askeach
= (config
->existflags
&REPLACE_ALWAYS
) ? 0 : 1;
263 if (!(specflags
&FUNCFLAGS_COPYISCLONE
) && config
->copyflags
©_CHECK
) {
264 old
=scrdata_old_offset_store
;
269 if (tempfile
->selected
&& tempfile
->type
>=ENTRY_DIRECTORY
&&
270 tempfile
->size
==-1) {
274 tempfile
=tempfile
->next
;
276 if (!a
|| simplerequest(globstring
[STR_SIZES_NOT_KNOWN
],
277 globstring
[STR_YES
],globstring
[STR_NO
],NULL
)) {
278 if (status_justabort
||
279 (!(dofilefunction(FUNC_BYTE
,FUNCFLAGS_BYTEISCHECKFIT
,
280 sourcedir
,destdir
,act
,inact
,0)) &&
281 !(simplerequest(globstring
[STR_ENTRIES_MAY_NOT_FIT
],
282 globstring
[STR_CONTINUE
],str_cancelstring
,NULL
)))) {
286 D(bug("main22.c: dos_global_files = %ld\n",dos_global_files
));
287 total
+= dos_global_files
;
290 scrdata_old_offset_store
=old
;
294 if (rexx
&& rexx_argcount
>0) strcpy(str_hunt_name
,rexx_args
[rexarg
]);
295 else if (!(whatsit(globstring
[STR_ENTER_HUNT_PATTERN
],80,str_hunt_name
,NULL
)) ||
300 LParsePatternI(str_hunt_name
,str_hunt_name_parsed
);
301 CopyMem(str_hunt_name_parsed
,buf2
,170);
306 StrCombine(sourcename
,sourcedir
,file
->name
,256);
307 arglist
.single_file
=sourcename
;
308 arglist
.file_list
=NULL
;
309 arglist
.last_select
=NULL
;
312 arglist
.single_file
=NULL
;
313 arglist
.file_window
=act
;
314 arglist
.file_list
=(APTR
)file
;
316 dopus_print(rexx
,&arglist
,0,str_arexx_portname
,NULL
);
326 if (!(checkdest(inact
)) || (checksame(sourcedir
,destdir
,1)==LOCK_SAME
))
328 if (!(config
->existflags
&REPLACE_ALWAYS
)) askeach
=1;
330 if (rexx
&& rexx_argcount
>0) strcpy(buf2
,rexx_args
[rexarg
]);
331 else if (!(whatsit(globstring
[STR_ENTER_PASSWORD
],20,buf2
,NULL
)) ||
338 strcpy(buf2
,&buf2
[1]);
345 if (rexx
&& rexx_argcount
>0) strcpy(str_search_string
,rexx_args
[rexarg
]);
347 if (!(get_search_data(str_search_string
,&search_flags
,Window
,scr_font
[FONT_REQUEST
]))) {
351 // if (Window) ActivateWindow(Window);
372 dostatustext(globstring
[STR_INTERROGATING_FILES
]);
380 main_proc
->pr_WindowPtr
=(APTR
)-1;
381 if (destdir
&& (filelock
=Lock(destdir
,ACCESS_READ
))) {
382 Info(filelock
,&infodata
);
384 blocksize
=infodata
.id_BytesPerBlock
;
387 //D(bug("infodata: %lx\tdestdir: %s\tblocksize: %ld\n",&infodata,destdir,blocksize));
388 if (config
->errorflags
&ERROR_ENABLE_DOS
) main_proc
->pr_WindowPtr
=(APTR
)Window
;
390 dos_global_files
= 0;
394 if (!(config
->dynamicflags
&UPDATE_PROGRESSIND_COPY
)) progress_copy
=0;
398 if (config
->dynamicflags
&UPDATE_PROGRESSINDICATOR
&&
399 (progress_copy
|| total
>1)) {
404 if (!commandlist
[x
].name
) break;
405 if (commandlist
[x
].function
==function
&&
406 !(commandlist
[x
].flags
&RCL_SYNONYM
)) {
407 title
=commandlist
[x
].name
;
418 StrCombine(titlebuf
,title
,": ",32);
419 StrConcat(titlebuf
,(function
==FUNC_SEARCH
)?str_search_string
:str_hunt_name
,32);
422 StrCombine(titlebuf
,title
,"...",32);
425 else strcpy(titlebuf
,"Directory Opus");
427 D(bug("main22.c: total = %ld, dos_global_files = %ld\n",total
, dos_global_files
));
428 /*if (total>1)*/ dotaskmsg(hotkeymsg_port
,PROGRESS_OPEN
,(total
>1)?value
:1,(total
>1)?total
:1,titlebuf
,progress_copy
|((swindow
->dirsel
&&(!dos_global_files
))?0x80:0x00));
429 // else dotaskmsg(hotkeymsg_port,PROGRESS_OPEN,1,1,titlebuf,progress_copy);
434 if (status_haveaborted
) {
440 if ((!file
->selected
&& !globflag
) ||
441 ((file
->type
<= ENTRY_FILE
) && str_filter_parsed
[0] && (LMatchPatternI(str_filter_parsed
,file
->name
)==FALSE
)))
447 if (doicons
&& candoicon
&& !(isicon(file
->name
))) {
448 StrCombine(oldiconname
,file
->name
,".info",256);
449 StrCombine(buf1
,sourcedir
,oldiconname
,256);
450 if (!(CheckExist(buf1
,NULL
))) oldiconname
[0]=0;
452 else oldiconname
[0]=0;
454 if (prog_indicator
) {
455 if ((progtype
==1 && file
->type
>=ENTRY_DEVICE
) ||
456 (progtype
==0 && file
->type
<=ENTRY_FILE
) ||
457 (progtype
==2)) ++value
;
458 D(bug("main22.c: value = %ld\n",value
));
459 // if (total) dotaskmsg(hotkeymsg_port,PROGRESS_INCREASE,1,0,NULL,0);
460 /*if (total>1)*/ dotaskmsg(hotkeymsg_port
,PROGRESS_UPDATE
,value
,total
,NULL
,0);
461 // else dotaskmsg(hotkeymsg_port,PROGRESS_UPDATE,1,1,NULL,0);
462 if (progress_copy
) dotaskmsg(hotkeymsg_port
,PROGRESS_UPDATE
,-2,0,file
->name
,1);
465 lastfile
=flag
=breakout
=0;
469 StrCombine(sourcename
,sourcedir
,file
->name
,256);
470 if (!special
|| count
==0 ||
471 (special
==2 && file
->type
>=0)) {
472 dofilename(sourcename
);
473 displaydirgiven(act
,file
,0);
475 if (!firstset
&& !lastfile
&& !namebuf
[0]) strcpy(namebuf
,file
->name
);
476 else if (lastfile
) strcpy(namebuf
,BaseName(newiconname
));
477 okayflag
=a
=0; show
=-1;
479 if (func_external_file
[0] || file
==&dummyfile
) noremove
=1;
487 if (function
==FUNC_AUTO
) a
=FTFUNC_AUTOFUNC1
;
488 else if (function
==FUNC_AUTO2
) a
=FTFUNC_AUTOFUNC2
;
489 else if (function
==FUNC_AUTO3
) a
=FTFUNC_AUTOFUNC3
;
490 else if (function
==FUNC_AUTO4
) a
=FTFUNC_AUTOFUNC4
;
492 if (file
->type
<=ENTRY_FILE
) {
493 if ((type
=checkfiletype(sourcename
,a
,0))) {
496 par
.which
=type
->which
[a
]; par
.stack
=type
->stack
[a
];
498 par
.pri
=type
->pri
[a
]; par
.delay
=type
->delay
[a
];
499 status_previousabort
=0;
500 if (status_iconified
&& status_flags
&STATUS_ISINBUTTONS
)
501 strcpy(func_external_file
,sourcename
);
502 if (type
->actionstring
[a
][0]) {
503 do_title_string(type
->actionstring
[a
],title
,0,file
->name
);
507 dofunctionstring(type
->function
[a
],file
->name
,title
,&par
);
508 if (status_previousabort
) status_haveaborted
=1;
511 lsprintf(buf
,globstring
[STR_NOT_IDENTIFIED
],file
->name
);
518 if (file
->type
>=ENTRY_DIRECTORY
&&
519 (file
->size
<0 || (specflags
&FUNCFLAGS_BYTEISCHECKFIT
&&
520 (file
->userdata
==0 || file
->userdata2
!=blocksize
)))) {
521 bb
= dos_global_files
;
522 if ((a
=recursedir(sourcename
,NULL
,R_GETBYTES
,blocksize
))==-10) {
526 dos_global_files
+= bb
;
527 file
->userdata
=dos_global_blocksneeded
;
528 file
->userdata2
=blocksize
;
529 setdirsize(file
,dos_global_bytecount
,act
);
530 refreshwindow(act
,0);
531 D({char p
[256]; unsigned long long s
=0; ULONG f
=0; strcpy(p
,sourcename
); getdircontentsinfo(p
,&s
,&f
); sprintf(p
,"size: %qd, files: %ld\n",s
,f
); bug("%s",p
);})
533 if (file
->type
>=ENTRY_DIRECTORY
) data
+=file
->userdata
+1;
535 a
=(file
->size
+(blocksize
-1))/blocksize
;
537 //D(bug("size: %ld\tdata: %ld\n",file->size,data));
539 if (doicons
&& !(isicon(file
->name
))) {
540 StrCombine(oldiconname
,file
->name
,".info",256);
542 if ((file
=findfile(swindow
,oldiconname
,NULL
))) {
543 if (!file
->selected
) bb
=file
->size
;
546 StrCombine(tbuf
,sourcedir
,oldiconname
,256);
547 if (lockandexamine(tbuf
,&fileinfo
)) bb
=fileinfo
.fib_Size
;
550 a
=(bb
+(blocksize
-1))/blocksize
;
560 if (file
->type
<=ENTRY_FILE
) {
561 if (checkexec(sourcename
)) {
562 if ((a
=dorun(sourcename
,1,0))==-1) break;
563 else if (a
&& a
!=-2) okayflag
=1;
565 else if (file
->protection
&FIBF_SCRIPT
) {
566 struct dopusfuncpar par
;
568 lsprintf(buf
,"Execute \"%s\"",sourcename
);
570 dofunctionstring(buf
,NULL
,NULL
,&par
);
577 if (file
->type
>=ENTRY_DIRECTORY
) {
578 if ((a
=delfile(sourcename
,file
->name
,globstring
[STR_DELETING
],
579 glob_unprotect_all
,0))==-1) {
584 if (a
==2) glob_unprotect_all
=1;
585 if (!noremove
) removefile(file
,swindow
,act
,1); file
=NULL
;
589 if (DeleteFile(sourcename)) {
590 if (!noremove) removefile(file,swindow,act,1); file=NULL;
595 if ((a
=IoErr())==ERROR_DELETE_PROTECTED
&&
596 config
->deleteflags
&DELETE_SET
) {
599 SetProtection(sourcename
,0);
603 else if (a
==ERROR_OBJECT_NOT_FOUND
) {
604 if (!noremove
) removefile(file
,swindow
,act
,1);
608 else if (a
==ERROR_DIRECTORY_NOT_EMPTY
) {
609 if (config
->deleteflags
&DELETE_DIRS
&& askeach
) {
610 lsprintf(buf2
,globstring
[STR_NOT_EMPTY
],file
->name
);
611 if (!(a
=simplerequest(buf2
,globstring
[STR_DELETE
],
612 globstring
[STR_LEAVE
],globstring
[STR_ALL
],globstring
[STR_ABORT
],NULL
))) {
622 TackOn(sourcename
,NULL
,256);
623 a
=recursedir(sourcename
,NULL
,R_DELETE
,0);
624 sourcename
[strlen(sourcename
)-1]=0;
626 if ((a
=delfile(sourcename
,file
->name
,globstring
[STR_DELETING
],
627 glob_unprotect_all
,1))==-1) {
631 else if (a
==1 || a
==2) {
632 if (a
==2) glob_unprotect_all
=1;
633 if (!noremove
) removefile(file
,swindow
,act
,1); file
=NULL
;
637 setdirsize(file
,dos_global_bytecount
-dos_global_deletedbytes
,act
);
642 setdirsize(file
,file
->size
-dos_global_deletedbytes
,act
);
643 refreshwindow(act
,0);
647 doerror((a
=IoErr()));
648 if ((a
=checkerror(globstring
[STR_DELETING
],file
->name
,a
))==3) {
652 if (a
==1) goto functionloop
;
658 if (file
->type
== ENTRY_DEVICE
)
660 if ((!strcmp(file
->comment
,"<DEV>")) || (!strcmp(file
->comment
,"<VOL>"))) break;
662 if (config
->deleteflags
&DELETE_FILES
&& askeach
&& !lastfile
) {
663 lsprintf(buf2
,file
->type
==ENTRY_DEVICE
?globstring
[STR_QUERY_REMOVE_ASSIGN
]:globstring
[STR_WISH_TO_DELETE
],file
->name
); // HUX
664 a
=simplerequest(buf2
,globstring
[file
->type
==ENTRY_DEVICE
?STR_REMOVE
:STR_DELETE
],globstring
[STR_ABORT
],
665 globstring
[STR_ALL
],globstring
[STR_LEAVE
],NULL
);
670 else if (a
==2) askeach
=0;
676 if (file
->type
== ENTRY_DEVICE
) /* remove assign */
678 char buf
[FILEBUF_SIZE
],*c
;
680 strcpy(buf
,file
->name
);
683 a
= AssignLock(buf
,NULL
)?1:0;
684 //D(bug("Removing assign %s\t%s\n",buf,a?"success":"failure"));
686 else if ((a
=delfile(sourcename
,file
->name
,globstring
[STR_DELETING
],
687 glob_unprotect_all
,1))==-1) {
692 if (a
==2) glob_unprotect_all
=1;
693 if (!noremove
) removefile(file
,swindow
,act
,1); file
=NULL
;
700 if (firstset
|| lastfile
) a
=1;
701 else if (!destwild
) {
702 if (!(a
=whatsit(globstring
[STR_ENTER_NEW_NAME
],FILEBUF_SIZE
-2,namebuf
,
703 globstring
[STR_SKIP
]))) {
714 else if (!sourcewild
) a
=getwildrename("*",drename
,file
->name
,namebuf
);
715 else if (sourcewild
) a
=getwildrename(srename
,drename
,file
->name
,namebuf
);
718 if (lastfile
) StrCombine(destname
,sourcedir
,newiconname
,256);
720 /* if (doicons && oldiconname[0]) namebuf[FILEBUF_SIZE-7]=0;
721 else namebuf[FILEBUF_SIZE-2]=0; */ namebuf
[FILEBUF_SIZE
-1]=0;
722 StrCombine(destname
,sourcedir
,namebuf
,256);
723 StrCombine(newiconname
,namebuf
,".info",256);
726 D(bug("Rename(%s,%s)\n",sourcename
,destname
));
727 if (!(Rename(sourcename
,destname
))) {
728 if ((a
=IoErr())==ERROR_OBJECT_EXISTS
) {
731 if ((a
=checkexistreplace(sourcename
,destname
,&file
->date
,destwild
,1))==REPLACE_ABORT
)
736 if (a
==REPLACE_ALL
) {
737 if (!destwild
) goto functionloop
; // TRY AGAIN
738 askeach
=0; // REPLACE ALL
740 else if (a
==REPLACE_SKIP
) {
743 else if (a
==REPLACE_SKIPALL
) {
747 else if (a
==REPLACE_RENAME
) goto retry_rename
;
751 if ((a
=delfile(destname
,namebuf
,globstring
[STR_DELETING
],1,1))==-2) {
752 if (!(a
=recursedir(destname
,NULL
,R_DELETE
,0))) a
=1;
753 else if (a
==-10) a
=-1;
760 if ((tempfile
=findfile(swindow
,namebuf
,NULL
))) {
761 if (tempfile
==nextfile
) nextfile
=tempfile
->next
;
762 removefile(tempfile
,swindow
,act
,1);
769 if ((a
=checkerror(globstring
[STR_RENAMING
],file
->name
,a
))==3) {
773 if (a
==1) goto functionloop
;
776 if (file
->type
>=ENTRY_DIRECTORY
) {
777 StrCombine(buf
,sourcedir
,file
->name
,256); TackOn(buf
,NULL
,256);
778 StrCombine(buf1
,sourcedir
,namebuf
,256); TackOn(buf1
,NULL
,256);
779 renamebuffers(buf
,buf1
);
782 if (act
>-1 && config
->sortmethod
[act
]==DISPLAY_NAME
) {
783 CopyMem((char *)file
,(char *)&filebuf
,sizeof(struct Directory
));
784 if (file
->comment
) strcpy(buf2
,file
->comment
);
786 removefile(file
,swindow
,act
,0); file
=NULL
;
787 addfile(swindow
,act
,namebuf
,filebuf
.size
,filebuf
.type
,&filebuf
.date
,
788 buf2
,filebuf
.protection
,filebuf
.subtype
,1,NULL
,NULL
,
789 filebuf
.owner_id
,filebuf
.group_id
);
791 else strcpy(file
->name
,namebuf
);
792 if (lastfile
) refreshwindow(act
,0);
801 if (!lastfile
&& !flag
) {
802 if (rexx
&& rexx_argcount
>1) strcpy(namebuf
,rexx_args
[1]);
804 if (!(a
=whatsit(globstring
[STR_ENTER_NEW_NAME_MOVE
],FILEBUF_SIZE
-2,
805 namebuf
,globstring
[STR_SKIP
]))) {
816 /* if (doicons && oldiconname[0]) namebuf[FILEBUF_SIZE-7]=0;
817 else namebuf[FILEBUF_SIZE-2]=0; */ namebuf
[FILEBUF_SIZE
-1]=0;
820 if (lastfile
) strcpy(destname
,newiconname
);
822 StrCombine(destname
,destdir
,namebuf
,256);
823 StrCombine(newiconname
,destname
,".info",256);
825 if (checksame(destdir
,sourcename
,0)==LOCK_SAME
) break;
827 if ((exist
=CheckExist(destname
,NULL
))) {
829 if ((a
=checkexistreplace(sourcename
,destname
,&file
->date
,(function
==FUNC_MOVE
),1))==REPLACE_ABORT
) {
833 if (a
==REPLACE_SKIP
) break;
834 if (a
==REPLACE_ALL
) {
835 if (function
==FUNC_MOVEAS
) goto functionloop
; // TRY AGAIN
838 if (a
==REPLACE_SKIPALL
) {
842 else if (a
==REPLACE_RENAME
) {
843 StrCombine(newiconname
,destname
,".info",256);
848 if ((a
=delfile(destname
,namebuf
,globstring
[STR_MOVING
],1,1))==-1) {
853 doerror(ERROR_OBJECT_EXISTS
);
856 if (a
&& (tempfile
=findfile(dwindow
,namebuf
,NULL
)))
857 removefile(tempfile
,dwindow
,inact
,0);
859 if (!(Rename(sourcename
,destname
))) {
860 if ((exist
<0 || file
->type
<=ENTRY_FILE
) &&
861 (a
=IoErr())!=ERROR_RENAME_ACROSS_DEVICES
) {
863 if ((a
=checkerror(globstring
[STR_MOVING
],file
->name
,a
))==3) {
867 if (a
==1) goto functionloop
;
870 if (file
->type
>=ENTRY_DIRECTORY
) {
871 a
=recursedir(sourcename
,destname
,R_COPY
|R_DELETE
,0);
872 D(bug("recursedir returned %ld\n",a
));
874 if (!func_external_file
[0])
875 setdirsize(file
,dos_global_bytecount
-dos_global_deletedbytes
,act
);
877 else if (status_justabort
|| a
<0) {
879 if ((a
=checkerror(globstring
[STR_MOVING
],file
->name
,IoErr()))==3)
881 else if (a
==1) goto functionloop
;
883 if (!func_external_file
[0]) {
884 setdirsize(file
,file
->size
-dos_global_deletedbytes
,act
);
885 refreshwindow(act
,0);
887 if (CheckExist(destname
,NULL
)) {
889 if ((tempfile
=findfile(dwindow
,namebuf
,NULL
)))
890 removefile(tempfile
,dwindow
,inact
,0);
892 addfile(dwindow
,inact
,namebuf
,dos_global_copiedbytes
,
893 file
->type
,&file
->date
,file
->comment
,
894 file
->protection
,file
->subtype
,1,NULL
,NULL
,
895 file
->owner_id
,file
->group_id
);
897 if (a
==-10) myabort();
898 else status_justabort
=0;
901 if (!(tempfile
=findfile(dwindow
,namebuf
,NULL
))) {
902 addfile(dwindow
,inact
,namebuf
,exist
?-1:dos_global_copiedbytes
,file
->type
,
903 &file
->date
,file
->comment
,file
->protection
,
904 file
->subtype
,1,NULL
,NULL
,file
->owner_id
,file
->group_id
);
907 setdirsize(tempfile
,exist
?-1:dos_global_copiedbytes
,act
);
908 refreshwindow(inact
,0);
910 if ((a
=delfile(sourcename
,file
->name
,globstring
[STR_DELETING
],1,1))==-1) {
915 if (!noremove
) removefile(file
,swindow
,act
,1);
921 if (!(a
=copyfile(sourcename
,destname
,&err
,/*-1,*/NULL
,0))) {
923 if ((a
=checkerror(globstring
[STR_MOVING
],file
->name
,err
))==3) {
927 if (a
==1) goto functionloop
;
933 else if (lockandexamine(destname
,&fileinfo
)) {
934 addfile(dwindow
,inact
,
935 fileinfo
.fib_FileName
,
937 fileinfo
.fib_DirEntryType
,
939 fileinfo
.fib_Comment
,
940 fileinfo
.fib_Protection
,
941 file
->subtype
,1,NULL
,NULL
,
942 fileinfo
.fib_OwnerUID
,fileinfo
.fib_OwnerGID
);
943 if ((a
=delfile(sourcename
,file
->name
,globstring
[STR_DELETING
],1,1))==-2) {
944 if (!(a
=recursedir(sourcename
,NULL
,R_DELETE
,0))) a
=1;
955 if (!noremove
) removefile(file
,swindow
,act
,1); file
=NULL
;
957 else oldiconname
[0]=0;
966 if (progress_copy
) dotaskmsg(hotkeymsg_port
,PROGRESS_UPDATE
,100,100,file
->name
,1);
967 addfile(dwindow
,inact
,namebuf
,file
->size
,file
->type
,&file
->date
,
968 file
->comment
,file
->protection
,file
->subtype
,1,NULL
,NULL
,
969 file
->owner_id
,file
->group_id
);
970 if (!noremove
) removefile(file
,swindow
,act
,1); file
=NULL
;
975 // case FUNC_CLONE: //function = FUNC_COPYAS;
976 case FUNC_COPYAS
: /* If flag is set then won't ask for new name */
977 if (!lastfile
&& !flag
) {
978 if (rexx
&& rexx_argcount
>1) strcpy(namebuf
,rexx_args
[1]);
980 if (!(a
=whatsit((specflags
&FUNCFLAGS_COPYISCLONE
)?globstring
[STR_ENTER_NEW_NAME_CLONE
]:globstring
[STR_ENTER_NEW_NAME
],FILEBUF_SIZE
-2,namebuf
,
981 globstring
[STR_SKIP
]))) {
991 if ((Stricmp(sourcedir
,destdir
)==0) && (Stricmp(namebuf
,file
->name
)==0)) {
992 okayflag
=1; oldiconname
[0]=0;
996 /* if (doicons && oldiconname[0]) namebuf[FILEBUF_SIZE-7]=0;
997 else namebuf[FILEBUF_SIZE-2]=0; */ namebuf
[FILEBUF_SIZE
-1]=0;
1000 if (lastfile
) strcpy(destname
,newiconname
);
1002 StrCombine(destname
,destdir
,namebuf
,256);
1003 StrCombine(newiconname
,destname
,".info",256);
1005 arcfile
= getsourcefromarc(swindow
,sourcename
,file
->name
);
1006 if (checksame(destdir
,sourcename
,0)==LOCK_SAME
) break;
1008 if ((exist
=CheckExist(destname
,NULL
))) {
1009 D(bug("askeach = %ld\n",askeach
));
1011 if ((a
=checkexistreplace(sourcename
,destname
,&file
->date
,
1012 (function
==FUNC_COPY
),1))==REPLACE_ABORT
) {
1016 if (a
==REPLACE_SKIP
) break;
1017 else if (a
==REPLACE_ALL
) {
1018 if (function
!=FUNC_COPY
/*==FUNC_COPYAS*/) goto functionloop
; // TRY AGAIN
1021 else if (a
==REPLACE_SKIPALL
) {
1025 else if (a
==REPLACE_RENAME
) {
1026 StrCombine(newiconname
,destname
,".info",256);
1030 if (autoskip
) break;
1033 if ((a
=delfile(destname
,file
->name
,globstring
[STR_COPYING
],1,1))==-1) {
1038 doerror(ERROR_OBJECT_EXISTS
);
1041 if (a
==1 && (tempfile
=findfile(dwindow
,namebuf
,NULL
))) {
1042 if (!noremove
) removefile(tempfile
,dwindow
,inact
,(tempfile
->type
!=file
->type
));
1046 if (file
->type
>=ENTRY_DIRECTORY
) {
1047 a
=recursedir(sourcename
,destname
,R_COPY
,0);
1052 else byte
=dos_global_copiedbytes
;
1053 if (config
->copyflags
©_DATE
) setdate(destname
,&file
->date
);
1055 if (!a
&& !func_external_file
[0]) {
1056 setdirsize(file
,dos_global_bytecount
,act
);
1057 refreshwindow(act
,0);
1058 filloutcopydata(file
);
1060 else if (a
==-1 || a
==-10) {
1062 if ((a
=checkerror(globstring
[STR_COPYING
],file
->name
,IoErr()))==1)
1066 if (CheckExist(destname
,NULL
)) {
1067 if (exist
&& (tempfile
=findfile(dwindow
,namebuf
,NULL
)))
1068 removefile(tempfile
,dwindow
,inact
,0);
1069 addfile(dwindow
,inact
,namebuf
,byte
,file
->type
,&file
->date
,
1070 file
->comment
,file
->protection
,file
->subtype
,1,NULL
,NULL
,
1071 file
->owner_id
,file
->group_id
);
1073 if (a
==-10) myabort();
1077 else if (a
<0) break;
1080 D(bug("FUNC_COPY: src=\"%s\", dst=\"%s\"\n",sourcename
,destname
));
1081 a
=copyfile(sourcename
,destname
,&err
,/*-1,*/NULL
,0);
1082 D(bug("FUNC_COPY: a=%ld,err=%ld\n",a
,err
));
1085 if ((a
=checkerror(globstring
[STR_COPYING
],file
->name
,err
))==3) {
1089 if (a
==1) goto functionloop
;
1098 if (exist
&& (tempfile
=findfile(dwindow
,namebuf
,NULL
)))
1099 removefile(tempfile
,dwindow
,inact
,0);
1100 if (lockandexamine(destname
,&fileinfo
)) {
1101 if (fileinfo
.fib_DirEntryType
<0) byte
=fileinfo
.fib_Size
;
1102 addfile(dwindow
,inact
,
1103 fileinfo
.fib_FileName
,
1105 fileinfo
.fib_DirEntryType
,
1107 fileinfo
.fib_Comment
,
1108 fileinfo
.fib_Protection
,
1109 file
->subtype
,1,NULL
,NULL
,
1110 fileinfo
.fib_OwnerUID
,fileinfo
.fib_OwnerGID
);
1111 if (config
->copyflags
©_ARC
&& !(file
->protection
&FIBF_ARCHIVE
)) {
1112 if (SetProtection(sourcename
,file
->protection
|FIBF_ARCHIVE
)) {
1113 file
->protection
|=FIBF_ARCHIVE
;
1114 getprot(file
->protection
,file
->protbuf
);
1123 if (file
->type
<=ENTRY_FILE
) {
1127 if ((a
=recursedir(sourcename
,NULL
,R_HUNT
,0))==-3) {
1128 wildselect(buf2
,2,0,WILDSELECT_NAME
);
1129 findfirstsel(act
,-2);
1130 okayflag
=breakout
=noshow
=1; count
=-1;
1135 if (a
==0 && !func_external_file
[0]) setdirsize(file
,dos_global_bytecount
,act
);
1144 case FUNC_SMARTREAD
:
1145 if (file
->type
>=ENTRY_DEVICE
) {
1149 arcfile
= getsourcefromarc(swindow
,sourcename
,file
->name
);
1150 a
= viewfile(sourcename
,str_arcorgname
[0]?str_arcorgname
:file
->name
,function
,NULL
,
1151 viewdata
,(viewdata
|| str_arcorgname
[0])?1:0,(entry_depth
>1));
1152 D(bug("viewfile() returned %ld\n",a
));
1155 else if (count
==0) unselect(act
,file
);
1156 if (file
->selected
) {
1159 --swindow
->filesel
; swindow
->bytessel
-=file
->size
;
1162 SetBusyPointer(Window
);
1163 if (a
==-1) status_justabort
=1;
1167 if (!count
&& !(doerror(-1))) okayflag
=1;
1172 if (file
->type
>=ENTRY_DEVICE
|| file
->size
<1) {
1177 arcfile
= getsourcefromarc(swindow
,sourcename
,file
->name
);
1178 if (entry_depth
<2 &&
1179 checkfiletypefunc(sourcename
,FTFUNC_SHOW
)) okayflag
=1;
1182 if (swindow
&& swindow
->filesel
>1 && config
->viewbits
&VIEWBITS_SHOWBLACK
) {
1183 if ((blankscreen
=OpenScreen((struct NewScreen
*)&blank_scr
)))
1184 SetRGB4(&blankscreen
->ViewPort
,0,0,0,0);
1185 setnullpointer(Window
);
1190 if ((a
=showpic(sourcename
,pt
))==-1) {
1196 if (a
==1) okayflag
=1;
1203 arcfile
= getsourcefromarc(swindow
,sourcename
,file
->name
);
1204 if (Stricmp(file
->name
,".info")==0) okayflag
=1;
1206 if ((ptr
=isicon(sourcename
))) *ptr
=0;
1207 switch ((a
=dopus_iconinfo(sourcename
))) {
1213 dostatustext(globstring
[STR_CANT_FIND_ICON
]);
1217 dostatustext(globstring
[STR_NO_CHIP_FOR_ICON
]);
1226 StrCombine(buf
,sourcename
,".info",256);
1227 if (isicon(file
->name
)) {
1228 reload_file(act
,sourcename
);
1229 file
=reload_file(act
,buf
);
1232 file
=reload_file(act
,sourcename
);
1233 reload_file(act
,buf
);
1249 if (file
->type
>=ENTRY_DEVICE
|| file
->size
<1) {
1254 arcfile
= getsourcefromarc(swindow
,sourcename
,file
->name
);
1255 if (entry_depth
<2 &&
1256 checkfiletypefunc(sourcename
,(function
==FUNC_PLAY
)?FTFUNC_PLAY
:FTFUNC_LOOPPLAY
))
1259 else if (a
|| check_is_module(sourcename
)) {
1260 if ((a
=playmod(sourcename
)) && swindow
&& swindow
->filesel
>1) {
1263 Wait(1<<Window
->UserPort
->mp_SigBit
);
1264 while (getintuimsg()) {
1265 class=IMsg
->Class
; code
=IMsg
->Code
;
1266 ReplyMsg((struct Message
*)IMsg
);
1267 if (class==MOUSEBUTTONS
) {
1268 a
=(code
==SELECTDOWN
);
1278 else if (a
) okayflag
=1;
1283 a
=doplay8svx(sourcename
,(function
==FUNC_LOOPPLAY
));
1290 if (a
==1) okayflag
=1;
1300 if (strlen(file
->name
)>(FILEBUF_SIZE
-6) || isicon(file
->name
)) {
1305 StrCombine(buf2
,file
->name
,".info",FILEBUF_SIZE
-1);
1306 StrCombine(destname
,sourcename
,".info",256);
1307 if ((a
=CheckExist(sourcename
,NULL
))==0) {
1308 doerror((a
=IoErr()));
1309 if ((a
=checkerror(globstring
[STR_ADDING_ICON
],file
->name
,a
))==1)
1318 if (a
>0) data
=ICONTYPE_DRAWER
;
1319 else if (checkexec(sourcename
)) data
=ICONTYPE_TOOL
;
1320 else data
=ICONTYPE_PROJECT
;
1321 if (CheckExist(destname
,NULL
)) {
1323 doerror(ERROR_OBJECT_EXISTS
);
1324 if ((a
=checkexistreplace(destname
,destname
,NULL
,1,1))==REPLACE_ABORT
) {
1328 else if (a
==REPLACE_ALL
) askeach
=0;
1329 else if (a
==REPLACE_SKIP
) {
1333 else if (a
==REPLACE_SKIPALL
) {
1338 else if (a
==REPLACE_RENAME
) {
1339 strcpy(buf2
,BaseName(destname
));
1342 if (autoskip
) break;
1344 if ((iconwrite(data
,destname
))!=-1) {
1345 if (lockandexamine(destname
,&fileinfo
)) {
1346 addfile(swindow
,act
,buf2
,fileinfo
.fib_Size
,-1,&fileinfo
.fib_Date
,
1347 fileinfo
.fib_Comment
,fileinfo
.fib_Protection
,0,1,NULL
,NULL
,
1348 fileinfo
.fib_OwnerUID
,fileinfo
.fib_OwnerGID
);
1361 if (rexx
&& rexx_argcount
>0) strcpy(buf2
,rexx_args
[rexarg
]);
1363 if (file
->comment
) strcpy(buf2
,file
->comment
);
1365 if (!(a
=whatsit(globstring
[STR_ENTER_COMMENT
],79,buf2
,
1366 globstring
[STR_ALL
]))) {
1370 if (a
==2) askeach
=0;
1374 if (SetComment(sourcename
,buf2
)) break;
1375 doerror((a
=IoErr()));
1376 if ((a
=checkerror(globstring
[STR_COMMENTING
],file
->name
,a
))==3) {
1385 if (status_justabort
|| !file
) break;
1387 if (file
->type
>=ENTRY_DIRECTORY
) {
1388 if ((a
=recursedir(sourcename
,buf2
,R_COMMENT
,0))>0 && status_justabort
)
1389 status_justabort
=okayflag
=0;
1390 else if (!a
&& !func_external_file
[0]) setdirsize(file
,dos_global_bytecount
,act
);
1392 if (!noremove
&& file
->comment
!=dos_copy_comment
) {
1393 if (act
>-1 && config
->sortmethod
[act
]==DISPLAY_COMMENT
) {
1394 CopyMem((char *)file
,(char *)&filebuf
,sizeof(struct Directory
));
1395 removefile(file
,swindow
,act
,0); file
=NULL
;
1396 addfile(swindow
,act
,namebuf
,filebuf
.size
,filebuf
.type
,&filebuf
.date
,
1397 buf2
,filebuf
.protection
,filebuf
.subtype
,1,NULL
,NULL
,
1398 filebuf
.owner_id
,filebuf
.group_id
);
1402 LibFreePooled(dir_memory_pool
,file
->comment
,strlen(file
->comment
)+1);
1403 if ((file
->comment
=LibAllocPooled(dir_memory_pool
,strlen(buf2
)+1)))
1404 strcpy(file
->comment
,buf2
);
1410 if (askeach
&& !lastfile
) {
1412 data
=rexx_arg_value
[0];
1413 mask
=rexx_arg_value
[1];
1416 data
=file
->protection
;
1417 if (!(a
=getprotectdata(&data
,&mask
))) {
1421 if (a
==2) askeach
=0;
1424 temp
=getnewprot(file
->protection
,data
,mask
);
1426 if (SetProtection(sourcename
,temp
)) break;
1427 doerror((a
=IoErr()));
1428 if ((a
=checkerror(globstring
[STR_PROTECTING
],file
->name
,a
))==3) {
1437 if (status_justabort
|| !file
) break;
1438 file
->protection
=temp
;
1439 getprot(temp
,file
->protbuf
);
1440 if (file
->type
>=ENTRY_DIRECTORY
) {
1441 protstuff
[0]=data
; protstuff
[1]=mask
;
1442 if ((a
=recursedir(sourcename
,NULL
,R_PROTECT
,(int)protstuff
)) &&
1443 status_justabort
) break;
1444 if (!a
&& !func_external_file
[0]) setdirsize(file
,dos_global_bytecount
,act
);
1446 if (!file
->selected
) refreshwindow(act
,0);
1451 if (file
->type
>=ENTRY_DEVICE
|| file
->size
<1) {
1456 StrCombine(destname
,destdir
,file
->name
,256);
1457 if (CheckExist(destname
,NULL
)) {
1459 if ((a
=checkexistreplace(sourcename
,destname
,&file
->date
,1,1))==REPLACE_ABORT
) {
1463 else if (a
==REPLACE_ALL
) askeach
=0;
1464 else if (a
==REPLACE_SKIP
) {
1468 else if (a
==REPLACE_SKIPALL
) {
1474 else if (a==REPLACE_RENAME) {
1478 if (autoskip
) break;
1479 if ((a
=delfile(destname
,file
->name
,globstring
[STR_DATESTAMPING
],1,1))==-1) {
1484 if (!CheckExist(destname
,NULL
)) {
1486 if (copyfile(sourcename
,destname
,&err
,/*-1,*/buf2
,data
)) {
1487 addfile(dwindow
,inact
,file
->name
,file
->size
,file
->type
,&file
->date
,
1488 file
->comment
,file
->protection
,file
->subtype
,1,NULL
,NULL
,
1489 file
->owner_id
,file
->group_id
);
1490 okayflag
=1; show
=inact
;
1494 if ((a
=checkerror(globstring
[STR_ENCRYPTING
],file
->name
,err
))==3) {
1504 else doerror(ERROR_OBJECT_EXISTS
);
1507 case FUNC_DATESTAMP
:
1508 if (askeach
&& !lastfile
) {
1509 if (rexx
&& rexx_argcount
>0) strcpy(buf2
,rexx_args
[rexarg
]);
1511 seedate(&(file
->date
),buf2
,0); // buf2[0]=0;
1512 if (!(a
=whatsit(globstring
[STR_ENTER_DATE_AND_TIME
],20,buf2
,
1513 globstring
[STR_ALL
]))) {
1517 if (a
==2) askeach
=0;
1520 parsedatetime(buf2
,buf
,buf1
,&a
);
1521 strtostamp(buf
,buf1
,&datetime
.dat_Stamp
);
1523 else DateStamp(&datetime
.dat_Stamp
);
1526 if ((a
=setdate(sourcename
,&datetime
.dat_Stamp
))==1) {
1528 if (act
>-1 && config
->sortmethod
[act
]==DISPLAY_DATE
) {
1529 CopyMem((char *)file
,(char *)&filebuf
,sizeof(struct Directory
));
1530 if (file
->comment
) {
1531 strcpy(buf2
,file
->comment
);
1532 filebuf
.comment
=buf2
;
1534 removefile(file
,swindow
,act
,0);
1535 file
=(struct Directory
*)addfile(swindow
,act
,filebuf
.name
,filebuf
.size
,
1536 filebuf
.type
,&datetime
.dat_Stamp
,filebuf
.comment
,filebuf
.protection
,
1537 filebuf
.subtype
,1,NULL
,NULL
,filebuf
.owner_id
,filebuf
.group_id
);
1540 file
->date
.ds_Days
=datetime
.dat_Stamp
.ds_Days
;
1541 file
->date
.ds_Minute
=datetime
.dat_Stamp
.ds_Minute
;
1542 file
->date
.ds_Tick
=datetime
.dat_Stamp
.ds_Tick
;
1543 seedate(&file
->date
,file
->datebuf
,1);
1549 if ((a
=checkerror(globstring
[STR_DATESTAMPING
],file
->name
,a
))==3) {
1558 if (status_justabort
|| !file
) break;
1559 if (file
->type
>=ENTRY_DIRECTORY
) {
1560 if (!(recursedir(sourcename
,NULL
,R_DATESTAMP
,(int)&datetime
.dat_Stamp
))) {
1562 if (!func_external_file
[0]) setdirsize(file
,dos_global_bytecount
,act
);
1569 if (file
->type
==ENTRY_DEVICE
) {
1570 if ((a
=recursedir(file
->name
,NULL
,R_SEARCH
,0))==-2) {
1572 count
=-1; nextfile
=NULL
;
1587 if (file
->type
<=ENTRY_FILE
) {
1588 arcfile
= getsourcefromarc(swindow
,sourcename
,file
->name
);
1589 a
=filesearch(sourcename
,&b
,(askeach
)?1:-1);
1592 okayflag
=1; file
=NULL
;
1596 if (count
>0) b
=(swindow
->filesel
-count
)+swindow
->dirsel
;
1597 else b
=swindow
->filesel
+swindow
->dirsel
;
1598 if (!b
) nextfile
=NULL
;
1601 if (nextfile
&& !simplerequest(globstring
[STR_CONTINUE_WITH_SEARCH
],
1602 globstring
[STR_CONTINUE
],str_cancelstring
,NULL
))
1611 if (a
==3) file
=NULL
;
1620 if (!(a
=recursedir(sourcename
,NULL
,R_SEARCH
,0))) {
1621 if (!func_external_file
[0]) setdirsize(file
,dos_global_bytecount
,act
);
1625 okayflag
=1; breakout
=2;
1626 count
=-1; nextfile
=NULL
;
1629 if (a
==-1 || a
==-10) {
1642 if (arcfile
) removetemparcfile(sourcename
);
1644 if (config
->dynamicflags
&UPDATE_FREE
&& show
>-1) seename(show
);
1645 if (breakout
==1) break;
1646 if (file
&& okayflag
) {
1647 if (file
->selected
) unselect(act
,file
);
1648 else refreshwindow(act
,0);
1650 if (status_justabort
|| breakout
==2) break;
1652 if (doicons
&& !lastfile
&& okayflag
&& oldiconname
[0]) {
1653 if ((file
=findfile(swindow
,oldiconname
,NULL
))) {
1654 if (file
==nextfile
) nextfile
=file
->next
;
1656 if (file
->selected
&& prog_indicator
) {
1657 if (progtype
==0 || progtype
==2) {
1659 // dotaskmsg(hotkeymsg_port,PROGRESS_UPDATE,value,total,NULL,0);
1660 dotaskmsg(hotkeymsg_port
,PROGRESS_INCREASE
,1,0,NULL
,0);
1663 if (progress_copy
) dotaskmsg(hotkeymsg_port
,PROGRESS_UPDATE
,-2,0,file
->name
,1);
1667 StrCombine(sourcename
,sourcedir
,oldiconname
,256);
1668 if (filloutdummy(sourcename
,&dummyfile
)) {
1669 dummyfile
.selected
=0;
1677 if (globflag
) break;
1678 if (!lastfile
&& file
&& file
->next
&& file
->next
!=nextfile
) file
=file
->next
;
1683 if (prog_indicator
) {
1684 dotaskmsg(hotkeymsg_port
,PROGRESS_UPDATE
,-1,status_justabort
,NULL
,0);
1685 if (progress_copy
) dotaskmsg(hotkeymsg_port
,PROGRESS_UPDATE
,-1,status_justabort
,NULL
,1);
1692 doerror(ERROR_OBJECT_NOT_FOUND
);
1693 simplerequest(globstring
[STR_COULD_NOT_FIND_FILE
],globstring
[STR_CONTINUE
],NULL
);
1696 lsprintf(buf2
,globstring
[STR_FOUND_MATCHING_FILES
],count
);
1698 simplerequest(buf2
,globstring
[STR_CONTINUE
],NULL
);
1705 case FUNC_SMARTREAD
:
1706 if (act
>-1) refreshwindow(act
,0);
1707 if (viewdata
) cleanupviewfile(viewdata
);
1708 if (status_justabort
) myabort();
1709 else if (!okayflag
&& !(doerror(-1))) okayflag
=1;
1713 if (config
->viewbits
&VIEWBITS_SHOWBLACK
) {
1715 CloseScreen(blankscreen
);
1718 ClearPointer(Window
);
1723 if (status_flags
&STATUS_IANSCRAP
&& okayflag
) {
1730 if (status_flags
&STATUS_IANSCRAP
&& okayflag
) {
1737 case FUNC_DATESTAMP
:
1738 if (status_flags
&STATUS_IANSCRAP
&& okayflag
) {
1739 seedate(&datetime
.dat_Stamp
,buf2
,0);
1747 if (count
==0) simplerequest(globstring
[STR_STRING_NOT_FOUND
],
1748 globstring
[STR_CONTINUE
],NULL
);
1750 lsprintf(buf2
,globstring
[STR_MATCHED_FILES
],count
);
1751 simplerequest(buf2
,globstring
[STR_CONTINUE
],NULL
);
1758 if (!status_justabort
) {
1761 main_proc
->pr_WindowPtr
=(APTR
)-1;
1762 if (!(destdir
&& (filelock
=Lock(destdir
,ACCESS_READ
)))) value
=0;
1764 Info(filelock
,&infodata
);
1765 if (ramdisk_lock
&& CompareLock(filelock
,ramdisk_lock
)!=LOCK_DIFFERENT
)
1767 else value
=(infodata
.id_NumBlocks
-infodata
.id_NumBlocksUsed
)*(long long)blocksize
;
1770 if (config
->errorflags
&ERROR_ENABLE_DOS
) main_proc
->pr_WindowPtr
=(APTR
)Window
;
1771 if (specflags
&FUNCFLAGS_BYTEISCHECKFIT
) {
1772 double needed
,percent
;
1774 needed
=data
*blocksize
;
1775 if (value
<1) percent
=0;
1776 else if (value
>=needed
|| needed
<1) {
1780 else percent
=100/(needed
/value
);
1781 sprintf(buf
,globstring
[STR_CHECKFIT_STRING
],data
*(long long)blocksize
,value
,percent
);
1786 strcat(str_select_info
,
1787 (value
<=swindow
->bytessel
)?
1788 globstring
[STR_NO_FIT
]:globstring
[STR_YES_FIT
]);
1789 dostatustext(str_select_info
);
1796 if (okayflag
&& !status_justabort
) okay();
1799 displaydir(act
); seename(act
);
1806 case FUNC_MOVEAS
: if (checksame(sourcedir
,destdir
,2)==LOCK_SAME
) break;
1812 update_buffer_stamp(act
,1);
1815 if (specflags
&FUNCFLAGS_COPYISCLONE
) update_buffer_stamp(act
,1);
1820 case FUNC_DATESTAMP
:
1821 update_buffer_stamp(act
,0);
1828 if (checksame(sourcedir
,destdir
,2)==LOCK_SAME
) break;
1832 update_buffer_stamp(inact
,1);
1838 if (count
>0) rexx_return_value
=count
;
1845 if (prog_indicator
) dotaskmsg(hotkeymsg_port
,PROGRESS_CLOSE
,0,0,NULL
,0);
1846 LFreeRemember(&funckey
);