aboutsummaryrefslogtreecommitdiffstats
path: root/src/pipe-tools
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2026-03-18 01:57:01 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2026-03-18 01:57:01 +0000
commit24637cd3776cda5fd0a919ba9343ba86d82d3e04 (patch)
treedac9d66860d763fedc999ace6e1a5f37d3add229 /src/pipe-tools
parent4cdcab0506e76666800d2bc111c602bb3154cc30 (diff)
downloads6-24637cd3776cda5fd0a919ba9343ba86d82d3e04.tar.gz
More fixes, ftrigr_string addition, doc update
Diffstat (limited to 'src/pipe-tools')
-rw-r--r--src/pipe-tools/s6-ftrig-listen.c4
-rw-r--r--src/pipe-tools/s6-ftrig-listen1.c6
-rw-r--r--src/pipe-tools/s6-ftrig-wait.c6
3 files changed, 10 insertions, 6 deletions
diff --git a/src/pipe-tools/s6-ftrig-listen.c b/src/pipe-tools/s6-ftrig-listen.c
index 5fa3e33..48f5f6b 100644
--- a/src/pipe-tools/s6-ftrig-listen.c
+++ b/src/pipe-tools/s6-ftrig-listen.c
@@ -107,8 +107,8 @@ int main (int argc, char const **argv)
unsigned int i = 0 ;
while (i < n)
{
- struct iovec v ;
- r = ftrigr_peek(&a, ids[i], &v) ;
+ ftrigr_string fs ;
+ r = ftrigr_peek(&a, ids[i], &fs) ;
if (r == -1) strerr_diefu1sys(111, "ftrigr_check") ;
else if (!r) i++ ;
else if (wgolb & GOLB_OR) n = 0 ;
diff --git a/src/pipe-tools/s6-ftrig-listen1.c b/src/pipe-tools/s6-ftrig-listen1.c
index 1a08e6d..9ebd5ca 100644
--- a/src/pipe-tools/s6-ftrig-listen1.c
+++ b/src/pipe-tools/s6-ftrig-listen1.c
@@ -1,5 +1,6 @@
/* ISC license. */
+#include <sys/uio.h>
#include <stdint.h>
#include <errno.h>
#include <signal.h>
@@ -51,7 +52,7 @@ int main (int argc, char const *const *argv)
ftrigr a = FTRIGR_ZERO ;
pid_t pid ;
uint32_t id ;
- struct iovec v[2] = { [1] = { .iov_base = "\n", .iov_len = 1 } } ;
+ ftrigr_string fs ;
unsigned int golc ;
PROG = "s6-ftrig-listen1" ;
@@ -84,7 +85,7 @@ int main (int argc, char const *const *argv)
for (;;)
{
- int r = ftrigr_peek(&a, id, &v[0]) ;
+ int r = ftrigr_peek(&a, id, &fs) ;
if (r == -1) strerr_diefu1sys(111, "ftrigr_peek") ;
if (r) break ;
r = iopause_g(x, 2, &deadline) ;
@@ -99,6 +100,7 @@ int main (int argc, char const *const *argv)
if (ftrigr_update(&a) == -1) strerr_diefu1sys(111, "ftrigr_update") ;
}
+ struct iovec v[2] = { { .iov_base = fs.s, .iov_len = fs.len }, { .iov_base = "\n", .iov_len = 1 } } ;
if (allwritev(1, v, 2) < 2) strerr_diefu1sys(111, "write to stdout") ;
_exit(0) ;
}
diff --git a/src/pipe-tools/s6-ftrig-wait.c b/src/pipe-tools/s6-ftrig-wait.c
index 87b573d..e36fa2d 100644
--- a/src/pipe-tools/s6-ftrig-wait.c
+++ b/src/pipe-tools/s6-ftrig-wait.c
@@ -32,9 +32,9 @@ int main (int argc, char const *const *argv)
tain deadline ;
tain tto = TAIN_INFINITE_RELATIVE ;
ftrigr a = FTRIGR_ZERO ;
+ ftrigr_string fs ;
uint32_t id ;
unsigned int golc ;
- struct iovec v[2] = { [1] = { .iov_base = "\n", .iov_len = 1 } } ;
PROG = "s6-ftrig-wait" ;
golc = gol_main(argc, argv, 0, 0, rgola, GOLA_N, 0, wgola) ;
@@ -54,8 +54,10 @@ int main (int argc, char const *const *argv)
if (!ftrigr_startf_g(&a, &deadline)) strerr_diefu1sys(111, "ftrigr_startf") ;
if (!ftrigr_subscribe_g(&a, &id, 0, 0, argv[0], argv[1], &deadline))
strerr_diefu4sys(111, "subscribe to ", argv[0], " with regexp ", argv[1]) ;
- if (ftrigr_wait_or_g(&a, &id, 1, &v[0], &deadline) == -1)
+ if (ftrigr_wait_or_g(&a, &id, 1, &fs, &deadline) == -1)
strerr_diefu2sys((errno == ETIMEDOUT) ? 99 : 111, "match regexp on ", argv[1]) ;
+
+ struct iovec v[2] = { { .iov_base = fs.s, .iov_len = fs.len }, { .iov_base = "\n", .iov_len = 1 } } ;
if (allwritev(1, v, 2) < siovec_len(v, 2)) strerr_diefu1sys(111, "write to stdout") ;
_exit(0) ;
}