From 4265bb4b1933bb7320bfc36086243a7786fe6b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Thu, 10 Feb 2005 23:26:05 +0000 Subject: [PATCH] we now check for error from get_input_devices git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11330 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/bin/iroster.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/apps/bin/iroster.cpp b/src/apps/bin/iroster.cpp index bc1da1d02a..53d7cdf421 100644 --- a/src/apps/bin/iroster.cpp +++ b/src/apps/bin/iroster.cpp @@ -5,19 +5,24 @@ */ #include +#include #include #include -static void list_devices() +static int list_devices() { BList list; BInputDevice *device; int i, n; + status_t err; printf(" name type state \n"); printf("--------------------------------------------------\n"); - get_input_devices(&list); + if ((err = get_input_devices(&list))!=B_OK) { + fprintf(stderr, "error while get_input_devices: %s\n", strerror(err)); + return -1; + } n = list.CountItems(); if (n == 0) { @@ -33,6 +38,8 @@ static void list_devices() device->Type() == B_KEYBOARD_DEVICE ? "B_KEYBOARD_DEVICE" : "B_UNDEFINED_DEVICE", device->IsRunning() ? "running" : "stopped"); } + + return 0; } static void start_device(const char *name) @@ -79,7 +86,7 @@ int main(int argc, char *argv[]) const char *name; if (argc <= 1) { - list_devices(); + return list_devices(); } else { for (i = 1; i < argc; i++) {