aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2019-08-16 14:32:23 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2019-08-16 14:36:33 +0300
commit86d62d746d8e2586e1b3a2995f7119d0562145b8 (patch)
tree592ee9b7e7ea2e2dc4dfd2320f895a3097168e43 /t
parentb40125990e923f743fa4a1b53c7af05feda422cc (diff)
downloadruncap-86d62d746d8e2586e1b3a2995f7119d0562145b8.tar.gz
runcap-86d62d746d8e2586e1b3a2995f7119d0562145b8.tar.bz2
Explicitly indicate EOF when sc_linemon is initialized.
* runcap.3: Document changes. * runcap.c (stream_capture_get): Indicate EOF explicitly by calling sc_linemon function with 0 as line length. * t/rt.c (linemon): Update to handle this case.
Diffstat (limited to 't')
-rw-r--r--t/rt.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/t/rt.c b/t/rt.c
index 05eb036..2c404e2 100644
--- a/t/rt.c
+++ b/t/rt.c
@@ -92,14 +92,17 @@ static void
linemon(const char *ptr, size_t len, void *data)
{
struct linemon_closure *clos = data;
-
- if (!clos->cont) {
- printf("%s:", clos->prefix);
- if (!(len == 1 && ptr[0] == '\n'))
- putchar(' ');
- }
- fwrite(ptr, len, 1, stdout);
- clos->cont = ptr[len-1] != '\n';
+
+ if (len) {
+ if (!clos->cont) {
+ printf("%s:", clos->prefix);
+ if (!(len == 1 && ptr[0] == '\n'))
+ putchar(' ');
+ }
+ fwrite(ptr, len, 1, stdout);
+ } else
+ fflush(stdout);
+ clos->cont = !(len == 0 || ptr[len-1] == '\n');
}
static void

Return to:

Send suggestions and report system problems to the System administrator.