summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-05-11 22:08:43 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-05-11 22:08:43 +0000
commit7916e36c144eb07ea2355423ea9288dfd59954e3 (patch)
treec57ab3dd68f1b51bdf6c00c70f72b8d9c39f6b5e
parent1e399d3ab9afe9ce911b3ead03e2f42d84bbf25f (diff)
downloads6-7916e36c144eb07ea2355423ea9288dfd59954e3.tar.xz
s6-ftrig-listen1 now prints the last event to stdout
-rw-r--r--NEWS3
-rw-r--r--doc/s6-ftrig-listen1.html3
-rw-r--r--doc/upgrade.html2
-rw-r--r--src/pipe-tools/s6-ftrig-listen1.c6
4 files changed, 11 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index d70e298..cc6cc59 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ In 2.5.0.1
----------
- Bugfix release.
+ - s6-ftrig-listen1 now prints to stdout the last event (the last
+byte) it received and made it match the regexp it was given.
+This is a bugfix. :)
In 2.5.0.0
diff --git a/doc/s6-ftrig-listen1.html b/doc/s6-ftrig-listen1.html
index a667ce6..25ec893 100644
--- a/doc/s6-ftrig-listen1.html
+++ b/doc/s6-ftrig-listen1.html
@@ -43,7 +43,8 @@ to match <em>regexp</em>. <em>regexp</em> must be an
<a href="http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04">extended
regular expression</a>. </li>
<li> When the series of read events matches <em>regexp</em>,
-s6-ftrig-listen1 exits 0. </li>
+s6-ftrig-listen1 prints the last event it received (one byte) to stdout,
+then exits 0. </li>
</ul>
<h2> Options </h2>
diff --git a/doc/upgrade.html b/doc/upgrade.html
index afff8b2..cf10f2b 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -23,6 +23,8 @@
<ul>
<li> skalibs dependency bumped to 2.5.0.1. </li>
<li> execline dependency bumped to 2.3.0.1. </li>
+ <li> <a href="s6-ftrig-listen1.html">s6-ftrig-listen1</a> prints the last event
+it received to stdout. </li>
</ul>
<h2> in 2.5.0.0 </h2>
diff --git a/src/pipe-tools/s6-ftrig-listen1.c b/src/pipe-tools/s6-ftrig-listen1.c
index e9a5e82..731b1e3 100644
--- a/src/pipe-tools/s6-ftrig-listen1.c
+++ b/src/pipe-tools/s6-ftrig-listen1.c
@@ -6,6 +6,7 @@
#include <unistd.h>
#include <skalibs/sgetopt.h>
#include <skalibs/types.h>
+#include <skalibs/allreadwrite.h>
#include <skalibs/strerr2.h>
#include <skalibs/tai.h>
#include <skalibs/iopause.h>
@@ -34,6 +35,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
ftrigr_t a = FTRIGR_ZERO ;
pid_t pid ;
uint16_t id ;
+ char pack[2] = " \n" ;
PROG = "s6-ftrig-listen1" ;
{
unsigned int t = 0 ;
@@ -71,8 +73,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
for (;;)
{
- char dummy ;
- int r = ftrigr_check(&a, id, &dummy) ;
+ int r = ftrigr_check(&a, id, &pack[0]) ;
if (r < 0) strerr_diefu1sys(111, "ftrigr_check") ;
if (r) break ;
r = iopause_g(x, 2, &deadline) ;
@@ -89,5 +90,6 @@ int main (int argc, char const *const *argv, char const *const *envp)
}
}
+ if (allwrite(1, pack, 2) < 2) strerr_diefu1sys(111, "write to stdout") ;
return 0 ;
}