Adam Osuchowski wrote:
> fd = open("file");
> read(fd, buffer, size);
> close(fd);
> copy("file", "file~");
> [...here user edits file...]
> fd = open("file.tmp", O_WRONLY|O_CREAT|O_TRUNC);
> write(fd, "new content of file");
> close(fd);
> chmod("file.swp", mode);
> chown("file.swp", owner, group);
> [...if need be, setting other parameters like ACLs...]
> rename("file.swp", "file");
Sure, it's my mistake, it should be file.tmp not file.swp:
fd = open("file");
read(fd, buffer, size);
close(fd);
copy("file", "file~");
[...here user edits file...]
fd = open("file.tmp", O_WRONLY|O_CREAT|O_TRUNC);
write(fd, "new content of file");
close(fd);
chmod("file.tmp", mode);
chown("file.tmp", owner, group);
[...if need be, setting other parameters like ACLs...]
rename("file.tmp", "file");
--
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php