|
From: Anders J. <and...@us...> - 2003-11-05 21:28:55
|
The following file was modified in apps/bluetooth/utils/btconnect:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
btcon.c 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Replaced BD parsing with library function.
The diff of the modified file(s):
--- btcon.c 2003/11/05 17:04:33 1.2
+++ btcon.c 2003/11/05 19:05:42 1.3
@@ -139,7 +139,7 @@ main(int argc, char **argv)
{
char *bd_str =3D NULL;
unsigned char bd[6];
- int opt, i, result =3D 0;
+ int opt, result =3D 0;
=20=20=20
int line =3D DEFAULT_LINE;
int srvch =3D 1;
@@ -160,38 +160,10 @@ main(int argc, char **argv)
{
case 'a':
{
- int tmp[6], all_read =3D 0;
bd_str =3D optarg;
- if (sscanf(optarg, "%2x%2x%2x%2x%2x%2x",
- &tmp[0], &tmp[1], &tmp[2],
- &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
- {=20=20
- all_read =3D 1;
- }
- else if (sscanf(optarg, "%x:%x:%x:%x:%x:%x",
- &tmp[0], &tmp[1], &tmp[2],
- &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
- {=20=20
- all_read =3D 1;
- }
- else if (sscanf(optarg, "%x-%x-%x-%x-%x-%x",
- &tmp[0], &tmp[1], &tmp[2],
- &tmp[3], &tmp[4], &tmp[5]) =3D=3D 6)
- {=20
- all_read =3D 1;
- }
-=20=20=20=20=20=20=20=20
- /* now convert to real bd format if syntax was correct */
- if (all_read)
- {
- for (i =3D 0; i < 6; i++)
- {
- bd[i] =3D (unsigned char)tmp[i];=20
- }
- }
- else
+ if(strtobd(optarg, bd) < 0)
{
- fprintf(stderr, "Invalid syntax: %s\n", bd_str);
+ fprintf(stderr, "Invalid syntax: %s\n", optarg);
usage();
exit(1);
}
|