|
From: Peter K. <pk...@us...> - 2001-04-04 10:32:05
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
btcon.c 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Minor clean-up.
The diff of the modified file(s):
--- btcon.c 2001/03/21 18:46:02 1.2
+++ btcon.c 2001/04/04 10:32:03 1.3
@@ -65,33 +65,24 @@
#define DEFAULT_BTDEV "/dev/ttyBT0"
=20
/*
- * Syntax : btcon -d <device> -p <pincode> -a <BD> -S <rfcomm srv ch>
+ * Syntax : btcon [-d <device>] [-p <pincode>] -a <BD> [-S <rfcomm srv ch>]
* If using 'disable' as pin, authentication is disabled=20
*/
=20
int
main(int argc, char **argv)
{
- char *btdev =3D NULL;
+ char *btdev =3D DEFAULT_BTDEV;
char *bd_str =3D NULL;
unsigned char bd[6];
int con_id, opt, i, result;
int line, bt_cfd, srvch =3D 1;
=20
-#ifdef __CRIS__
/* Print header if called via http */
if (getenv("REQUEST_METHOD") !=3D NULL)
{
printf("Content-type: text/plain\r\n\r\n");
}
-#endif
-
- /* First of all check that stack is running */
- if (!bt_isinitiated())
- {
- printf("Stack not initiated, exit\n");
- exit(1);
- }
=20
/* now parse options */
#define OPTIONS_STRING "a:d:r:S:p:"
@@ -100,7 +91,6 @@
{
switch(opt)
{
-=20=20=20=20=20=20
case 'a':
{
int tmp[6], all_read =3D 0;
@@ -145,15 +135,13 @@
case 'd':
/* BT device */
btdev=3Doptarg;
- printf("btdev : %s\n", btdev);
+ printf("btdev %s\n", btdev);
break;
=20=20=20=20=20=20=20
case 'p':
- {=20
/* If using 'disable' as pin, authentication is disabled */
printf("Using pin code : %s\n", optarg);
set_pin_code(optarg);
- }
break;
=20
case 'S':
@@ -161,19 +149,22 @@
printf("Using rfcomm server ch : %d\n", srvch);
break;
=20=20=20=20=20=20=20
- case '?':
- printf("unknown option: %c\n", optopt);
+ default:
break;
}
}
=20
- if (!btdev)
- btdev =3D DEFAULT_BTDEV;
-
- if (argc < 2 || (bd_str =3D=3D NULL))
+ if (optind < argc || !bd_str)
{=20=20=20=20
printf("Wrong syntax or missing parameters\n");
- printf("Syntax : btcon -d <device> -p <pincode> -a <BD> -S <rfcomm srv=
ch>\n");=20=20=20=20=20=20=20=20
+ printf("Syntax: %s [-d <device>] [-p <pincode>] -a <BD> [-S <rfcomm sr=
v ch>]\n", argv[0]);
+ exit(1);
+ }
+
+ /* First of all check that stack is running */
+ if (!bt_isinitiated())
+ {
+ printf("Stack not initiated, exit\n");
exit(1);
}
=20
|