>This is wrong. Normally you keep the file descriptor open, then >rewind/seek to the beginning of the file and write the new content. >That way the system overhead for file reopen is avoided.
Normally, in an editor, you do NOT do this. Consider what happens if, behind the scenes, somebody did an "rm file". Your hours of typing would go into a still-open file, to an anonymous inode, and then quietly disappear. People's mental model of an editor is that it's editing a private copy of the file, and only at open/save times does it refer to the filesystem, and it will react to changes found therein. File reopen time is TRIVIAL when compared to the thinking/typing cycle. Consider the normal vi case when the file was (mistakenly) open RO: ed rofile <type type type> :wq <error> :!chmod +w rofile :wq <OK> This would not work if you'd held the FD open all that time. -- Jim _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
