elvis on a PC - Quick-C
thomas.j.roberts
tjr at cbnewsc.att.com
Fri Aug 31 00:26:50 AEST 1990
>From article <6887 at vax1.acs.udel.EDU>, by bruschke at vax1.acs.udel.EDU (Michiel Bruschke):
>
> In article 2160 of alt.sources Marvin Kraska writes:
>
>> However, I have noticed that on the PC, lost clusters are reported
>>by "chkdsk" on the drive that the temporary file is placed. Sure
>>enough, the recovered file is elvis's temp. I glanced at the tmp.c
>>code, and didn't see anything obvious.
This (aparently) happens only when you have text in named cut-buffers,
and you switch files.
MS-DOS cannot rename a file that is open. elvis does this in cut.c,
function cutswitch(). This BUG has been in MS-DOS since version 2.0,
and is not fixed in 3.3; I suspect it would be difficult to fix in
any version of MS-DOS.
This fix (Turbo C) works for me:
In file cut.c, replace the line [within #ifdef TOS || MSDOS]
rename(tmpname, cutname);
with:
#if MSDOS /* TJR Fix - part 1 of 2 (MS-DOS cannot rename an open file) */
close(fd), close(tmpfd);
tmpfd = -1;
#endif
rename(tmpname, cutname);
#if MSDOS /* TJR Fix - part 2 of 2 */
j = open(cutname, O_RDWR | O_BINARY);
if(j != fd) {
dup2(j,fd);
close(j);
}
#endif
elvis seems to be a GREAT service provided by Steve Kirkendall - Thanks!
I have already sent this fix to him.
Good luck.
Tom Roberts
att!ihlpl!tjrob
More information about the Alt.sources
mailing list