home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1755 < prev    next >
Internet Message Format  |  1990-12-28  |  1KB

  1. From: tjr@cbnewsc.att.com (thomas.j.roberts)
  2. Newsgroups: alt.sources
  3. Subject: Re: elvis on a PC - Quick-C
  4. Message-ID: <1990Aug30.142650.29519@cbnewsc.att.com>
  5. Date: 30 Aug 90 14:26:50 GMT
  6.  
  7. From article <6887@vax1.acs.udel.EDU>, by bruschke@vax1.acs.udel.EDU (Michiel Bruschke):
  8. > In article 2160 of alt.sources Marvin Kraska writes:
  9. >>    However, I have noticed that on the PC, lost clusters are reported
  10. >>by "chkdsk" on the drive that the temporary file is placed.  Sure
  11. >>enough, the recovered file is elvis's temp.  I glanced at the tmp.c
  12. >>code, and didn't see anything obvious. 
  13.  
  14. This (aparently) happens only when you have text in named cut-buffers,
  15. and you switch files.
  16.  
  17. MS-DOS cannot rename a file that is open. elvis does this in cut.c,
  18. function cutswitch(). This BUG has been in MS-DOS since version 2.0,
  19. and is not fixed in 3.3; I suspect it would be difficult to fix in
  20. any version of MS-DOS.
  21.  
  22. This fix (Turbo C) works for me:
  23.  
  24. In file cut.c, replace the line [within #ifdef TOS || MSDOS]
  25.     rename(tmpname, cutname);
  26. with:
  27.  
  28. #if MSDOS  /* TJR Fix - part 1 of 2 (MS-DOS cannot rename an open file) */
  29.     close(fd), close(tmpfd);
  30.     tmpfd = -1;
  31. #endif
  32.     rename(tmpname, cutname);
  33. #if MSDOS  /* TJR Fix - part 2 of 2 */
  34.     j = open(cutname, O_RDWR | O_BINARY);
  35.     if(j != fd) {
  36.         dup2(j,fd);
  37.         close(j);
  38.     }
  39. #endif
  40.  
  41.  
  42. elvis seems to be a GREAT service provided by Steve Kirkendall - Thanks!
  43. I have already sent this fix to him.
  44. Good luck.
  45.  
  46. Tom Roberts
  47. att!ihlpl!tjrob
  48.