diff mbox series

[BlueZ,v2] emulator: Fix command line parameters with optional argument

Message ID 20200407194059.5734-1-olivier@labapart.com (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series [BlueZ,v2] emulator: Fix command line parameters with optional argument | expand

Commit Message

Olivier MARTIN April 7, 2020, 7:40 p.m. UTC
Some parameters were missing the indication that additional
argument could be expected.
---
 btio/btio.c     | 8 ++++++--
 emulator/main.c | 6 ++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

Comments

Luiz Augusto von Dentz April 15, 2020, 10:40 p.m. UTC | #1
Hi Olivier,

On Tue, Apr 7, 2020 at 12:51 PM Olivier MARTIN <olivier@labapart.com> wrote:
>
> Oops, some debug leftover. Please ignore this patch.

Are you still planning on sending an update for this one?

> On 07.04.20 21:40, Olivier Martin wrote:
> > Some parameters were missing the indication that additional
> > argument could be expected.
> > ---
> >   btio/btio.c     | 8 ++++++--
> >   emulator/main.c | 6 ++++--
> >   2 files changed, 10 insertions(+), 4 deletions(-)
> >
> > diff --git a/btio/btio.c b/btio/btio.c
> > index e7b4db16b..56c59f84e 100644
> > --- a/btio/btio.c
> > +++ b/btio/btio.c
> > @@ -1676,12 +1676,16 @@ GIOChannel *bt_io_connect(BtIOConnect connect, gpointer user_data,
> >       ret = parse_set_opts(&opts, gerr, opt1, args);
> >       va_end(args);
> >
> > -     if (ret == FALSE)
> > +     if (ret == FALSE) {
> > +             fprintf(stderr, "bt_io_connect(type:%d) err1\n", opts.type);
> >               return NULL;
> > +     }
> >
> >       io = create_io(FALSE, &opts, gerr);
> > -     if (io == NULL)
> > +     if (io == NULL) {
> > +             fprintf(stderr, "bt_io_connect(type:%d) err2\n", opts.type);
> >               return NULL;
> > +     }
> >
> >       sock = g_io_channel_unix_get_fd(io);
> >
> > diff --git a/emulator/main.c b/emulator/main.c
> > index 68c53488e..75cb79c7b 100644
> > --- a/emulator/main.c
> > +++ b/emulator/main.c
> > @@ -56,10 +56,12 @@ static void usage(void)
> >       printf("options:\n"
> >               "\t-S                    Create local serial port\n"
> >               "\t-s                    Create local server sockets\n"
> > -             "\t-l [num]              Number of local controllers\n"
> > +             "\t-l[num]               Number of local controllers\n"
> >               "\t-L                    Create LE only controller\n"
> > +             "\t-U[num]               Number of test LE controllers\n"
> >               "\t-B                    Create BR/EDR only controller\n"
> >               "\t-A                    Create AMP controller\n"
> > +             "\t-T[num]               Number of test AMP controllers\n"
> >               "\t-h, --help            Show help options\n");
> >   }
> >
> > @@ -97,7 +99,7 @@ int main(int argc, char *argv[])
> >       for (;;) {
> >               int opt;
> >
> > -             opt = getopt_long(argc, argv, "Ssl::LBAUTvh",
> > +             opt = getopt_long(argc, argv, "Ssl::LBAU::T::vh",
> >                                               main_options, NULL);
> >               if (opt < 0)
> >                       break;
Olivier MARTIN April 15, 2020, 10:43 p.m. UTC | #2
Hi Luiz,

I sent the update directly after my email. See: 
https://www.spinics.net/lists/linux-bluetooth/msg84386.html

Olivier

On 16.04.20 00:40, Luiz Augusto von Dentz wrote:
> Hi Olivier,
>
> On Tue, Apr 7, 2020 at 12:51 PM Olivier MARTIN <olivier@labapart.com> wrote:
>> Oops, some debug leftover. Please ignore this patch.
> Are you still planning on sending an update for this one?
>
>> On 07.04.20 21:40, Olivier Martin wrote:
>>> Some parameters were missing the indication that additional
>>> argument could be expected.
>>> ---
>>>    btio/btio.c     | 8 ++++++--
>>>    emulator/main.c | 6 ++++--
>>>    2 files changed, 10 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/btio/btio.c b/btio/btio.c
>>> index e7b4db16b..56c59f84e 100644
>>> --- a/btio/btio.c
>>> +++ b/btio/btio.c
>>> @@ -1676,12 +1676,16 @@ GIOChannel *bt_io_connect(BtIOConnect connect, gpointer user_data,
>>>        ret = parse_set_opts(&opts, gerr, opt1, args);
>>>        va_end(args);
>>>
>>> -     if (ret == FALSE)
>>> +     if (ret == FALSE) {
>>> +             fprintf(stderr, "bt_io_connect(type:%d) err1\n", opts.type);
>>>                return NULL;
>>> +     }
>>>
>>>        io = create_io(FALSE, &opts, gerr);
>>> -     if (io == NULL)
>>> +     if (io == NULL) {
>>> +             fprintf(stderr, "bt_io_connect(type:%d) err2\n", opts.type);
>>>                return NULL;
>>> +     }
>>>
>>>        sock = g_io_channel_unix_get_fd(io);
>>>
>>> diff --git a/emulator/main.c b/emulator/main.c
>>> index 68c53488e..75cb79c7b 100644
>>> --- a/emulator/main.c
>>> +++ b/emulator/main.c
>>> @@ -56,10 +56,12 @@ static void usage(void)
>>>        printf("options:\n"
>>>                "\t-S                    Create local serial port\n"
>>>                "\t-s                    Create local server sockets\n"
>>> -             "\t-l [num]              Number of local controllers\n"
>>> +             "\t-l[num]               Number of local controllers\n"
>>>                "\t-L                    Create LE only controller\n"
>>> +             "\t-U[num]               Number of test LE controllers\n"
>>>                "\t-B                    Create BR/EDR only controller\n"
>>>                "\t-A                    Create AMP controller\n"
>>> +             "\t-T[num]               Number of test AMP controllers\n"
>>>                "\t-h, --help            Show help options\n");
>>>    }
>>>
>>> @@ -97,7 +99,7 @@ int main(int argc, char *argv[])
>>>        for (;;) {
>>>                int opt;
>>>
>>> -             opt = getopt_long(argc, argv, "Ssl::LBAUTvh",
>>> +             opt = getopt_long(argc, argv, "Ssl::LBAU::T::vh",
>>>                                                main_options, NULL);
>>>                if (opt < 0)
>>>                        break;
>
>
Luiz Augusto von Dentz April 15, 2020, 11:06 p.m. UTC | #3
Hi Olivier,

On Wed, Apr 15, 2020 at 3:43 PM Olivier MARTIN <olivier@labapart.com> wrote:
>
> Hi Luiz,
>
> I sent the update directly after my email. See:
> https://www.spinics.net/lists/linux-bluetooth/msg84386.html
>
> Olivier
>
> On 16.04.20 00:40, Luiz Augusto von Dentz wrote:
> > Hi Olivier,
> >
> > On Tue, Apr 7, 2020 at 12:51 PM Olivier MARTIN <olivier@labapart.com> wrote:
> >> Oops, some debug leftover. Please ignore this patch.
> > Are you still planning on sending an update for this one?
> >
> >> On 07.04.20 21:40, Olivier Martin wrote:
> >>> Some parameters were missing the indication that additional
> >>> argument could be expected.
> >>> ---
> >>>    btio/btio.c     | 8 ++++++--
> >>>    emulator/main.c | 6 ++++--
> >>>    2 files changed, 10 insertions(+), 4 deletions(-)
> >>>
> >>> diff --git a/btio/btio.c b/btio/btio.c
> >>> index e7b4db16b..56c59f84e 100644
> >>> --- a/btio/btio.c
> >>> +++ b/btio/btio.c
> >>> @@ -1676,12 +1676,16 @@ GIOChannel *bt_io_connect(BtIOConnect connect, gpointer user_data,
> >>>        ret = parse_set_opts(&opts, gerr, opt1, args);
> >>>        va_end(args);
> >>>
> >>> -     if (ret == FALSE)
> >>> +     if (ret == FALSE) {
> >>> +             fprintf(stderr, "bt_io_connect(type:%d) err1\n", opts.type);
> >>>                return NULL;
> >>> +     }
> >>>
> >>>        io = create_io(FALSE, &opts, gerr);
> >>> -     if (io == NULL)
> >>> +     if (io == NULL) {
> >>> +             fprintf(stderr, "bt_io_connect(type:%d) err2\n", opts.type);
> >>>                return NULL;
> >>> +     }
> >>>
> >>>        sock = g_io_channel_unix_get_fd(io);
> >>>
> >>> diff --git a/emulator/main.c b/emulator/main.c
> >>> index 68c53488e..75cb79c7b 100644
> >>> --- a/emulator/main.c
> >>> +++ b/emulator/main.c
> >>> @@ -56,10 +56,12 @@ static void usage(void)
> >>>        printf("options:\n"
> >>>                "\t-S                    Create local serial port\n"
> >>>                "\t-s                    Create local server sockets\n"
> >>> -             "\t-l [num]              Number of local controllers\n"
> >>> +             "\t-l[num]               Number of local controllers\n"
> >>>                "\t-L                    Create LE only controller\n"
> >>> +             "\t-U[num]               Number of test LE controllers\n"
> >>>                "\t-B                    Create BR/EDR only controller\n"
> >>>                "\t-A                    Create AMP controller\n"
> >>> +             "\t-T[num]               Number of test AMP controllers\n"
> >>>                "\t-h, --help            Show help options\n");
> >>>    }
> >>>
> >>> @@ -97,7 +99,7 @@ int main(int argc, char *argv[])
> >>>        for (;;) {
> >>>                int opt;
> >>>
> >>> -             opt = getopt_long(argc, argv, "Ssl::LBAUTvh",
> >>> +             opt = getopt_long(argc, argv, "Ssl::LBAU::T::vh",
> >>>                                                main_options, NULL);
> >>>                if (opt < 0)
> >>>                        break;
> >
> >

Applied, thanks.
diff mbox series

Patch

diff --git a/btio/btio.c b/btio/btio.c
index e7b4db16b..56c59f84e 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -1676,12 +1676,16 @@  GIOChannel *bt_io_connect(BtIOConnect connect, gpointer user_data,
 	ret = parse_set_opts(&opts, gerr, opt1, args);
 	va_end(args);
 
-	if (ret == FALSE)
+	if (ret == FALSE) {
+		fprintf(stderr, "bt_io_connect(type:%d) err1\n", opts.type);
 		return NULL;
+	}
 
 	io = create_io(FALSE, &opts, gerr);
-	if (io == NULL)
+	if (io == NULL) {
+		fprintf(stderr, "bt_io_connect(type:%d) err2\n", opts.type);
 		return NULL;
+	}
 
 	sock = g_io_channel_unix_get_fd(io);
 
diff --git a/emulator/main.c b/emulator/main.c
index 68c53488e..75cb79c7b 100644
--- a/emulator/main.c
+++ b/emulator/main.c
@@ -56,10 +56,12 @@  static void usage(void)
 	printf("options:\n"
 		"\t-S                    Create local serial port\n"
 		"\t-s                    Create local server sockets\n"
-		"\t-l [num]              Number of local controllers\n"
+		"\t-l[num]               Number of local controllers\n"
 		"\t-L                    Create LE only controller\n"
+		"\t-U[num]               Number of test LE controllers\n"
 		"\t-B                    Create BR/EDR only controller\n"
 		"\t-A                    Create AMP controller\n"
+		"\t-T[num]               Number of test AMP controllers\n"
 		"\t-h, --help            Show help options\n");
 }
 
@@ -97,7 +99,7 @@  int main(int argc, char *argv[])
 	for (;;) {
 		int opt;
 
-		opt = getopt_long(argc, argv, "Ssl::LBAUTvh",
+		opt = getopt_long(argc, argv, "Ssl::LBAU::T::vh",
 						main_options, NULL);
 		if (opt < 0)
 			break;