mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
os/fileio: Support appending to a file
This commit is contained in:
parent
85e1a56560
commit
222d98310a
@ -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, kFileCreate, O_CREAT|O_WRONLY, kTrue, !(flags & kFileCreateOnly));
|
||||||
FLAG(flags, kFileTruncate, O_TRUNC|O_WRONLY, kTrue,
|
FLAG(flags, kFileTruncate, O_TRUNC|O_WRONLY, kTrue,
|
||||||
!(flags & kFileCreateOnly));
|
!(flags & kFileCreateOnly));
|
||||||
|
FLAG(flags, kFileAppend, O_APPEND|O_WRONLY, kTrue,
|
||||||
|
!(flags & kFileCreateOnly));
|
||||||
FLAG(flags, kFileReadOnly, O_RDONLY, kFalse, wr != kTrue);
|
FLAG(flags, kFileReadOnly, O_RDONLY, kFalse, wr != kTrue);
|
||||||
#ifdef O_NOFOLLOW
|
#ifdef O_NOFOLLOW
|
||||||
FLAG(flags, kFileNoSymlink, O_NOFOLLOW, kNone, true);
|
FLAG(flags, kFileNoSymlink, O_NOFOLLOW, kNone, true);
|
||||||
|
@ -30,6 +30,8 @@ typedef enum {
|
|||||||
kFileTruncate = 32, ///< Truncate the file if it exists.
|
kFileTruncate = 32, ///< Truncate the file if it exists.
|
||||||
///< Implies kFileWriteOnly. Cannot be used with
|
///< Implies kFileWriteOnly. Cannot be used with
|
||||||
///< kFileCreateOnly.
|
///< kFileCreateOnly.
|
||||||
|
kFileAppend = 64, ///< Append to the file. Implies kFileWriteOnly. Cannot
|
||||||
|
///< be used with kFileCreateOnly.
|
||||||
} FileOpenFlags;
|
} FileOpenFlags;
|
||||||
|
|
||||||
static inline bool file_eof(const FileDescriptor *const fp)
|
static inline bool file_eof(const FileDescriptor *const fp)
|
||||||
|
Loading…
Reference in New Issue
Block a user