Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rutgers!sri-spam!sri-unix!hplabs!hp-sdd!ncr-sd!ncrcae!ece-csc!uvacs!rwl From: rwl@uvacs.UUCP (Ray Lubinsky) Newsgroups: net.unix-wizards Subject: Re: two unix questions -- propriety of vi -r Message-ID: <843@uvacs.UUCP> Date: Tue, 28-Oct-86 10:09:49 EST Article-I.D.: uvacs.843 Posted: Tue Oct 28 10:09:49 1986 Date-Received: Thu, 30-Oct-86 22:35:09 EST References: <108@houligan.UUCP> Organization: U.Va. CS in Charlottesville VA Lines: 31 > 2) Why does 'vi -r file' not set the 'dirty bit' (or whatever it's called) > so that an immediate exit with ZZ will save the file. I lost some > changes after a crash because I had to leave and in my haste just > entered vi (ala above) and exited with ZZ. This did not save my file. > I think it should have. Any thoughts? > I had a professor here ask me the same question, hoping that I would ``fix'' vi(1) so that it would automatically write a recovered file with ``ZZ'' (even though ``vi -r'' is documented as behaving as it does). Just as I was diddling with a copy of one of the source files, the system crashed. When we came back up, I got mail saying that the edit buffer had been saved, even though I had just written the file a few minutes before the crash. Rather than just overwrite what I had, I did a diff on my most recent version and the version saved by vi(1)... Sure enough, *my* version was more up-to- date than the saved buffer. Perhaps you'll see as I did that you don't want an automatic write on recovery; if it had automatically ``updated'' my file, I would have been robbed of my most recent version. Why does ``vi -r'' do what it does? Because you *need* to evaluate whether the saving of the edit buffer was successful or not. I guess that the problem comes in making the recovery of a saved buffer look just like a regular edit session when, in fact, it shouldn't be. -- | Ray Lubinsky Department of Computer Science, University of Virginia | | INTERNET: rwl@uvacs.cs.virginia.edu | | CSNET: rwl%virginia@csnet-relay | | UUCP: ...!cbosgd!uvacs!rwl |