diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2020-04-15 06:45:13 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2020-04-15 06:45:13 -0700 |
commit | 3f83104f00ce3818a3ea257be7ea8a7b4134e9be (patch) | |
tree | 60f7dcd98c6bc31169495f8fa40f308cd741ae6b /stream.h | |
parent | a3d57c4d0a70adb874afc9d74321494ff9367e0f (diff) | |
download | txr-3f83104f00ce3818a3ea257be7ea8a7b4134e9be.tar.gz txr-3f83104f00ce3818a3ea257be7ea8a7b4134e9be.tar.bz2 txr-3f83104f00ce3818a3ea257be7ea8a7b4134e9be.zip |
New "n" open file mode option: nonblocking.
* stream.c (w_fopen_mode): Special handling via open and
fdopen is now required if either the m.notrunc or m.nonblock
is present. Since m.nonblock is just an option that can be
used with any open mode, we must handle the mode flags more
fully, to generate more possible combinations of open flags.
(do_parse_mode): Check for 'n', and set nonblock flag.
* stream.h (struct stdio_mode): New member, nonblock.
(stdio_moe_init_blank, stdio_mode_init_r,
stdio_mode_init_rpb): Update initalizers to set nonblock to
zero.
* txr.1: Documented, and also added missing i option to the
mode string syntax grammar summary.
Diffstat (limited to 'stream.h')
-rw-r--r-- | stream.h | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -109,6 +109,7 @@ struct stdio_mode { unsigned append : 1; unsigned binary : 1; unsigned notrunc : 1; + unsigned nonblock : 1; unsigned interactive : 1; unsigned unbuf : 1; unsigned linebuf : 1; @@ -116,9 +117,9 @@ struct stdio_mode { int redir[STDIO_MODE_NREDIRS][2]; }; -#define stdio_mode_init_blank { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, { { 0 } } } -#define stdio_mode_init_r { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, { { 0 } } } -#define stdio_mode_init_rpb { 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, -1, { { 0 } } } +#define stdio_mode_init_blank { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, { { 0 } } } +#define stdio_mode_init_r { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, { { 0 } } } +#define stdio_mode_init_rpb { 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, -1, { { 0 } } } #define std_input (deref(lookup_var_l(nil, stdin_s))) #define std_output (deref(lookup_var_l(nil, stdout_s))) |