diff options
author | ZyX <kp-pav@yandex.ru> | 2016-07-30 18:14:25 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-02-14 01:10:05 +0300 |
commit | 222d98310a3b196cf21ca5885765b2ddca9195b6 (patch) | |
tree | d2efb3905674ed10e989fe7166206af620595273 | |
parent | 85e1a565606d04626966321f63db53005d4b162b (diff) | |
download | rneovim-222d98310a3b196cf21ca5885765b2ddca9195b6.tar.gz rneovim-222d98310a3b196cf21ca5885765b2ddca9195b6.tar.bz2 rneovim-222d98310a3b196cf21ca5885765b2ddca9195b6.zip |
os/fileio: Support appending to a file
-rw-r--r-- | src/nvim/os/fileio.c | 2 | ||||
-rw-r--r-- | src/nvim/os/fileio.h | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c index 02b471ef7e..775f2bd449 100644 --- a/src/nvim/os/fileio.c +++ b/src/nvim/os/fileio.c @@ -62,6 +62,8 @@ int file_open(FileDescriptor *const ret_fp, const char *const fname, FLAG(flags, kFileCreate, O_CREAT|O_WRONLY, kTrue, !(flags & kFileCreateOnly)); FLAG(flags, kFileTruncate, O_TRUNC|O_WRONLY, kTrue, !(flags & kFileCreateOnly)); + FLAG(flags, kFileAppend, O_APPEND|O_WRONLY, kTrue, + !(flags & kFileCreateOnly)); FLAG(flags, kFileReadOnly, O_RDONLY, kFalse, wr != kTrue); #ifdef O_NOFOLLOW FLAG(flags, kFileNoSymlink, O_NOFOLLOW, kNone, true); diff --git a/src/nvim/os/fileio.h b/src/nvim/os/fileio.h index 2cffd5c851..0b55cc695f 100644 --- a/src/nvim/os/fileio.h +++ b/src/nvim/os/fileio.h @@ -30,6 +30,8 @@ typedef enum { kFileTruncate = 32, ///< Truncate the file if it exists. ///< Implies kFileWriteOnly. Cannot be used with ///< kFileCreateOnly. + kFileAppend = 64, ///< Append to the file. Implies kFileWriteOnly. Cannot + ///< be used with kFileCreateOnly. } FileOpenFlags; static inline bool file_eof(const FileDescriptor *const fp) |