summaryrefslogtreecommitdiff
path: root/usr.sbin/btdevctl
diff options
context:
space:
mode:
authorpavel <pavel@NetBSD.org>2007-08-17 17:59:15 +0000
committerpavel <pavel@NetBSD.org>2007-08-17 17:59:15 +0000
commit5e809e89c6c00a95bd7dcd683b227283e8b5c45e (patch)
treed2b0f7bb2a2d01327d52134de6d138eb59986ffe /usr.sbin/btdevctl
parent1b189c72ab658e0555126f6e59d404c8034e17b6 (diff)
Attempt at fixing build failures after proplib was converted to bool:
FALSE -> false, TRUE -> true, boolean_t -> bool, int -> bool when appropriate, include stdbool.h . proplib.h no longer provides boolean_t, so it is necessary to change to bool. From Tom Spindler (dogcow@).
Diffstat (limited to 'usr.sbin/btdevctl')
-rw-r--r--usr.sbin/btdevctl/btdevctl.c52
-rw-r--r--usr.sbin/btdevctl/db.c13
-rw-r--r--usr.sbin/btdevctl/print.c6
-rw-r--r--usr.sbin/btdevctl/sdp.c8
4 files changed, 40 insertions, 39 deletions
diff --git a/usr.sbin/btdevctl/btdevctl.c b/usr.sbin/btdevctl/btdevctl.c
index 8c28bb5528c..af784156fe5 100644
--- a/usr.sbin/btdevctl/btdevctl.c
+++ b/usr.sbin/btdevctl/btdevctl.c
@@ -1,4 +1,4 @@
-/* $NetBSD: btdevctl.c,v 1.4 2007/04/21 06:15:24 plunky Exp $ */
+/* $NetBSD: btdevctl.c,v 1.5 2007/08/17 17:59:16 pavel Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -34,7 +34,7 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2006 Itronix, Inc.\n"
"All rights reserved.\n");
-__RCSID("$NetBSD: btdevctl.c,v 1.4 2007/04/21 06:15:24 plunky Exp $");
+__RCSID("$NetBSD: btdevctl.c,v 1.5 2007/08/17 17:59:16 pavel Exp $");
#include <prop/proplib.h>
#include <sys/ioctl.h>
@@ -71,17 +71,17 @@ main(int argc, char *argv[])
bdaddr_copy(&raddr, BDADDR_ANY);
service = NULL;
mode = NULL;
- query = FALSE;
- verbose = FALSE;
- attach = FALSE;
- detach = FALSE;
- set = FALSE;
- none = FALSE;
+ query = false;
+ verbose = false;
+ attach = false;
+ detach = false;
+ set = false;
+ none = false;
while ((ch = getopt(argc, argv, "Aa:Dd:hm:qs:v")) != -1) {
switch (ch) {
case 'A': /* Attach device */
- attach = TRUE;
+ attach = true;
break;
case 'a': /* remote address */
@@ -97,7 +97,7 @@ main(int argc, char *argv[])
break;
case 'D': /* Detach device */
- detach = TRUE;
+ detach = true;
break;
case 'd': /* local device address */
@@ -108,7 +108,7 @@ main(int argc, char *argv[])
case 'm': /* link mode */
if (strcasecmp(optarg, "none") == 0)
- none = TRUE;
+ none = true;
else if (strcasecmp(optarg, BTDEVauth) == 0)
mode = BTDEVauth;
else if (strcasecmp(optarg, BTDEVencrypt) == 0)
@@ -121,7 +121,7 @@ main(int argc, char *argv[])
break;
case 'q':
- query = TRUE;
+ query = true;
break;
case 's': /* service */
@@ -129,7 +129,7 @@ main(int argc, char *argv[])
break;
case 'v': /* verbose */
- verbose = TRUE;
+ verbose = true;
break;
case 'h':
@@ -142,25 +142,25 @@ main(int argc, char *argv[])
argv += optind;
if (argc > 0
- || (attach == TRUE && detach == TRUE)
+ || (attach == true && detach == true)
|| bdaddr_any(&laddr)
|| bdaddr_any(&raddr)
|| service == NULL)
usage();
- if (attach == FALSE && detach == FALSE)
- verbose = TRUE;
+ if (attach == false && detach == false)
+ verbose = true;
dev = db_get(&laddr, &raddr, service);
- if (dev == NULL || query == TRUE) {
- if (verbose == TRUE)
+ if (dev == NULL || query == true) {
+ if (verbose == true)
printf("Performing SDP query for service '%s'..\n", service);
dev = cfg_query(&laddr, &raddr, service);
if (dev == NULL)
errx(EXIT_FAILURE, "%s/%s not found", bt_ntoa(&raddr, NULL), service);
- set = TRUE;
+ set = true;
}
if (mode != NULL) {
@@ -169,15 +169,15 @@ main(int argc, char *argv[])
errx(EXIT_FAILURE, "proplib failure (%s)", BTDEVmode);
prop_object_release(obj);
- set = TRUE;
+ set = true;
}
- if (none == TRUE) {
+ if (none == true) {
prop_dictionary_remove(dev, BTDEVmode);
- set = TRUE;
+ set = true;
}
- if (set == TRUE && !db_set(dev, &laddr, &raddr, service))
+ if (set == true && !db_set(dev, &laddr, &raddr, service))
errx(EXIT_FAILURE, "service store failed");
/* add binary local-bdaddr */
@@ -201,13 +201,13 @@ main(int argc, char *argv[])
prop_object_release(obj);
- if (verbose == TRUE)
+ if (verbose == true)
cfg_print(dev);
- if (attach == TRUE)
+ if (attach == true)
bthub_pioctl(BTDEV_ATTACH, dev);
- if (detach == TRUE)
+ if (detach == true)
bthub_pioctl(BTDEV_DETACH, dev);
exit(EXIT_SUCCESS);
diff --git a/usr.sbin/btdevctl/db.c b/usr.sbin/btdevctl/db.c
index 5608b6df89b..1ef5e1294d8 100644
--- a/usr.sbin/btdevctl/db.c
+++ b/usr.sbin/btdevctl/db.c
@@ -1,4 +1,4 @@
-/* $NetBSD: db.c,v 1.3 2007/04/21 06:15:24 plunky Exp $ */
+/* $NetBSD: db.c,v 1.4 2007/08/17 17:59:16 pavel Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -32,11 +32,12 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: db.c,v 1.3 2007/04/21 06:15:24 plunky Exp $");
+__RCSID("$NetBSD: db.c,v 1.4 2007/08/17 17:59:16 pavel Exp $");
#include <bluetooth.h>
#include <err.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <prop/proplib.h>
@@ -50,7 +51,7 @@ __RCSID("$NetBSD: db.c,v 1.3 2007/04/21 06:15:24 plunky Exp $");
#define BTDEVCTL_VERSION 2
static prop_dictionary_t db = NULL;
-static int db_flush = TRUE; /* write db on set */
+static bool db_flush = true; /* write db on set */
static void db_update0(void);
static void db_update1(void);
@@ -137,7 +138,7 @@ db_set(prop_dictionary_t dev, bdaddr_t *laddr, bdaddr_t *raddr, const char *serv
if (!prop_dictionary_set(rdev, service, dev))
return 0;
- if (db_flush == TRUE) {
+ if (db_flush == true) {
version = prop_number_create_integer(BTDEVCTL_VERSION);
if (version == NULL)
err(EXIT_FAILURE, "prop_number_create_integer");
@@ -171,7 +172,7 @@ db_update0(void)
bdaddr_t laddr, raddr;
const char *service;
- db_flush = FALSE; /* no write on set */
+ db_flush = false; /* no write on set */
old = db;
db = prop_dictionary_create();
@@ -220,7 +221,7 @@ db_update0(void)
prop_object_iterator_release(iter);
prop_object_release(old);
- db_flush = TRUE; /* write on set */
+ db_flush = true; /* write on set */
}
/*
diff --git a/usr.sbin/btdevctl/print.c b/usr.sbin/btdevctl/print.c
index e6904738d0c..c98aa91a8a2 100644
--- a/usr.sbin/btdevctl/print.c
+++ b/usr.sbin/btdevctl/print.c
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.8 2007/04/21 06:15:24 plunky Exp $ */
+/* $NetBSD: print.c,v 1.9 2007/08/17 17:59:16 pavel Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: print.c,v 1.8 2007/04/21 06:15:24 plunky Exp $");
+__RCSID("$NetBSD: print.c,v 1.9 2007/08/17 17:59:16 pavel Exp $");
#include <sys/types.h>
@@ -140,7 +140,7 @@ cfg_bthidev(prop_dictionary_t dict)
obj = prop_dictionary_get(dict, BTHIDEVreconnect);
if (prop_bool_true(obj))
- printf("reconnect mode: TRUE\n");
+ printf("reconnect mode: true\n");
obj = prop_dictionary_get(dict, BTHIDEVdescriptor);
if (prop_object_type(obj) == PROP_TYPE_DATA)
diff --git a/usr.sbin/btdevctl/sdp.c b/usr.sbin/btdevctl/sdp.c
index 51c28e1d393..c8cde603a8a 100644
--- a/usr.sbin/btdevctl/sdp.c
+++ b/usr.sbin/btdevctl/sdp.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sdp.c,v 1.3 2007/04/21 06:15:24 plunky Exp $ */
+/* $NetBSD: sdp.c,v 1.4 2007/08/17 17:59:16 pavel Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: sdp.c,v 1.3 2007/04/21 06:15:24 plunky Exp $");
+__RCSID("$NetBSD: sdp.c,v 1.4 2007/08/17 17:59:16 pavel Exp $");
#include <sys/types.h>
@@ -297,7 +297,7 @@ config_hid(prop_dictionary_t dict)
prop_object_release(obj);
if (!reconnect_initiate) {
- obj = prop_bool_create(TRUE);
+ obj = prop_bool_create(true);
if (obj == NULL || !prop_dictionary_set(dict, BTHIDEVreconnect, obj))
return errno;
@@ -380,7 +380,7 @@ config_hf(prop_dictionary_t dict)
prop_object_release(obj);
- obj = prop_bool_create(TRUE);
+ obj = prop_bool_create(true);
if (obj == NULL || !prop_dictionary_set(dict, BTSCOlisten, obj))
return errno;