[PATCH xinput] Increase interactiveness of test* output
Jon TURNEY
jon.turney at dronecode.org.uk
Tue Jul 2 10:13:53 PDT 2013
On 20/08/2012 01:45, Peter Hutterer wrote:
> From: Nikolai Kondrashov <spbnick-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>
>
> Force line buffering for test and test_xi2 to increase interactiveness and
> avoid losing data with non-terminal stdout. This fixes capturing xinput
> test* output into a file.
>
> Signed-off-by: Nikolai Kondrashov <spbnick-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>
> Signed-off-by: Peter Hutterer <peter.hutterer-Pf4JEFdB4epeoWH0uzbU5w at public.gmane.org>
> ---
> src/test.c | 2 ++
> src/test_xi2.c | 2 ++
> 2 files changed, 4 insertions(+)
>
> diff --git a/src/test.c b/src/test.c
> index 97305c5..0c95501 100644
> --- a/src/test.c
> +++ b/src/test.c
> @@ -98,6 +98,8 @@ print_events(Display *dpy)
> {
> XEvent Event;
>
> + setlinebuf(stdout);
I think this just got pushed, but it seems break building xinput for MinGW
(see [1])
It looks like using setvbuf() rather than setlinebuf() should be more
portable. Patch attached.
[1] http://tinderbox.x.org/builds/2013-07-02-0014/logs/xinput/#build
-------------- next part --------------
>From fb2e4bfb7c12f8173ed78c9e363cf8adcf9da19e Mon Sep 17 00:00:00 2001
From: Jon TURNEY <jon.turney at dronecode.org.uk>
Date: Mon, 1 Jul 2013 18:36:28 +0100
Subject: [PATCH app/xinput] Use setvbuf() instead of setlinebuf()
setlinebuf() added in commit bcfa9123b41da8048450ed27aaeffff17b8eee99 is not in
SuS v3, use the exactly equivalent C89 setvbuf() invocation for portability
Signed-off-by: Jon TURNEY <jon.turney at dronecode.org.uk>
---
src/test.c | 2 +-
src/test_xi2.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test.c b/src/test.c
index 0c95501..efd268a 100644
--- a/src/test.c
+++ b/src/test.c
@@ -98,7 +98,7 @@ print_events(Display *dpy)
{
XEvent Event;
- setlinebuf(stdout);
+ setvbuf(stdout, NULL, _IOLBF, 0);
while(1) {
XNextEvent(dpy, &Event);
diff --git a/src/test_xi2.c b/src/test_xi2.c
index 04e1004..3139d72 100644
--- a/src/test_xi2.c
+++ b/src/test_xi2.c
@@ -326,7 +326,7 @@ test_xi2(Display *display,
int deviceid = -1;
int rc;
- setlinebuf(stdout);
+ setvbuf(stdout, NULL, _IOLBF, 0);
rc = list(display, argc, argv, name, desc);
if (rc != EXIT_SUCCESS)
--
1.7.9
More information about the xorg-devel
mailing list