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
This commit is contained in:
Jérôme Duval
2005-02-10 23:26:05 +00:00
parent 20776cc6cf
commit 4265bb4b19
+10 -3
View File
@@ -5,19 +5,24 @@
*/
#include <stdio.h>
#include <string.h>
#include <interface/Input.h>
#include <support/List.h>
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++) {