On Mon, Apr 29, 2013 at 12:10:28PM -0400, Joaquim Rocha wrote:
> The patch looks good but although it looks as intended in the shell's output,
> it's not really writing things in the expected order.
> The issue is that you're using STDOUT_FILENO to print the devices'
> configuration but you're printing the separator ('----'...) to stdout and
> although this would be essencially the same, the latter will be put at the
> end of the buffer (you can check this out by redirecting the output to a
> file).
>
> Replacing "fprintf(stdout," with "dprintf(STDOUT_FILENO," will fix it ;)
hah, good call, I didn't think of that. fixed, thanks for testing.
Cheers,
Peter
>
> Cheers,
>
> --
> Joaquim Rocha
> http://www.joaquimrocha.com
>
> ----- Original Message -----
> From: "Peter Hutterer" <[email protected]>
> To: [email protected]
> Cc: [email protected]
> Sent: Friday, April 26, 2013 1:39:55 AM
> Subject: [PATCH libwacom] tools: use stdout for printing, not stdin
>
> Signed-off-by: Peter Hutterer <[email protected]>
> Reported-by: Joaquim Rocha <[email protected]>
> ---
> oops.
>
> tools/list-devices.c | 3 ++-
> tools/list-local-devices.c | 3 ++-
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/tools/list-devices.c b/tools/list-devices.c
> index 4a96434..79d13e8 100644
> --- a/tools/list-devices.c
> +++ b/tools/list-devices.c
> @@ -31,6 +31,7 @@
> #include <stdio.h>
> #include <string.h>
> #include <assert.h>
> +#include <unistd.h>
> #include "libwacom.h"
>
> static void print_device_info (WacomDevice *device, WacomBusType
> bus_type_filter)
> @@ -40,7 +41,7 @@ static void print_device_info (WacomDevice *device,
> WacomBusType bus_type_filter
> for (match = libwacom_get_matches(device); *match; match++) {
> WacomBusType type = libwacom_match_get_bustype(*match);
> if (type != bus_type_filter)
> - libwacom_print_device_description(0, device);
> + libwacom_print_device_description(STDOUT_FILENO,
> device);
> }
> }
>
> diff --git a/tools/list-local-devices.c b/tools/list-local-devices.c
> index 17cd28c..b6e5b89 100644
> --- a/tools/list-local-devices.c
> +++ b/tools/list-local-devices.c
> @@ -31,6 +31,7 @@
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> +#include <unistd.h>
> #include <assert.h>
> #include <dirent.h>
> #include <glib/gi18n.h>
> @@ -98,7 +99,7 @@ int main(int argc, char **argv)
> dev = libwacom_new_from_path(db, fname, WFALLBACK_NONE, NULL);
> if (!dev)
> continue;
> - libwacom_print_device_description(0, dev);
> + libwacom_print_device_description(STDOUT_FILENO, dev);
> libwacom_destroy(dev);
>
> fprintf(stdout,
> "---------------------------------------------------------------\n");
> --
> 1.8.1.4
>
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
> _______________________________________________
> Linuxwacom-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
>
------------------------------------------------------------------------------
Introducing AppDynamics Lite, a free troubleshooting tool for Java/.NET
Get 100% visibility into your production application - at no cost.
Code-level diagnostics for performance bottlenecks with <2% overhead
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap1
_______________________________________________
Linuxwacom-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel