summaryrefslogtreecommitdiffstats
path: root/stream.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-11-06 20:57:52 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-11-06 20:57:52 -0800
commit22265dd7d089f9137c75042c9ede58c5e0a6d3e1 (patch)
treeb80f73f7b0d8fc5b3eef87d476c24a94870536e5 /stream.h
parent04ac2824f9fa74583548b0cd58097d550a09b22a (diff)
downloadtxr-22265dd7d089f9137c75042c9ede58c5e0a6d3e1.tar.gz
txr-22265dd7d089f9137c75042c9ede58c5e0a6d3e1.tar.bz2
txr-22265dd7d089f9137c75042c9ede58c5e0a6d3e1.zip
open-process: I/O redirection feature.
In the mode-string of open-process, I/O redirections can now be specified that are carried out in the child process. * stream.c (do_parse_mode): Parse the redirection syntax indicated by >, which has a short and long form. The redirections are entered into a small table in the mode structure. (open_process): In the child process, perform the redirection specified in the mode structure's redirection table. * stream.h (STDIO_MODE_NREDIRS): New preprprocessor symbol. (struct stdio_mode): New array member, redir. * txr.1: Documented.
Diffstat (limited to 'stream.h')
-rw-r--r--stream.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/stream.h b/stream.h
index 9bae897c..5d137d47 100644
--- a/stream.h
+++ b/stream.h
@@ -99,6 +99,8 @@ struct strm_ops {
get_error, get_error_str, clear_error, get_fd, 0, 0, 0, 0 \
}
+#define STDIO_MODE_NREDIRS 4
+
struct stdio_mode {
unsigned malformed : 1;
unsigned read : 1;
@@ -110,6 +112,7 @@ struct stdio_mode {
unsigned unbuf : 1;
unsigned linebuf : 1;
int buforder : 5;
+ int redir[STDIO_MODE_NREDIRS][2];
};
#define stdio_mode_init_blank { 0, 0, 0, 0, 0, 0, 0, 0, 0, -1 }