diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-12-14 22:08:35 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-12-14 22:08:35 +0000 |
commit | bca84a12bdbb4bb33e9ba32bfe320abbf54ae5fb (patch) | |
tree | 7a3e5e91df211e51914098550a5a5bfca0760c69 /src | |
parent | 38f1825274b07d66ecb264316aaeba286e937fb8 (diff) |
updated for version 7.0170v7.0170
Diffstat (limited to 'src')
-rw-r--r-- | src/ex_cmds.c | 25 | ||||
-rw-r--r-- | src/ex_cmds.h | 2 |
2 files changed, 23 insertions, 4 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 1dcbb2be09..1d8348d297 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -1656,6 +1656,9 @@ write_viminfo(file, forceit) int shortname = FALSE; /* use 8.3 file name */ struct stat st_old; /* mch_stat() of existing viminfo file */ #endif +#ifdef WIN3264 + long perm = -1; +#endif if (no_viminfo()) return; @@ -1713,6 +1716,10 @@ write_viminfo(file, forceit) goto end; } #endif +#ifdef WIN3264 + /* Get the file attributes of the existing viminfo file. */ + perm = mch_getperm(fname); +#endif /* * Make tempname. @@ -1803,15 +1810,16 @@ write_viminfo(file, forceit) int fd; /* Use mch_open() to be able to use O_NOFOLLOW and set file - * protection same as original file, but strip s-bit. */ + * protection: + * Unix: same as original file, but strip s-bit. + * Others: r&w for user only. */ #ifdef UNIX fd = mch_open((char *)tempname, O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, (int)((st_old.st_mode & 0777) | 0600)); #else fd = mch_open((char *)tempname, - O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, - 0600); /* r&w for user only */ + O_CREAT|O_EXTRA|O_EXCL|O_WRONLY|O_NOFOLLOW, 0600); #endif if (fd < 0) fp_out = NULL; @@ -1866,12 +1874,21 @@ write_viminfo(file, forceit) if (fp_in != NULL) { fclose(fp_in); + /* - * In case of an error, don't overwrite the original viminfo file. + * In case of an error keep the original viminfo file. + * Otherwise rename the newly written file. */ if (viminfo_errcnt || vim_rename(tempname, fname) == -1) mch_remove(tempname); + +#ifdef WIN3264 + /* If the viminfo file was hidden then also hide the new file. */ + if (perm > 0 && (perm & FILE_ATTRIBUTE_HIDDEN)) + mch_hide(fname); +#endif } + end: vim_free(fname); vim_free(tempname); diff --git a/src/ex_cmds.h b/src/ex_cmds.h index 87c9e6a232..4c4ab6ff07 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -781,6 +781,8 @@ EX(CMD_stag, "stag", ex_stag, RANGE|NOTADR|BANG|WORD1|TRLBAR|ZEROR), EX(CMD_startinsert, "startinsert", ex_startinsert, BANG|TRLBAR|CMDWIN), +EX(CMD_startgreplace, "startgreplace", ex_startinsert, + BANG|TRLBAR|CMDWIN), EX(CMD_startreplace, "startreplace", ex_startinsert, BANG|TRLBAR|CMDWIN), EX(CMD_stopinsert, "stopinsert", ex_stopinsert, |