[PATCH xinput] Increase interactiveness of test* output

Peter Hutterer peter.hutterer at who-t.net
Sun Aug 19 17:45:15 PDT 2012


From: Nikolai Kondrashov <spbnick at gmail.com>

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 at gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 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);
+
     while(1) {
 	XNextEvent(dpy, &Event);
 
diff --git a/src/test_xi2.c b/src/test_xi2.c
index bcb4880..04e1004 100644
--- a/src/test_xi2.c
+++ b/src/test_xi2.c
@@ -326,6 +326,8 @@ test_xi2(Display	*display,
     int deviceid = -1;
     int rc;
 
+    setlinebuf(stdout);
+
     rc = list(display, argc, argv, name, desc);
     if (rc != EXIT_SUCCESS)
         return rc;
-- 
1.7.11.2



More information about the xorg-devel mailing list