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);
590 if (DeleteFile(sourcename)) {
591 if (!noremove) removefile(file,swindow,act,1); file=NULL;
596 if ((a
=IoErr())==ERROR_DELETE_PROTECTED
&&
597 config
->deleteflags
&DELETE_SET
) {
600 SetProtection(sourcename
,0);
604 else if (a
==ERROR_OBJECT_NOT_FOUND
) {
605 if (!noremove
) removefile(file
,swindow
,act
,1);
609 else if (a
==ERROR_DIRECTORY_NOT_EMPTY
) {
610 if (config
->deleteflags
&DELETE_DIRS
&& askeach
) {
611 lsprintf(buf2
,globstring
[STR_NOT_EMPTY
],file
->name
);
612 if (!(a
=simplerequest(buf2
,globstring
[STR_DELETE
],
613 globstring
[STR_LEAVE
],globstring
[STR_ALL
],globstring
[STR_ABORT
],NULL
))) {
623 TackOn(sourcename
,NULL
,256);
624 a
=recursedir(sourcename
,NULL
,R_DELETE
,0);
625 sourcename
[strlen(sourcename
)-1]=0;
627 if ((a
=delfile(sourcename
,file
->name
,globstring
[STR_DELETING
],
628 glob_unprotect_all
,1))==-1) {
632 else if (a
==1 || a
==2) {
633 if (a
==2) glob_unprotect_all
=1;
634 if (!noremove
) removefile(file
,swindow
,act
,1);
639 setdirsize(file
,dos_global_bytecount
-dos_global_deletedbytes
,act
);
644 setdirsize(file
,file
->size
-dos_global_deletedbytes
,act
);
645 refreshwindow(act
,0);
649 doerror((a
=IoErr()));
650 if ((a
=checkerror(globstring
[STR_DELETING
],file
->name
,a
))==3) {
654 if (a
==1) goto functionloop
;
660 if (file
->type
== ENTRY_DEVICE
)
662 if ((!strcmp(file
->comment
,"<DEV>")) || (!strcmp(file
->comment
,"<VOL>"))) break;
664 if (config
->deleteflags
&DELETE_FILES
&& askeach
&& !lastfile
) {
665 lsprintf(buf2
,file
->type
==ENTRY_DEVICE
?globstring
[STR_QUERY_REMOVE_ASSIGN
]:globstring
[STR_WISH_TO_DELETE
],file
->name
); // HUX
666 a
=simplerequest(buf2
,globstring
[file
->type
==ENTRY_DEVICE
?STR_REMOVE
:STR_DELETE
],globstring
[STR_ABORT
],
667 globstring
[STR_ALL
],globstring
[STR_LEAVE
],NULL
);
672 else if (a
==2) askeach
=0;
678 if (file
->type
== ENTRY_DEVICE
) /* remove assign */
680 char buf
[FILEBUF_SIZE
],*c
;
682 strcpy(buf
,file
->name
);
685 a
= AssignLock(buf
,NULL
)?1:0;
686 //D(bug("Removing assign %s\t%s\n",buf,a?"success":"failure"));
688 else if ((a
=delfile(sourcename
,file
->name
,globstring
[STR_DELETING
],
689 glob_unprotect_all
,1))==-1) {
694 if (a
==2) glob_unprotect_all
=1;
695 if (!noremove
) removefile(file
,swindow
,act
,1);
703 if (firstset
|| lastfile
) a
=1;
704 else if (!destwild
) {
705 if (!(a
=whatsit(globstring
[STR_ENTER_NEW_NAME
],FILEBUF_SIZE
-2,namebuf
,
706 globstring
[STR_SKIP
]))) {
717 else if (!sourcewild
) a
=getwildrename("*",drename
,file
->name
,namebuf
);
718 else if (sourcewild
) a
=getwildrename(srename
,drename
,file
->name
,namebuf
);
721 if (lastfile
) StrCombine(destname
,sourcedir
,newiconname
,256);
723 /* if (doicons && oldiconname[0]) namebuf[FILEBUF_SIZE-7]=0;
724 else namebuf[FILEBUF_SIZE-2]=0; */ namebuf
[FILEBUF_SIZE
-1]=0;
725 StrCombine(destname
,sourcedir
,namebuf
,256);
726 StrCombine(newiconname
,namebuf
,".info",256);
729 D(bug("Rename(%s,%s)\n",sourcename
,destname
));
730 if (!(Rename(sourcename
,destname
))) {
731 if ((a
=IoErr())==ERROR_OBJECT_EXISTS
) {
734 if ((a
=checkexistreplace(sourcename
,destname
,&file
->date
,destwild
,1))==REPLACE_ABORT
)
739 if (a
==REPLACE_ALL
) {
740 if (!destwild
) goto functionloop
; // TRY AGAIN
741 askeach
=0; // REPLACE ALL
743 else if (a
==REPLACE_SKIP
) {
746 else if (a
==REPLACE_SKIPALL
) {
750 else if (a
==REPLACE_RENAME
) goto retry_rename
;
754 if ((a
=delfile(destname
,namebuf
,globstring
[STR_DELETING
],1,1))==-2) {
755 if (!(a
=recursedir(destname
,NULL
,R_DELETE
,0))) a
=1;
756 else if (a
==-10) a
=-1;
763 if ((tempfile
=findfile(swindow
,namebuf
,NULL
))) {
764 if (tempfile
==nextfile
) nextfile
=tempfile
->next
;
765 removefile(tempfile
,swindow
,act
,1);
772 if ((a
=checkerror(globstring
[STR_RENAMING
],file
->name
,a
))==3) {
776 if (a
==1) goto functionloop
;
779 if (file
->type
>=ENTRY_DIRECTORY
) {
780 StrCombine(buf
,sourcedir
,file
->name
,256); TackOn(buf
,NULL
,256);
781 StrCombine(buf1
,sourcedir
,namebuf
,256); TackOn(buf1
,NULL
,256);
782 renamebuffers(buf
,buf1
);
785 if (act
>-1 && config
->sortmethod
[act
]==DISPLAY_NAME
) {
786 CopyMem((char *)file
,(char *)&filebuf
,sizeof(struct Directory
));
787 if (file
->comment
) strcpy(buf2
,file
->comment
);
789 removefile(file
,swindow
,act
,0); file
=NULL
;
790 addfile(swindow
,act
,namebuf
,filebuf
.size
,filebuf
.type
,&filebuf
.date
,
791 buf2
,filebuf
.protection
,filebuf
.subtype
,1,NULL
,NULL
,
792 filebuf
.owner_id
,filebuf
.group_id
);
794 else strcpy(file
->name
,namebuf
);
795 if (lastfile
) refreshwindow(act
,0);
804 if (!lastfile
&& !flag
) {
805 if (rexx
&& rexx_argcount
>1) strcpy(namebuf
,rexx_args
[1]);
807 if (!(a
=whatsit(globstring
[STR_ENTER_NEW_NAME_MOVE
],FILEBUF_SIZE
-2,
808 namebuf
,globstring
[STR_SKIP
]))) {
819 /* if (doicons && oldiconname[0]) namebuf[FILEBUF_SIZE-7]=0;
820 else namebuf[FILEBUF_SIZE-2]=0; */ namebuf
[FILEBUF_SIZE
-1]=0;
823 if (lastfile
) strcpy(destname
,newiconname
);
825 StrCombine(destname
,destdir
,namebuf
,256);
826 StrCombine(newiconname
,destname
,".info",256);
828 if (checksame(destdir
,sourcename
,0)==LOCK_SAME
) break;
830 if ((exist
=CheckExist(destname
,NULL
))) {
832 if ((a
=checkexistreplace(sourcename
,destname
,&file
->date
,(function
==FUNC_MOVE
),1))==REPLACE_ABORT
) {
836 if (a
==REPLACE_SKIP
) break;
837 if (a
==REPLACE_ALL
) {
838 if (function
==FUNC_MOVEAS
) goto functionloop
; // TRY AGAIN
841 if (a
==REPLACE_SKIPALL
) {
845 else if (a
==REPLACE_RENAME
) {
846 StrCombine(newiconname
,destname
,".info",256);
851 if ((a
=delfile(destname
,namebuf
,globstring
[STR_MOVING
],1,1))==-1) {
856 doerror(ERROR_OBJECT_EXISTS
);
859 if (a
&& (tempfile
=findfile(dwindow
,namebuf
,NULL
)))
860 removefile(tempfile
,dwindow
,inact
,0);
862 if (!(Rename(sourcename
,destname
))) {
863 if ((exist
<0 || file
->type
<=ENTRY_FILE
) &&
864 (a
=IoErr())!=ERROR_RENAME_ACROSS_DEVICES
) {
866 if ((a
=checkerror(globstring
[STR_MOVING
],file
->name
,a
))==3) {
870 if (a
==1) goto functionloop
;
873 if (file
->type
>=ENTRY_DIRECTORY
) {
874 a
=recursedir(sourcename
,destname
,R_COPY
|R_DELETE
,0);
875 D(bug("recursedir returned %ld\n",a
));
877 if (!func_external_file
[0])
878 setdirsize(file
,dos_global_bytecount
-dos_global_deletedbytes
,act
);
880 else if (status_justabort
|| a
<0) {
882 if ((a
=checkerror(globstring
[STR_MOVING
],file
->name
,IoErr()))==3)
884 else if (a
==1) goto functionloop
;
886 if (!func_external_file
[0]) {
887 setdirsize(file
,file
->size
-dos_global_deletedbytes
,act
);
888 refreshwindow(act
,0);
890 if (CheckExist(destname
,NULL
)) {
892 if ((tempfile
=findfile(dwindow
,namebuf
,NULL
)))
893 removefile(tempfile
,dwindow
,inact
,0);
895 addfile(dwindow
,inact
,namebuf
,dos_global_copiedbytes
,
896 file
->type
,&file
->date
,file
->comment
,
897 file
->protection
,file
->subtype
,1,NULL
,NULL
,
898 file
->owner_id
,file
->group_id
);
900 if (a
==-10) myabort();
901 else status_justabort
=0;
904 if (!(tempfile
=findfile(dwindow
,namebuf
,NULL
))) {
905 addfile(dwindow
,inact
,namebuf
,exist
?-1:dos_global_copiedbytes
,file
->type
,
906 &file
->date
,file
->comment
,file
->protection
,
907 file
->subtype
,1,NULL
,NULL
,file
->owner_id
,file
->group_id
);
910 setdirsize(tempfile
,exist
?-1:dos_global_copiedbytes
,act
);
911 refreshwindow(inact
,0);
913 if ((a
=delfile(sourcename
,file
->name
,globstring
[STR_DELETING
],1,1))==-1) {
918 if (!noremove
) removefile(file
,swindow
,act
,1);
924 if (!(a
=copyfile(sourcename
,destname
,&err
,/*-1,*/NULL
,0))) {
926 if ((a
=checkerror(globstring
[STR_MOVING
],file
->name
,err
))==3) {
930 if (a
==1) goto functionloop
;
936 else if (lockandexamine(destname
,&fileinfo
)) {
937 addfile(dwindow
,inact
,
938 fileinfo
.fib_FileName
,
940 fileinfo
.fib_DirEntryType
,
942 fileinfo
.fib_Comment
,
943 fileinfo
.fib_Protection
,
944 file
->subtype
,1,NULL
,NULL
,
945 fileinfo
.fib_OwnerUID
,fileinfo
.fib_OwnerGID
);
946 if ((a
=delfile(sourcename
,file
->name
,globstring
[STR_DELETING
],1,1))==-2) {
947 if (!(a
=recursedir(sourcename
,NULL
,R_DELETE
,0))) a
=1;
958 if (!noremove
) removefile(file
,swindow
,act
,1);
961 else oldiconname
[0]=0;
970 if (progress_copy
) dotaskmsg(hotkeymsg_port
,PROGRESS_UPDATE
,100,100,file
->name
,1);
971 addfile(dwindow
,inact
,namebuf
,file
->size
,file
->type
,&file
->date
,
972 file
->comment
,file
->protection
,file
->subtype
,1,NULL
,NULL
,
973 file
->owner_id
,file
->group_id
);
974 if (!noremove
) removefile(file
,swindow
,act
,1);
980 // case FUNC_CLONE: //function = FUNC_COPYAS;
981 case FUNC_COPYAS
: /* If flag is set then won't ask for new name */
982 if (!lastfile
&& !flag
) {
983 if (rexx
&& rexx_argcount
>1) strcpy(namebuf
,rexx_args
[1]);
985 if (!(a
=whatsit((specflags
&FUNCFLAGS_COPYISCLONE
)?globstring
[STR_ENTER_NEW_NAME_CLONE
]:globstring
[STR_ENTER_NEW_NAME
],FILEBUF_SIZE
-2,namebuf
,
986 globstring
[STR_SKIP
]))) {
996 if ((Stricmp(sourcedir
,destdir
)==0) && (Stricmp(namebuf
,file
->name
)==0)) {
997 okayflag
=1; oldiconname
[0]=0;
1001 /* if (doicons && oldiconname[0]) namebuf[FILEBUF_SIZE-7]=0;
1002 else namebuf[FILEBUF_SIZE-2]=0; */ namebuf
[FILEBUF_SIZE
-1]=0;
1005 if (lastfile
) strcpy(destname
,newiconname
);
1007 StrCombine(destname
,destdir
,namebuf
,256);
1008 StrCombine(newiconname
,destname
,".info",256);
1010 arcfile
= getsourcefromarc(swindow
,sourcename
,file
->name
);
1011 if (checksame(destdir
,sourcename
,0)==LOCK_SAME
) break;
1013 if ((exist
=CheckExist(destname
,NULL
))) {
1014 D(bug("askeach = %ld\n",askeach
));
1016 if ((a
=checkexistreplace(sourcename
,destname
,&file
->date
,
1017 (function
==FUNC_COPY
),1))==REPLACE_ABORT
) {
1021 if (a
==REPLACE_SKIP
) break;
1022 else if (a
==REPLACE_ALL
) {
1023 if (function
!=FUNC_COPY
/*==FUNC_COPYAS*/) goto functionloop
; // TRY AGAIN
1026 else if (a
==REPLACE_SKIPALL
) {
1030 else if (a
==REPLACE_RENAME
) {
1031 StrCombine(newiconname
,destname
,".info",256);
1035 if (autoskip
) break;
1038 if ((a
=delfile(destname
,file
->name
,globstring
[STR_COPYING
],1,1))==-1) {
1043 doerror(ERROR_OBJECT_EXISTS
);
1046 if (a
==1 && (tempfile
=findfile(dwindow
,namebuf
,NULL
))) {
1047 if (!noremove
) removefile(tempfile
,dwindow
,inact
,(tempfile
->type
!=file
->type
));
1051 if (file
->type
>=ENTRY_DIRECTORY
) {
1052 a
=recursedir(sourcename
,destname
,R_COPY
,0);
1057 else byte
=dos_global_copiedbytes
;
1058 if (config
->copyflags
©_DATE
) setdate(destname
,&file
->date
);
1060 if (!a
&& !func_external_file
[0]) {
1061 setdirsize(file
,dos_global_bytecount
,act
);
1062 refreshwindow(act
,0);
1063 filloutcopydata(file
);
1065 else if (a
==-1 || a
==-10) {
1067 if ((a
=checkerror(globstring
[STR_COPYING
],file
->name
,IoErr()))==1)
1071 if (CheckExist(destname
,NULL
)) {
1072 if (exist
&& (tempfile
=findfile(dwindow
,namebuf
,NULL
)))
1073 removefile(tempfile
,dwindow
,inact
,0);
1074 addfile(dwindow
,inact
,namebuf
,byte
,file
->type
,&file
->date
,
1075 file
->comment
,file
->protection
,file
->subtype
,1,NULL
,NULL
,
1076 file
->owner_id
,file
->group_id
);
1078 if (a
==-10) myabort();
1082 else if (a
<0) break;
1085 D(bug("FUNC_COPY: src=\"%s\", dst=\"%s\"\n",sourcename
,destname
));
1086 a
=copyfile(sourcename
,destname
,&err
,/*-1,*/NULL
,0);
1087 D(bug("FUNC_COPY: a=%ld,err=%ld\n",a
,err
));
1090 if ((a
=checkerror(globstring
[STR_COPYING
],file
->name
,err
))==3) {
1094 if (a
==1) goto functionloop
;
1103 if (exist
&& (tempfile
=findfile(dwindow
,namebuf
,NULL
)))
1104 removefile(tempfile
,dwindow
,inact
,0);
1105 if (lockandexamine(destname
,&fileinfo
)) {
1106 if (fileinfo
.fib_DirEntryType
<0) byte
=fileinfo
.fib_Size
;
1107 addfile(dwindow
,inact
,
1108 fileinfo
.fib_FileName
,
1110 fileinfo
.fib_DirEntryType
,
1112 fileinfo
.fib_Comment
,
1113 fileinfo
.fib_Protection
,
1114 file
->subtype
,1,NULL
,NULL
,
1115 fileinfo
.fib_OwnerUID
,fileinfo
.fib_OwnerGID
);
1116 if (config
->copyflags
©_ARC
&& !(file
->protection
&FIBF_ARCHIVE
)) {
1117 if (SetProtection(sourcename
,file
->protection
|FIBF_ARCHIVE
)) {
1118 file
->protection
|=FIBF_ARCHIVE
;
1119 getprot(file
->protection
,file
->protbuf
);
1128 if (file
->type
<=ENTRY_FILE
) {
1132 if ((a
=recursedir(sourcename
,NULL
,R_HUNT
,0))==-3) {
1133 wildselect(buf2
,2,0,WILDSELECT_NAME
);
1134 findfirstsel(act
,-2);
1135 okayflag
=breakout
=noshow
=1; count
=-1;
1140 if (a
==0 && !func_external_file
[0]) setdirsize(file
,dos_global_bytecount
,act
);
1149 case FUNC_SMARTREAD
:
1150 if (file
->type
>=ENTRY_DEVICE
) {
1154 arcfile
= getsourcefromarc(swindow
,sourcename
,file
->name
);
1155 a
= viewfile(sourcename
,str_arcorgname
[0]?str_arcorgname
:file
->name
,function
,NULL
,
1156 viewdata
,(viewdata
|| str_arcorgname
[0])?1:0,(entry_depth
>1));
1157 D(bug("viewfile() returned %ld\n",a
));
1160 else if (count
==0) unselect(act
,file
);
1161 if (file
->selected
) {
1164 --swindow
->filesel
; swindow
->bytessel
-=file
->size
;
1167 SetBusyPointer(Window
);
1168 if (a
==-1) status_justabort
=1;
1172 if (!count
&& !(doerror(-1))) okayflag
=1;
1177 if (file
->type
>=ENTRY_DEVICE
|| file
->size
<1) {
1182 arcfile
= getsourcefromarc(swindow
,sourcename
,file
->name
);
1183 if (entry_depth
<2 &&
1184 checkfiletypefunc(sourcename
,FTFUNC_SHOW
)) okayflag
=1;
1187 if (swindow
&& swindow
->filesel
>1 && config
->viewbits
&VIEWBITS_SHOWBLACK
) {
1188 if ((blankscreen
=OpenScreen((struct NewScreen
*)&blank_scr
)))
1189 SetRGB4(&blankscreen
->ViewPort
,0,0,0,0);
1190 setnullpointer(Window
);
1195 if ((a
=showpic(sourcename
,pt
))==-1) {
1201 if (a
==1) okayflag
=1;
1208 arcfile
= getsourcefromarc(swindow
,sourcename
,file
->name
);
1209 if (Stricmp(file
->name
,".info")==0) okayflag
=1;
1211 if ((ptr
=isicon(sourcename
))) *ptr
=0;
1212 switch ((a
=dopus_iconinfo(sourcename
))) {
1218 dostatustext(globstring
[STR_CANT_FIND_ICON
]);
1222 dostatustext(globstring
[STR_NO_CHIP_FOR_ICON
]);
1231 StrCombine(buf
,sourcename
,".info",256);
1232 if (isicon(file
->name
)) {
1233 reload_file(act
,sourcename
);
1234 file
=reload_file(act
,buf
);
1237 file
=reload_file(act
,sourcename
);
1238 reload_file(act
,buf
);
1254 if (file
->type
>=ENTRY_DEVICE
|| file
->size
<1) {
1259 arcfile
= getsourcefromarc(swindow
,sourcename
,file
->name
);
1260 if (entry_depth
<2 &&
1261 checkfiletypefunc(sourcename
,(function
==FUNC_PLAY
)?FTFUNC_PLAY
:FTFUNC_LOOPPLAY
))
1264 else if (a
|| check_is_module(sourcename
)) {
1265 if ((a
=playmod(sourcename
)) && swindow
&& swindow
->filesel
>1) {
1268 Wait(1<<Window
->UserPort
->mp_SigBit
);
1269 while (getintuimsg()) {
1270 class=IMsg
->Class
; code
=IMsg
->Code
;
1271 ReplyMsg((struct Message
*)IMsg
);
1272 if (class==MOUSEBUTTONS
) {
1273 a
=(code
==SELECTDOWN
);
1283 else if (a
) okayflag
=1;
1288 a
=doplay8svx(sourcename
,(function
==FUNC_LOOPPLAY
));
1295 if (a
==1) okayflag
=1;
1305 if (strlen(file
->name
)>(FILEBUF_SIZE
-6) || isicon(file
->name
)) {
1310 StrCombine(buf2
,file
->name
,".info",FILEBUF_SIZE
-1);
1311 StrCombine(destname
,sourcename
,".info",256);
1312 if ((a
=CheckExist(sourcename
,NULL
))==0) {
1313 doerror((a
=IoErr()));
1314 if ((a
=checkerror(globstring
[STR_ADDING_ICON
],file
->name
,a
))==1)
1323 if (a
>0) data
=ICONTYPE_DRAWER
;
1324 else if (checkexec(sourcename
)) data
=ICONTYPE_TOOL
;
1325 else data
=ICONTYPE_PROJECT
;
1326 if (CheckExist(destname
,NULL
)) {
1328 doerror(ERROR_OBJECT_EXISTS
);
1329 if ((a
=checkexistreplace(destname
,destname
,NULL
,1,1))==REPLACE_ABORT
) {
1333 else if (a
==REPLACE_ALL
) askeach
=0;
1334 else if (a
==REPLACE_SKIP
) {
1338 else if (a
==REPLACE_SKIPALL
) {
1343 else if (a
==REPLACE_RENAME
) {
1344 strcpy(buf2
,BaseName(destname
));
1347 if (autoskip
) break;
1349 if ((iconwrite(data
,destname
))!=-1) {
1350 if (lockandexamine(destname
,&fileinfo
)) {
1351 addfile(swindow
,act
,buf2
,fileinfo
.fib_Size
,-1,&fileinfo
.fib_Date
,
1352 fileinfo
.fib_Comment
,fileinfo
.fib_Protection
,0,1,NULL
,NULL
,
1353 fileinfo
.fib_OwnerUID
,fileinfo
.fib_OwnerGID
);
1366 if (rexx
&& rexx_argcount
>0) strcpy(buf2
,rexx_args
[rexarg
]);
1368 if (file
->comment
) strcpy(buf2
,file
->comment
);
1370 if (!(a
=whatsit(globstring
[STR_ENTER_COMMENT
],79,buf2
,
1371 globstring
[STR_ALL
]))) {
1375 if (a
==2) askeach
=0;
1379 if (SetComment(sourcename
,buf2
)) break;
1380 doerror((a
=IoErr()));
1381 if ((a
=checkerror(globstring
[STR_COMMENTING
],file
->name
,a
))==3) {
1390 if (status_justabort
|| !file
) break;
1392 if (file
->type
>=ENTRY_DIRECTORY
) {
1393 if ((a
=recursedir(sourcename
,buf2
,R_COMMENT
,0))>0 && status_justabort
)
1394 status_justabort
=okayflag
=0;
1395 else if (!a
&& !func_external_file
[0]) setdirsize(file
,dos_global_bytecount
,act
);
1397 if (!noremove
&& file
->comment
!=dos_copy_comment
) {
1398 if (act
>-1 && config
->sortmethod
[act
]==DISPLAY_COMMENT
) {
1399 CopyMem((char *)file
,(char *)&filebuf
,sizeof(struct Directory
));
1400 removefile(file
,swindow
,act
,0); file
=NULL
;
1401 addfile(swindow
,act
,namebuf
,filebuf
.size
,filebuf
.type
,&filebuf
.date
,
1402 buf2
,filebuf
.protection
,filebuf
.subtype
,1,NULL
,NULL
,
1403 filebuf
.owner_id
,filebuf
.group_id
);
1407 LibFreePooled(dir_memory_pool
,file
->comment
,strlen(file
->comment
)+1);
1408 if ((file
->comment
=LibAllocPooled(dir_memory_pool
,strlen(buf2
)+1)))
1409 strcpy(file
->comment
,buf2
);
1415 if (askeach
&& !lastfile
) {
1417 data
=rexx_arg_value
[0];
1418 mask
=rexx_arg_value
[1];
1421 data
=file
->protection
;
1422 if (!(a
=getprotectdata(&data
,&mask
))) {
1426 if (a
==2) askeach
=0;
1429 temp
=getnewprot(file
->protection
,data
,mask
);
1431 if (SetProtection(sourcename
,temp
)) break;
1432 doerror((a
=IoErr()));
1433 if ((a
=checkerror(globstring
[STR_PROTECTING
],file
->name
,a
))==3) {
1442 if (status_justabort
|| !file
) break;
1443 file
->protection
=temp
;
1444 getprot(temp
,file
->protbuf
);
1445 if (file
->type
>=ENTRY_DIRECTORY
) {
1446 protstuff
[0]=data
; protstuff
[1]=mask
;
1447 if ((a
=recursedir(sourcename
,NULL
,R_PROTECT
,(int)protstuff
)) &&
1448 status_justabort
) break;
1449 if (!a
&& !func_external_file
[0]) setdirsize(file
,dos_global_bytecount
,act
);
1451 if (!file
->selected
) refreshwindow(act
,0);
1456 if (file
->type
>=ENTRY_DEVICE
|| file
->size
<1) {
1461 StrCombine(destname
,destdir
,file
->name
,256);
1462 if (CheckExist(destname
,NULL
)) {
1464 if ((a
=checkexistreplace(sourcename
,destname
,&file
->date
,1,1))==REPLACE_ABORT
) {
1468 else if (a
==REPLACE_ALL
) askeach
=0;
1469 else if (a
==REPLACE_SKIP
) {
1473 else if (a
==REPLACE_SKIPALL
) {
1479 else if (a==REPLACE_RENAME) {
1483 if (autoskip
) break;
1484 if ((a
=delfile(destname
,file
->name
,globstring
[STR_DATESTAMPING
],1,1))==-1) {
1489 if (!CheckExist(destname
,NULL
)) {
1491 if (copyfile(sourcename
,destname
,&err
,/*-1,*/buf2
,data
)) {
1492 addfile(dwindow
,inact
,file
->name
,file
->size
,file
->type
,&file
->date
,
1493 file
->comment
,file
->protection
,file
->subtype
,1,NULL
,NULL
,
1494 file
->owner_id
,file
->group_id
);
1495 okayflag
=1; show
=inact
;
1499 if ((a
=checkerror(globstring
[STR_ENCRYPTING
],file
->name
,err
))==3) {
1509 else doerror(ERROR_OBJECT_EXISTS
);
1512 case FUNC_DATESTAMP
:
1513 if (askeach
&& !lastfile
) {
1514 if (rexx
&& rexx_argcount
>0) strcpy(buf2
,rexx_args
[rexarg
]);
1516 seedate(&(file
->date
),buf2
,0); // buf2[0]=0;
1517 if (!(a
=whatsit(globstring
[STR_ENTER_DATE_AND_TIME
],20,buf2
,
1518 globstring
[STR_ALL
]))) {
1522 if (a
==2) askeach
=0;
1525 parsedatetime(buf2
,buf
,buf1
,&a
);
1526 strtostamp(buf
,buf1
,&datetime
.dat_Stamp
);
1528 else DateStamp(&datetime
.dat_Stamp
);
1531 if ((a
=setdate(sourcename
,&datetime
.dat_Stamp
))==1) {
1533 if (act
>-1 && config
->sortmethod
[act
]==DISPLAY_DATE
) {
1534 CopyMem((char *)file
,(char *)&filebuf
,sizeof(struct Directory
));
1535 if (file
->comment
) {
1536 strcpy(buf2
,file
->comment
);
1537 filebuf
.comment
=buf2
;
1539 removefile(file
,swindow
,act
,0);
1540 file
=(struct Directory
*)addfile(swindow
,act
,filebuf
.name
,filebuf
.size
,
1541 filebuf
.type
,&datetime
.dat_Stamp
,filebuf
.comment
,filebuf
.protection
,
1542 filebuf
.subtype
,1,NULL
,NULL
,filebuf
.owner_id
,filebuf
.group_id
);
1545 file
->date
.ds_Days
=datetime
.dat_Stamp
.ds_Days
;
1546 file
->date
.ds_Minute
=datetime
.dat_Stamp
.ds_Minute
;
1547 file
->date
.ds_Tick
=datetime
.dat_Stamp
.ds_Tick
;
1548 seedate(&file
->date
,file
->datebuf
,1);
1554 if ((a
=checkerror(globstring
[STR_DATESTAMPING
],file
->name
,a
))==3) {
1563 if (status_justabort
|| !file
) break;
1564 if (file
->type
>=ENTRY_DIRECTORY
) {
1565 if (!(recursedir(sourcename
,NULL
,R_DATESTAMP
,(int)&datetime
.dat_Stamp
))) {
1567 if (!func_external_file
[0]) setdirsize(file
,dos_global_bytecount
,act
);
1574 if (file
->type
==ENTRY_DEVICE
) {
1575 if ((a
=recursedir(file
->name
,NULL
,R_SEARCH
,0))==-2) {
1577 count
=-1; nextfile
=NULL
;
1592 if (file
->type
<=ENTRY_FILE
) {
1593 arcfile
= getsourcefromarc(swindow
,sourcename
,file
->name
);
1594 a
=filesearch(sourcename
,&b
,(askeach
)?1:-1);
1597 okayflag
=1; file
=NULL
;
1601 if (count
>0) b
=(swindow
->filesel
-count
)+swindow
->dirsel
;
1602 else b
=swindow
->filesel
+swindow
->dirsel
;
1603 if (!b
) nextfile
=NULL
;
1606 if (nextfile
&& !simplerequest(globstring
[STR_CONTINUE_WITH_SEARCH
],
1607 globstring
[STR_CONTINUE
],str_cancelstring
,NULL
))
1616 if (a
==3) file
=NULL
;
1625 if (!(a
=recursedir(sourcename
,NULL
,R_SEARCH
,0))) {
1626 if (!func_external_file
[0]) setdirsize(file
,dos_global_bytecount
,act
);
1630 okayflag
=1; breakout
=2;
1631 count
=-1; nextfile
=NULL
;
1634 if (a
==-1 || a
==-10) {
1647 if (arcfile
) removetemparcfile(sourcename
);
1649 if (config
->dynamicflags
&UPDATE_FREE
&& show
>-1) seename(show
);
1650 if (breakout
==1) break;
1651 if (file
&& okayflag
) {
1652 if (file
->selected
) unselect(act
,file
);
1653 else refreshwindow(act
,0);
1655 if (status_justabort
|| breakout
==2) break;
1657 if (doicons
&& !lastfile
&& okayflag
&& oldiconname
[0]) {
1658 if ((file
=findfile(swindow
,oldiconname
,NULL
))) {
1659 if (file
==nextfile
) nextfile
=file
->next
;
1661 if (file
->selected
&& prog_indicator
) {
1662 if (progtype
==0 || progtype
==2) {
1664 // dotaskmsg(hotkeymsg_port,PROGRESS_UPDATE,value,total,NULL,0);
1665 dotaskmsg(hotkeymsg_port
,PROGRESS_INCREASE
,1,0,NULL
,0);
1668 if (progress_copy
) dotaskmsg(hotkeymsg_port
,PROGRESS_UPDATE
,-2,0,file
->name
,1);
1672 StrCombine(sourcename
,sourcedir
,oldiconname
,256);
1673 if (filloutdummy(sourcename
,&dummyfile
)) {
1674 dummyfile
.selected
=0;
1682 if (globflag
) break;
1683 if (!lastfile
&& file
&& file
->next
&& file
->next
!=nextfile
) file
=file
->next
;
1688 if (prog_indicator
) {
1689 dotaskmsg(hotkeymsg_port
,PROGRESS_UPDATE
,-1,status_justabort
,NULL
,0);
1690 if (progress_copy
) dotaskmsg(hotkeymsg_port
,PROGRESS_UPDATE
,-1,status_justabort
,NULL
,1);
1697 doerror(ERROR_OBJECT_NOT_FOUND
);
1698 simplerequest(globstring
[STR_COULD_NOT_FIND_FILE
],globstring
[STR_CONTINUE
],NULL
);
1701 lsprintf(buf2
,globstring
[STR_FOUND_MATCHING_FILES
],count
);
1703 simplerequest(buf2
,globstring
[STR_CONTINUE
],NULL
);
1710 case FUNC_SMARTREAD
:
1711 if (act
>-1) refreshwindow(act
,0);
1712 if (viewdata
) cleanupviewfile(viewdata
);
1713 if (status_justabort
) myabort();
1714 else if (!okayflag
&& !(doerror(-1))) okayflag
=1;
1718 if (config
->viewbits
&VIEWBITS_SHOWBLACK
) {
1720 CloseScreen(blankscreen
);
1723 ClearPointer(Window
);
1728 if (status_flags
&STATUS_IANSCRAP
&& okayflag
) {
1735 if (status_flags
&STATUS_IANSCRAP
&& okayflag
) {
1742 case FUNC_DATESTAMP
:
1743 if (status_flags
&STATUS_IANSCRAP
&& okayflag
) {
1744 seedate(&datetime
.dat_Stamp
,buf2
,0);
1752 if (count
==0) simplerequest(globstring
[STR_STRING_NOT_FOUND
],
1753 globstring
[STR_CONTINUE
],NULL
);
1755 lsprintf(buf2
,globstring
[STR_MATCHED_FILES
],count
);
1756 simplerequest(buf2
,globstring
[STR_CONTINUE
],NULL
);
1763 if (!status_justabort
) {
1766 main_proc
->pr_WindowPtr
=(APTR
)-1;
1767 if (!(destdir
&& (filelock
=Lock(destdir
,ACCESS_READ
)))) value
=0;
1769 Info(filelock
,&infodata
);
1770 if (ramdisk_lock
&& CompareLock(filelock
,ramdisk_lock
)!=LOCK_DIFFERENT
)
1772 else value
=(infodata
.id_NumBlocks
-infodata
.id_NumBlocksUsed
)*(long long)blocksize
;
1775 if (config
->errorflags
&ERROR_ENABLE_DOS
) main_proc
->pr_WindowPtr
=(APTR
)Window
;
1776 if (specflags
&FUNCFLAGS_BYTEISCHECKFIT
) {
1777 double needed
,percent
;
1779 needed
=data
*blocksize
;
1780 if (value
<1) percent
=0;
1781 else if (value
>=needed
|| needed
<1) {
1785 else percent
=100/(needed
/value
);
1786 sprintf(buf
,globstring
[STR_CHECKFIT_STRING
],data
*(long long)blocksize
,value
,percent
);
1791 strcat(str_select_info
,
1792 (value
<=swindow
->bytessel
)?
1793 globstring
[STR_NO_FIT
]:globstring
[STR_YES_FIT
]);
1794 dostatustext(str_select_info
);
1801 if (okayflag
&& !status_justabort
) okay();
1804 displaydir(act
); seename(act
);
1811 case FUNC_MOVEAS
: if (checksame(sourcedir
,destdir
,2)==LOCK_SAME
) break;
1817 update_buffer_stamp(act
,1);
1820 if (specflags
&FUNCFLAGS_COPYISCLONE
) update_buffer_stamp(act
,1);
1825 case FUNC_DATESTAMP
:
1826 update_buffer_stamp(act
,0);
1833 if (checksame(sourcedir
,destdir
,2)==LOCK_SAME
) break;
1837 update_buffer_stamp(inact
,1);
1843 if (count
>0) rexx_return_value
=count
;
1850 if (prog_indicator
) dotaskmsg(hotkeymsg_port
,PROGRESS_CLOSE
,0,0,NULL
,0);
1851 LFreeRemember(&funckey
);