Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!zaphod.mps.ohio-state.edu!swrinde!ucsd!pacbell.com!pacbell!att!cbnewsc!tjr From: tjr@cbnewsc.att.com (thomas.j.roberts) Newsgroups: alt.sources Subject: Re: elvis on a PC - Quick-C Message-ID: <1990Aug30.142650.29519@cbnewsc.att.com> Date: 30 Aug 90 14:26:50 GMT References: <6887@vax1.acs.udel.EDU> Distribution: usa Organization: AT&T Bell Laboratories Lines: 43 From article <6887@vax1.acs.udel.EDU>, by bruschke@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