diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-08-16 11:33:07 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-08-16 11:33:07 +0300 |
commit | b40125990e923f743fa4a1b53c7af05feda422cc (patch) | |
tree | 1c56eed51640589503298846fcb1c6110dff09a7 /runcap.h | |
parent | 5b7e047dfdb34d0fdc3720e14dd08a7693948b2f (diff) | |
download | runcap-b40125990e923f743fa4a1b53c7af05feda422cc.tar.gz runcap-b40125990e923f743fa4a1b53c7af05feda422cc.tar.bz2 |
Run line monitor functions with stream capturing disabled
* runcap.3: Document changes.
* runcap.c (stream_capture_init): Change signature. Change to static.
(stream_capture_free): Change to static.
(stream_capture_get): Special handling for "no capture" streams with
line monitors.
* runcap.h (stream_capture): New member: sc_nocap.
(RCF_STDOUT_NOCAP)
(RCF_STDERR_NOCAP): New flags.
* t/Makefile.am: Add new tests.
* t/testsuite.at: Likewise.
* t/linemon02.at: Add copyright header.
* t/linemon03.at: New test.
* t/nocap.inc: New include file.
* t/nocap00.at: New test.
* t/nocap01.at: New test.
* t/rt.c: New option: -N
Diffstat (limited to 'runcap.h')
-rw-r--r-- | runcap.h | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -31,6 +31,7 @@ struct stream_capture void (*sc_linemon)(const char *, size_t, void *); /* Line monitor function */ void *sc_monarg; /* Line monitor argument */ + int sc_nocap; /* If 1, capturing is disabled */ }; #define STRCAP_BUFSIZE 4096 @@ -57,13 +58,12 @@ struct runcap #define RCF_PROGRAM 0x0001 /* rc_program is set */ #define RCF_TIMEOUT 0x0002 /* rc_timeout is set */ #define RCF_STDIN 0x0004 /* rc_cap[RUNCAP_STDIN] is set */ -#define RCF_STDOUT_SIZE 0x0008 -#define RCF_STDOUT_LINEMON 0x0010 -#define RCF_STDERR_SIZE 0x0020 -#define RCF_STDERR_LINEMON 0x0040 - -int stream_capture_init(struct stream_capture *fc, size_t size); -void stream_capture_free(struct stream_capture *fc); +#define RCF_STDOUT_SIZE 0x0008 /* rc_cap[RUNCAP_STDOUT].sc_size is set */ +#define RCF_STDOUT_LINEMON 0x0010 /* rc_cap[RUNCAP_STDOUT].sc_linemon is set */ +#define RCF_STDERR_SIZE 0x0020 /* rc_cap[RUNCAP_STDERR].sc_size is set */ +#define RCF_STDERR_LINEMON 0x0040 /* rc_cap[RUNCAP_STDERR].sc_linemon is set */ +#define RCF_STDOUT_NOCAP 0x0080 /* disable stdout capturing */ +#define RCF_STDERR_NOCAP 0x0100 /* disable stderr capturing */ int runcap(struct runcap *rc, int flags); void runcap_free(struct runcap *rc); @@ -80,7 +80,7 @@ runcap_get_capture(struct runcap *rc, int stream) fp = &rc->rc_cap[stream]; - if (!fp->sc_base || fp->sc_size == 0) { + if (!fp->sc_base || fp->sc_size == 0 || fp->sc_nocap) { errno = EINVAL; return NULL; } |