Re: [PATCH] client: Display address if calling 'disconnect' without arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mateusz,

On Thu, Jun 4, 2015 at 10:06 PM, Mateusz Lemusisk <mrlemux@xxxxxxxxx> wrote:
> Before:
>
> [PHILIPS BTM2180]# disconnect
> Attempting to disconnect from
> Successful disconnected
>
> After:
>
> [PHILIPS BTM2180]# disconnect
> Attempting to disconnect from XX:XX:XX:XX:XX:XX
> Successful disconnected
>
> ---
>  client/main.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/client/main.c b/client/main.c
> index 41e95b2..88ae5ed 100644
> --- a/client/main.c
> +++ b/client/main.c
> @@ -1422,7 +1422,19 @@ static void cmd_disconn(const char *arg)
>                 return;
>         }
>
> -       rl_printf("Attempting to disconnect from %s\n", arg);
> +       if (strlen(arg) == 0) {
> +               const char *default_address;
> +               DBusMessageIter iter;
> +
> +               if (g_dbus_proxy_get_property(proxy, "Address", &iter) == FALSE)
> +                       default_address = "";
> +               else
> +                       dbus_message_iter_get_basic(&iter, &default_address);
> +
> +               rl_printf("Attempting to disconnect from %s\n", default_address);
> +       } else {
> +               rl_printf("Attempting to disconnect from %s\n", arg);
> +       }
>  }

Please check the columns limit is 80:
WARNING:LONG_LINE: line over 80 characters
#19: FILE: client/main.c:1434:
+ rl_printf("Attempting to disconnect from %s\n", default_address);

Also there is no need to add braces to single line if/else statements
and perhaps you could move rl_printf line out of them and make it
common so in case you have an arg you just assign it to address
variable, in fact it might be possible to use arg directly.

>  static void cmd_list_attributes(const char *arg)
> --
> 2.4.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Luiz Augusto von Dentz
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux