diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-02-07 19:47:25 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-02-07 19:47:25 -0800 |
commit | 418f661cedc045889b23a0f2881a7049b3d008a4 (patch) | |
tree | b14f981b5f75759fa8f7b80631afba75c29339e4 /genvim.txr | |
parent | 177964f81055367da1b7aec8638dfc8a63ec99c5 (diff) | |
download | txr-418f661cedc045889b23a0f2881a7049b3d008a4.tar.gz txr-418f661cedc045889b23a0f2881a7049b3d008a4.tar.bz2 txr-418f661cedc045889b23a0f2881a7049b3d008a4.zip |
New "m" file open mode: non-truncating "w".
Quite surprisingly ISO C lacks a way in fopen to open a file
for writing such that it is not truncated if it already
exists, and not opened in append mode.
(But you will be glad to know that ISO C is adding incredibly
useful features in this area, like Microsoft's fopen_s!)
Let us add modes "m" and "m+" which will be like "w" and "w+",
but without the truncation to zero length (no O_TRUNC
is passed to open).
* stream.c (w_fopen_mode): New static function.
(open_file, open_tail, tail_strategy): Use w_fopen_mode
instead of directly calling w_fopen.
(do_parse_mode): Handle 'm' and set new notrunc flag.
* stream.h (struct stdio_mode): New member, notrunc flag.
(stdio_mode_init_blank, stdio_mode_init_r,
stdio_mode_init_rpb): Initializer macros updated to include
initializer for notrunc flag.
* txr.1: Documented "m" mode.
Diffstat (limited to 'genvim.txr')
0 files changed, 0 insertions, 0 deletions